source: LFS/lfs.xsl@ 9a61ead

ablfs-more legacy trunk
Last change on this file since 9a61ead was 9a61ead, checked in by Pierre Labastie <pierre@…>, 5 years ago

attr does not install man pages in man2 and man5 anymore, so no need

for removing them. This fixes a stupid bug, that removed all man-pages
man2 pages when porg was used!

  • Property mode set to 100644
File size: 48.1 KB
RevLine 
[7072e1f]1<?xml version="1.0" encoding="ISO-8859-1"?>
[db181c47]2
[877cc6a]3<!-- $Id$ -->
4
[7072e1f]5<xsl:stylesheet
6 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
7 xmlns:exsl="http://exslt.org/common"
8 extension-element-prefixes="exsl"
9 version="1.0">
[557fe91]10
[945ccaa]11<!-- Parameters -->
12
[0ad3a33]13 <!-- which revision attribute to include: can only be sysv or systemd,
14 but we leave checking to the caller-->
15 <xsl:param name="revision" select="'sysv'"/>
16
[7072e1f]17 <!-- use package management ?
18 n = no, original behavior
19 y = yes, add PKG_DEST to scripts in install commands of chapter06-08
20 -->
[945ccaa]21 <xsl:param name="pkgmngt" select="'n'"/>
22
23 <!-- Package management with "porg style" ?
24 n = no, same as pkgmngt description above
25 y = yes, wrap install commands of chapter06-08 into a bash function.
26 note that pkgmngt must be 'y' in this case
27 -->
28 <xsl:param name="wrap-install" select='"n"'/>
[2e1c1c3]29
[31d6944]30 <!-- Run test suites?
31 0 = none
[945ccaa]32 1 = only chapter06 critical testsuites
[31d6944]33 2 = all chapter06 testsuites
[28f4756]34 3 = all chapter05 and chapter06 testsuites
35 -->
[31d6944]36 <xsl:param name="testsuite" select="1"/>
[01e51a1]37
[28f4756]38 <!-- Bomb on test suites failures?
[401f81e]39 n = no, I want to build the full system and review the logs
40 y = yes, bomb at the first test suite failure to can review the build dir
[28f4756]41 -->
[945ccaa]42 <xsl:param name="bomb-testsuite" select="'n'"/>
[28f4756]43
[085435e]44 <!-- Install non wide character ncurses 5? -->
45 <xsl:param name="ncurses5" select="'n'"/>
[2e1c1c3]46
[dc7fd7b]47 <!-- Should we strip excutables and libraries? -->
48 <xsl:param name='strip' select="'n'"/>
49
50 <!-- Should we remove .la files after chapter 5 and chapter 6? -->
51 <xsl:param name='del-la-files' select="'y'"/>
52
[877cc6a]53 <!-- Time zone -->
[945ccaa]54 <xsl:param name="timezone" select="'GMT'"/>
[2e1c1c3]55
[877cc6a]56 <!-- Page size -->
[945ccaa]57 <xsl:param name="page" select="'letter'"/>
[2e1c1c3]58
[877cc6a]59 <!-- Locale settings -->
[945ccaa]60 <xsl:param name="lang" select="'C'"/>
[b339c94]61
62 <!-- Install the whole set of locales -->
[945ccaa]63 <xsl:param name='full-locale' select='"n"'/>
[2e1c1c3]64
[945ccaa]65 <!-- Hostname -->
66 <xsl:param name='hostname' select='"HOSTNAME"'/>
67
68 <!-- Network parameters: interface, ip, gateway, prefix, broadcast, domain
69 and nameservers -->
70 <xsl:param name='interface' select="'eth0'"/>
71 <xsl:param name='ip' select='"10.0.2.9"'/>
72 <xsl:param name='gateway' select='"10.0.2.2"'/>
73 <xsl:param name='prefix' select='24'/>
74 <xsl:param name='broadcast' select='"10.0.2.255"'/>
75 <xsl:param name='domain' select='"lfs.org"'/>
76 <xsl:param name='nameserver1' select='"10.0.2.3"'/>
77 <xsl:param name='nameserver2' select='"8.8.8.8"'/>
78
[3b43e17b]79 <!-- Console parameters: font, fontmap, unicode (y/n), keymap, local (y:
80 hardware clock set to local time/n:hardware clock set to UTC)
81 and log-level -->
82 <xsl:param name='font' select="'lat0-16'"/>
83 <xsl:param name='keymap' select="'us'"/>
84 <xsl:param name='local' select="'n'"/>
85 <xsl:param name='log-level' select="'4'"/>
86
[2758d94]87 <!-- The scripts root is needed for printing disk usage -->
88 <xsl:param name='script-root' select="'jhalfs'"/>
89
[945ccaa]90<!-- End parameters -->
91
[557fe91]92 <xsl:template match="/">
[0ad3a33]93 <xsl:apply-templates select="//sect1[not(@revision) or
94 @revision=$revision]"/>
[557fe91]95 </xsl:template>
[2e1c1c3]96
[557fe91]97 <xsl:template match="sect1">
[1814367]98<!-- Since this xsl:if tag encloses the whole template, it would
99 be much better to transpose this condition to the select part
100 of the "calling" apply-template. But that would change the numbering,
101 so that it would be difficult to compare to previous versions. So for
102 version 2.4, let us keep this -->
[7072e1f]103 <xsl:if test="(../@id='chapter-temporary-tools' or
[14eaa9f]104 ../@id='chapter-building-system' or
105 ../@id='chapter-bootscripts' or
106 ../@id='chapter-bootable') and
[1814367]107 (sect2[not(@revision) or @revision=$revision]//..|.)/
108 screen[(not(@role) or @role != 'nodump') and
109 (not(@revision) or @revision=$revision)]/
110 userinput[not(starts-with(string(),'chroot'))]">
[d68eb1b]111<!-- The last condition is a hack to allow previous versions of the
112 book where the chroot commands did not have role="nodump".
113 It only works if the chroot command is the only one on the page -->
[c4cf6de]114 <!-- The dirs names -->
115 <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
116 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
117 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
118 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
[7072e1f]119 <!-- The file names -->
120 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
121 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
122 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
123 <!-- The build order -->
124 <xsl:variable name="position" select="position()"/>
125 <xsl:variable name="order">
126 <xsl:choose>
127 <xsl:when test="string-length($position) = 1">
128 <xsl:text>00</xsl:text>
129 <xsl:value-of select="$position"/>
130 </xsl:when>
131 <xsl:when test="string-length($position) = 2">
132 <xsl:text>0</xsl:text>
133 <xsl:value-of select="$position"/>
134 </xsl:when>
135 <xsl:otherwise>
136 <xsl:value-of select="$position"/>
137 </xsl:otherwise>
138 </xsl:choose>
139 </xsl:variable>
140 <!-- Inclusion of package manager scriptlets -->
141 <xsl:if test="@id='ch-tools-stripping' and $pkgmngt='y'">
142 <xsl:apply-templates
[575bcf3]143 select="document('packageManager.xml')//sect1[contains(@id,'ch-tools')]"
[7072e1f]144 mode="pkgmngt">
[575bcf3]145 <xsl:with-param name="order" select="$order"/>
[7072e1f]146 <xsl:with-param name="dirname" select="$dirname"/>
147 </xsl:apply-templates>
148 </xsl:if>
149 <xsl:if test="@id='ch-system-strippingagain' and $pkgmngt='y'">
150 <xsl:apply-templates
[575bcf3]151 select="document('packageManager.xml')//sect1[contains(@id,'ch-system')]"
[7072e1f]152 mode="pkgmngt">
[575bcf3]153 <xsl:with-param name="order" select="$order"/>
[7072e1f]154 <xsl:with-param name="dirname" select="$dirname"/>
155 </xsl:apply-templates>
156 </xsl:if>
157 <!-- Creating dirs and files -->
158 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
159 <xsl:choose>
160 <xsl:when test="@id='ch-system-creatingdirs' or
[2e1c1c3]161 @id='ch-system-createfiles' or
[7072e1f]162 @id='ch-system-strippingagain'">
163 <xsl:text>#!/tools/bin/bash&#xA;set +h&#xA;</xsl:text>
164 </xsl:when>
165 <xsl:otherwise>
166 <xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
167 </xsl:otherwise>
168 </xsl:choose>
169 <xsl:if test="not(@id='ch-tools-stripping') and
170 not(@id='ch-system-strippingagain')">
171 <xsl:text>set -e&#xA;</xsl:text>
172 </xsl:if>
173 <xsl:text>&#xA;</xsl:text>
[5451eae]174 <xsl:call-template name="start-script">
175 <xsl:with-param name="order" select="$order"/>
176 </xsl:call-template>
[0ad3a33]177 <xsl:apply-templates select="sect2[not(@revision) or
178 @revision=$revision] |
179 screen[(not(@role) or
180 @role!='nodump') and
181 (not(@revision) or
182 @revision=$revision)]/userinput"/>
[e6e0c85]183 <xsl:if test="@id='ch-system-creatingdirs' and $pkgmngt='y'">
[f0a31de]184 <xsl:apply-templates
185 select="document('packageManager.xml')//sect1[
186 @id='ch-pkgmngt-creatingdirs'
[e6e0c85]187 ]//userinput"
188 mode="pkgmngt"/>
[f0a31de]189 </xsl:if>
[e6e0c85]190 <xsl:if test="@id='ch-system-createfiles' and $pkgmngt='y'">
[f0a31de]191 <xsl:apply-templates
192 select="document('packageManager.xml')//sect1[
193 @id='ch-pkgmngt-createfiles'
[e6e0c85]194 ]//userinput"
195 mode="pkgmngt"/>
[f0a31de]196 </xsl:if>
[d68eb1b]197 <xsl:text>echo -e "\n\nTotalseconds: $SECONDS\n"&#xA;</xsl:text>
[5451eae]198 <xsl:call-template name="end-script"/>
[f0a31de]199 <xsl:text>exit&#xA;</xsl:text>
200 </exsl:document>
201 </xsl:if>
202 </xsl:template>
203
204 <xsl:template match="sect2">
205 <xsl:apply-templates
[0ad3a33]206 select=".//screen[(not(@role) or
207 @role != 'nodump') and
208 (not(@revision) or
209 @revision=$revision)]/userinput[
[f0a31de]210 @remap = 'pre' or
211 @remap = 'configure' or
212 @remap = 'make' or
213 @remap = 'test' and
[f2e80ac]214 not(current()/../@id='ch-tools-dejagnu') and
215 not(current()/../@id='ch-system-systemd')]"/>
[f0a31de]216 <xsl:if
217 test="ancestor::chapter[@id != 'chapter-temporary-tools'] and
218 $pkgmngt = 'y' and
219 descendant::screen[not(@role) or
220 @role != 'nodump']/userinput[
221 @remap='install']">
[945ccaa]222 <xsl:choose>
223 <xsl:when test="$wrap-install='y'">
224 <xsl:text>wrapInstall '
225</xsl:text>
226 </xsl:when>
227 <xsl:otherwise>
[adbd09b]228<!-- We cannot know which directory(ies) are needed by the package. Create a
229 reasonable bunch of them. Should be close to "Creating Directories".-->
230 <xsl:text>mkdir -pv $PKG_DEST/{bin,boot,etc,lib,sbin}
231mkdir -pv $PKG_DEST/usr/{bin,include,lib/pkgconfig,sbin}
[2758d94]232mkdir -pv $PKG_DEST/usr/share/{doc,info,bash-completion/completions}
[7072e1f]233mkdir -pv $PKG_DEST/usr/share/man/man{1..8}
234case $(uname -m) in
[adbd09b]235 x86_64) mkdir -v $PKG_DEST/lib64 ;;
[7072e1f]236esac
237</xsl:text>
[945ccaa]238 </xsl:otherwise>
239 </xsl:choose>
[f0a31de]240 </xsl:if>
241 <xsl:apply-templates
[0ad3a33]242 select=".//screen[(not(@role) or
243 @role != 'nodump') and
244 (not(@revision) or
245 @revision=$revision)]/userinput[@remap = 'install']"/>
[f0a31de]246 <xsl:if test="ancestor::chapter[@id != 'chapter-temporary-tools'] and
247 descendant::screen[not(@role) or
248 @role != 'nodump']/userinput[
249 @remap='install']">
[945ccaa]250 <xsl:choose>
[dc7fd7b]251 <xsl:when test="$pkgmngt='n'"/>
[945ccaa]252 <xsl:when test="$wrap-install='y'">
253 <xsl:if test="../@id = 'ch-system-man-pages'">
[560bef1]254<!-- these files are provided by the shadow package -->
[945ccaa]255 <xsl:text>rm -fv /usr/share/man/{man3/getspnam.3,man5/passwd.5}
256</xsl:text>
257 </xsl:if>
258<!-- nologin is installed by util-linux. remove it from shadow -->
259 <xsl:if test="../@id = 'ch-system-shadow'">
260 <xsl:text>rm -fv /usr/share/man/man8/nologin.8
261rm -fv /sbin/nologin
262</xsl:text>
263 </xsl:if>
264 <xsl:text>'
[9bbb9c8]265PREV_SEC=${SECONDS}
[945ccaa]266packInstall
[9bbb9c8]267SECONDS=${PREV_SEC}
[945ccaa]268</xsl:text>
269 </xsl:when>
270 <xsl:otherwise>
271 <xsl:if test="../@id = 'ch-system-man-pages'">
272<!-- these files are provided by the shadow package -->
273 <xsl:text>rm -fv $PKG_DEST/usr/share/man/{man3/getspnam.3,man5/passwd.5}
[a983256]274</xsl:text>
[945ccaa]275 </xsl:if>
[a983256]276<!-- nologin is installed by util-linux. remove it from shadow -->
[945ccaa]277 <xsl:if test="../@id = 'ch-system-shadow'">
278 <xsl:text>rm -fv $PKG_DEST/usr/share/man/man8/nologin.8
[a983256]279rm -fv $PKG_DEST/sbin/nologin
[7072e1f]280</xsl:text>
[945ccaa]281 </xsl:if>
[adbd09b]282<!-- remove empty directories -->
283 <xsl:text>for dir in $PKG_DEST/usr/share/man/man{1..8} \
[2758d94]284 $PKG_DEST/usr/share/bash-completion{/completions,} \
285 $PKG_DEST/usr/share/{doc,info,man,} \
[adbd09b]286 $PKG_DEST/usr/lib/pkgconfig \
287 $PKG_DEST/usr/{lib,bin,sbin,include} \
288 $PKG_DEST/{boot,etc,lib,bin,sbin}; do
289 [ -d "$dir" ] &amp;&amp; [ -z "$(ls $dir)" ] &amp;&amp; rmdir -v $dir
[7072e1f]290done
[adbd09b]291[ -d $PKG_DEST/lib64 ] &amp;&amp; [ -z "$(ls $PKG_DEST/lib64)" ] &amp;&amp;
292 rmdir -v $PKG_DEST/lib64
[9bbb9c8]293PREV_SEC=${SECONDS}
[7072e1f]294packInstall
[9bbb9c8]295SECONDS=${PREV_SEC}
[7072e1f]296rm -rf $PKG_DEST
297</xsl:text>
[945ccaa]298 </xsl:otherwise>
299 </xsl:choose>
[f0a31de]300 </xsl:if>
301 <xsl:if test="$testsuite='3' and
302 ../@id='ch-tools-glibc' and
303 @role='installation'">
304 <xsl:copy-of select="//userinput[@remap='locale-test']"/>
305 <xsl:text>&#xA;</xsl:text>
306 </xsl:if>
307 <xsl:if test="../@id='ch-system-glibc' and @role='installation'">
308 <xsl:choose>
309 <xsl:when test="$full-locale='y'">
310 <xsl:copy-of select="//userinput[@remap='locale-full']"/>
311 <xsl:text>&#xA;</xsl:text>
312 </xsl:when>
313 <xsl:otherwise>
314 <xsl:copy-of select="//userinput[@remap='locale-test']"/>
315 <xsl:text>&#xA;</xsl:text>
316 <xsl:if test="not(contains(string(//userinput[@remap='locale-test']),$lang)) and $lang!='C' and $lang!='POSIX'">
317 <xsl:text>if LOCALE=`grep "</xsl:text>
318 <xsl:value-of select="$lang"/>
319 <xsl:text>/" $PKGDIR/localedata/SUPPORTED`; then
[b339c94]320 CHARMAP=`echo $LOCALE | sed 's,[^/]*/\([^ ]*\) [\],\1,'`
321 INPUT=`echo $LOCALE | sed 's,[/.].*,,'`
322 LOCALE=`echo $LOCALE | sed 's,/.*,,'`
323 localedef -i $INPUT -f $CHARMAP $LOCALE
324fi
325</xsl:text>
[f0a31de]326 </xsl:if>
327 </xsl:otherwise>
328 </xsl:choose>
[c4cf6de]329 </xsl:if>
[f0a31de]330 <xsl:apply-templates
331 select=".//screen[
[0ad3a33]332 (not(@role) or
333 @role != 'nodump') and
334 (not(@revision) or
335 @revision=$revision)
[f0a31de]336 ]/userinput[
[f2e80ac]337 not(@remap) or
338 @remap='adjust' or
339 @remap='test' and current()/../@id='ch-tools-dejagnu' or
340 @remap='test' and current()/../@id='ch-system-systemd'
[f0a31de]341 ]"/>
[085435e]342 <xsl:if test="../@id='ch-system-ncurses' and $ncurses5='y'">
343 <xsl:apply-templates select=".//screen[@role='nodump']"/>
344 </xsl:if>
[557fe91]345 </xsl:template>
346
[f0a31de]347 <xsl:template match="sect1" mode="pkgmngt">
[2758d94]348 <xsl:param name="dirname" select="'chapter05'"/>
[7072e1f]349 <!-- The build order -->
[2758d94]350 <xsl:param name="order" select="'062'"/>
[7072e1f]351<!-- The file names -->
352 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
353 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
354 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
355 <!-- Creating dirs and files -->
[8099885]356 <xsl:if test="count(descendant::screen/userinput) &gt; 0 and
357 count(descendant::screen/userinput) &gt;
358 count(descendant::screen[@role='nodump'])">
359 <exsl:document href="{$dirname}/{$order}-{position()}-{$filename}"
360 method="text">
361 <xsl:text>#!/bin/bash
[7072e1f]362set +h
363set -e
364</xsl:text>
[2758d94]365 <xsl:call-template name="start-script">
366 <xsl:with-param name="order" select="concat($order,'-',position())"/>
367 </xsl:call-template>
[8099885]368 <xsl:apply-templates
369 select=".//screen[not(@role) or
370 @role != 'nodump']/userinput[@remap != 'adjust']"
[7072e1f]371 mode="pkgmngt"/>
[8099885]372 <xsl:if test="$dirname = 'chapter06'">
[9bbb9c8]373 <xsl:text>PREV_SEC=${SECONDS}
374packInstall
375SECONDS=${PREV_SEC}
[945ccaa]376rm -rf "$PKG_DEST"
[7072e1f]377</xsl:text>
[8099885]378 </xsl:if>
379 <xsl:apply-templates
380 select=".//screen[not(@role) or
381 @role != 'nodump'
382 ]/userinput[not(@remap) or
383 @remap='adjust'
[7072e1f]384 ]"
385 mode="pkgmngt"/>
[8099885]386 <xsl:text>
[7072e1f]387echo -e "\n\nTotalseconds: $SECONDS\n"
[2758d94]388</xsl:text>
389 <xsl:call-template name="end-script"/>
390 <xsl:text>exit
[7072e1f]391</xsl:text>
[8099885]392 </exsl:document>
393 </xsl:if>
[557fe91]394 </xsl:template>
395
[7072e1f]396 <xsl:template match="userinput" mode="pkgmngt">
397 <xsl:apply-templates/>
398 <xsl:text>&#xA;</xsl:text>
399 </xsl:template>
[2e1c1c3]400
[7072e1f]401 <xsl:template match="userinput">
[3eb60fa]402 <xsl:choose>
[fd691b4]403 <!-- Copying the kernel config file -->
404 <xsl:when test="string() = 'make mrproper'">
405 <xsl:text>make mrproper&#xA;</xsl:text>
[7072e1f]406 <xsl:if test="ancestor::sect1[@id='ch-bootable-kernel']">
[bcfb3bf]407 <xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
408 </xsl:if>
[92568bf]409 </xsl:when>
[7072e1f]410<!-- test instructions -->
[1d5f3e3]411 <xsl:when test="@remap = 'test'">
[5a8939e]412 <xsl:call-template name="comment-test">
413 <xsl:with-param name="instructions" select="string()"/>
414 </xsl:call-template>
[4afcedb]415 </xsl:when>
[7072e1f]416<!-- End of test instructions -->
[dc7fd7b]417<!-- If the instructions contain "strip ", it may mean they contain also .la
418 file removal (and possibly other clean up). We therefore call a template
419 to comment them out appropriately and also to not stop if stripping
420 fails. -->
421 <xsl:when test="contains(string(),'strip ') or
422 contains(string(),'\*.la')">
423 <xsl:call-template name="comment-strip">
424 <xsl:with-param name="instructions" select="string()"/>
425 </xsl:call-template>
[1f025ca]426 </xsl:when>
[7072e1f]427<!-- Package management -->
428<!-- Add $PKG_DEST to installation commands -->
429 <xsl:when test="@remap='install' and
430 not(ancestor::chapter[
431 @id='chapter-temporary-tools'
432 ])">
433 <xsl:choose>
434 <xsl:when test="$pkgmngt='n'">
435 <xsl:choose>
436 <xsl:when test="contains(string(),'firmware,udev')">
437 <xsl:text>if [[ ! -d /lib/udev/devices ]] ; then&#xA;</xsl:text>
438 <xsl:apply-templates/>
439 <xsl:text>&#xA;fi&#xA;</xsl:text>
440 </xsl:when>
441 <xsl:otherwise>
442 <xsl:apply-templates/>
443 <xsl:text>&#xA;</xsl:text>
444 </xsl:otherwise>
445 </xsl:choose>
446 </xsl:when>
[945ccaa]447 <xsl:when test="$wrap-install='y'">
448 <xsl:choose>
449 <xsl:when test="./literal">
450 <xsl:call-template name="output-wrap">
451 <xsl:with-param name="commands" select="text()[1]"/>
452 </xsl:call-template>
453 <xsl:apply-templates select="literal"/>
454 <xsl:call-template name="output-wrap">
455 <xsl:with-param name="commands" select="text()[2]"/>
456 </xsl:call-template>
457 </xsl:when>
458 <xsl:otherwise>
459 <xsl:call-template name="output-wrap">
460 <xsl:with-param name="commands" select="string()"/>
461 </xsl:call-template>
462 </xsl:otherwise>
463 </xsl:choose>
464 <xsl:text>&#xA;</xsl:text>
465 </xsl:when>
466 <xsl:otherwise><!--pkgmngt = 'y' and wrap-install='n'-->
[7072e1f]467 <xsl:choose>
468 <xsl:when test="./literal">
469 <xsl:call-template name="outputpkgdest">
[560bef1]470 <xsl:with-param name="outputstring" select="text()[1]"/>
[7072e1f]471 </xsl:call-template>
472 <xsl:apply-templates select="literal"/>
473 <xsl:call-template name="outputpkgdest">
[560bef1]474 <xsl:with-param name="outputstring" select="text()[2]"/>
[7072e1f]475 </xsl:call-template>
476 </xsl:when>
477 <xsl:otherwise>
478 <xsl:call-template name="outputpkgdest">
479 <xsl:with-param name="outputstring" select="string()"/>
480 </xsl:call-template>
481 </xsl:otherwise>
482 </xsl:choose>
[ad747ed]483 <xsl:text>&#xA;</xsl:text>
[7072e1f]484 </xsl:otherwise>
485 </xsl:choose>
[dc7fd7b]486 </xsl:when> <!-- @remap='install' -->
[57ef0c1]487 <!-- if package management, we should make an independant package for
488 tzdata. -->
489 <xsl:when test="contains(string(),'tzdata') and $pkgmngt='y'">
490 <xsl:text>
[945ccaa]491OLD_PKG_DEST="$PKG_DEST"
[57ef0c1]492OLD_PKGDIR=$PKGDIR
[56d8426]493PKG_DEST=$(dirname $OLD_PKG_DEST)/001-tzdata
[57ef0c1]494PKGDIR=$(dirname $PKGDIR)/tzdata-</xsl:text>
495 <xsl:copy-of select="substring-before(
496 substring-after(string(),'tzdata'),
497 '.tar')"/>
498 <xsl:text>
499</xsl:text>
[945ccaa]500 <xsl:choose>
501 <xsl:when test="$wrap-install='n'">
502 <xsl:copy-of select="substring-before(string(),'ZONEINFO=')"/>
503 <xsl:text>ZONEINFO=$PKG_DEST</xsl:text>
504 <xsl:copy-of select="substring-after(string(),'ZONEINFO=')"/>
505 <xsl:text>
[9bbb9c8]506PREV_SEC=${SECONDS}
[57ef0c1]507packInstall
[9bbb9c8]508SECONDS=${PREV_SEC}
[57ef0c1]509rm -rf $PKG_DEST
[945ccaa]510</xsl:text>
511 </xsl:when>
512 <xsl:otherwise><!-- wrap-install='y' -->
513 <xsl:copy-of select="substring-before(string(),'ZONEINFO=')"/>
514 <xsl:text>
515wrapInstall '
516ZONEINFO=</xsl:text>
517 <xsl:copy-of select="substring-after(string(),'ZONEINFO=')"/>
518 <xsl:text>'
[9bbb9c8]519PREV_SEC=${SECONDS}
[945ccaa]520packInstall
[9bbb9c8]521SECONDS=${PREV_SEC}
[945ccaa]522</xsl:text>
523 </xsl:otherwise>
524 </xsl:choose>
525 <xsl:text>
[57ef0c1]526PKG_DEST=$OLD_PKG_DEST
527unset OLD_PKG_DEST
528PKGDIR=$OLD_PKGDIR
529unset OLD_PKGDIR
530</xsl:text>
531 </xsl:when><!-- addition for tzdata + package management -->
[7072e1f]532 <!-- End addition for package management -->
[fd691b4]533 <!-- The rest of commands -->
[1f025ca]534 <xsl:otherwise>
535 <xsl:apply-templates/>
[fd691b4]536 <xsl:text>&#xA;</xsl:text>
[1f025ca]537 </xsl:otherwise>
538 </xsl:choose>
539 </xsl:template>
[2e1c1c3]540
[557fe91]541 <xsl:template match="replaceable">
[a41ce58]542 <xsl:choose>
[2a54650]543 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
[877cc6a]544 <xsl:value-of select="$timezone"/>
[2a54650]545 </xsl:when>
[a41ce58]546 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
[877cc6a]547 <xsl:value-of select="$page"/>
[a41ce58]548 </xsl:when>
[81a7fb8]549 <xsl:when test="contains(string(.),'&lt;ll&gt;_&lt;CC&gt;')">
550 <xsl:value-of select="$lang"/>
551 </xsl:when>
[945ccaa]552 <xsl:when test="contains(string(.),'Domain')">
553 <xsl:value-of select="$domain"/>
554 </xsl:when>
555 <xsl:when test="contains(string(.),'primary')">
556 <xsl:value-of select="$nameserver1"/>
557 </xsl:when>
558 <xsl:when test="contains(string(.),'secondary')">
559 <xsl:value-of select="$nameserver2"/>
560 </xsl:when>
561 <xsl:when test="contains(string(.),'192.168.1.1')">
562 <xsl:value-of select="$ip"/>
563 </xsl:when>
564 <xsl:when test="contains(string(.),'192.168.0.2')">
565 <xsl:value-of select="$ip"/>
566 </xsl:when>
[f5e658d]567 <xsl:when test="contains(string(.),'eth0')">
568 <xsl:value-of select="$interface"/>
569 </xsl:when>
[945ccaa]570<!-- Only adapted to LFS-20170310 and later -->
571 <xsl:when test="contains(string(.),'HOSTNAME')">
572 <xsl:value-of select="$hostname"/>
573 </xsl:when>
574 <xsl:when test="contains(string(.),'FQDN')">
575 <xsl:value-of select="$hostname"/>
576 <xsl:text>.</xsl:text>
577 <xsl:value-of select="$domain"/>
578 </xsl:when>
579 <xsl:when test="contains(string(.),'alias')"/>
580 <xsl:when test="contains(string(.),'&lt;lfs&gt;')">
581 <xsl:value-of select="$hostname"/>
582 </xsl:when>
[a41ce58]583 <xsl:otherwise>
584 <xsl:text>**EDITME</xsl:text>
585 <xsl:apply-templates/>
586 <xsl:text>EDITME**</xsl:text>
587 </xsl:otherwise>
588 </xsl:choose>
[557fe91]589 </xsl:template>
[2e1c1c3]590
[945ccaa]591 <xsl:template match="literal">
592 <xsl:choose>
593 <xsl:when test="contains(string(),'ONBOOT')">
594 <xsl:call-template name="outputnet">
595 <xsl:with-param name="netstring" select="string()"/>
596 </xsl:call-template>
597 </xsl:when>
598 <xsl:when test="contains(string(),'[Match]')">
599 <xsl:call-template name="outputsysdnet">
600 <xsl:with-param name="netstring" select="string()"/>
601 </xsl:call-template>
602 </xsl:when>
[3b43e17b]603 <xsl:when test="contains(string(),'0.0 0 0.0')">
604 <xsl:copy-of select="substring-before(string(),'LOCAL')"/>
605 <xsl:if test="$local='y'"><xsl:text>LOCAL</xsl:text></xsl:if>
606 <xsl:if test="$local='n'"><xsl:text>UTC</xsl:text></xsl:if>
607 </xsl:when>
608 <xsl:when test="contains(string(),'UTC=1')">
609 <xsl:copy-of select="substring-before(string(),'1')"/>
610 <xsl:if test="$local='y'"><xsl:text>0</xsl:text></xsl:if>
611 <xsl:if test="$local='n'"><xsl:text>1</xsl:text></xsl:if>
612 <xsl:copy-of select="substring-after(string(),'1')"/>
613 </xsl:when>
614 <xsl:when test="contains(string(),'bg_bds-')">
615 <xsl:call-template name="outputsysvconsole">
616 <xsl:with-param name="consolestring" select="string()"/>
617 </xsl:call-template>
618 </xsl:when>
619 <xsl:when test="contains(string(),'de-latin1')">
620 <xsl:call-template name="outputsysdconsole">
621 <xsl:with-param name="consolestring" select="string()"/>
622 </xsl:call-template>
623 </xsl:when>
[945ccaa]624 <xsl:otherwise>
625 <xsl:apply-templates/>
626 </xsl:otherwise>
627 </xsl:choose>
628 </xsl:template>
629
630 <xsl:template name="outputnet">
631 <xsl:param name="netstring" select="''"/>
632 <!-- We suppose that book example has the following values:
633 - interface: eth0
634 - ip: 192.168.1.2
635 - gateway: 192.168.1.1
636 - prefix: 24
637 - broadcast: 192.168.1.255
638 Change below if book changes -->
639 <xsl:choose>
640 <xsl:when test="contains($netstring,'eth0')">
641 <xsl:call-template name="outputnet">
642 <xsl:with-param name="netstring"
643 select="substring-before($netstring,'eth0')"/>
644 </xsl:call-template>
645 <xsl:value-of select="$interface"/>
646 <xsl:call-template name="outputnet">
647 <xsl:with-param name="netstring"
648 select="substring-after($netstring,'eth0')"/>
649 </xsl:call-template>
650 </xsl:when>
651 <xsl:when test="contains($netstring,'192.168.1.1')">
652 <xsl:call-template name="outputnet">
653 <xsl:with-param name="netstring"
654 select="substring-before($netstring,'192.168.1.1')"/>
655 </xsl:call-template>
656 <xsl:value-of select="$gateway"/>
657 <xsl:call-template name="outputnet">
658 <xsl:with-param name="netstring"
659 select="substring-after($netstring,'192.168.1.1')"/>
660 </xsl:call-template>
661 </xsl:when>
662 <!-- must test this before the following, because 192.168.1.255 contains
663 192.168.1.2! -->
664 <xsl:when test="contains($netstring,'192.168.1.255')">
665 <xsl:call-template name="outputnet">
666 <xsl:with-param name="netstring"
667 select="substring-before($netstring,'192.168.1.255')"/>
668 </xsl:call-template>
669 <xsl:value-of select="$broadcast"/>
670 <xsl:call-template name="outputnet">
671 <xsl:with-param name="netstring"
672 select="substring-after($netstring,'192.168.1.255')"/>
673 </xsl:call-template>
674 </xsl:when>
675 <xsl:when test="contains($netstring,'192.168.1.2')">
676 <xsl:call-template name="outputnet">
677 <xsl:with-param name="netstring"
678 select="substring-before($netstring,'192.168.1.2')"/>
679 </xsl:call-template>
680 <xsl:value-of select="$ip"/>
681 <xsl:call-template name="outputnet">
682 <xsl:with-param name="netstring"
683 select="substring-after($netstring,'192.168.1.2')"/>
684 </xsl:call-template>
685 </xsl:when>
686 <xsl:when test="contains($netstring,'24')">
687 <xsl:call-template name="outputnet">
688 <xsl:with-param name="netstring"
689 select="substring-before($netstring,'24')"/>
690 </xsl:call-template>
691 <xsl:value-of select="$prefix"/>
692 <xsl:call-template name="outputnet">
693 <xsl:with-param name="netstring"
694 select="substring-after($netstring,'24')"/>
695 </xsl:call-template>
696 </xsl:when>
697 <xsl:otherwise>
698 <xsl:value-of select="$netstring"/>
699 </xsl:otherwise>
700 </xsl:choose>
701 </xsl:template>
702
703 <xsl:template name="outputsysdnet">
704 <xsl:param name="netstring" select="''"/>
705 <!-- We suppose that book example has the following values:
[5af9ab4]706 - interface: <network-device-name>
[945ccaa]707 - ip: 192.168.0.2
708 - gateway: 192.168.0.1
709 - prefix: 24
710 - DNS: 192.168.0.1
711 - Domain: <Your Domain Name>
712 and gateway comes before DNS. Change below if book changes -->
713 <xsl:choose>
[5af9ab4]714 <xsl:when test="contains($netstring,'&lt;network-device-name&gt;')">
[945ccaa]715 <xsl:call-template name="outputsysdnet">
716 <xsl:with-param name="netstring"
[5af9ab4]717 select="substring-before($netstring,'&lt;network-device-name&gt;')"/>
[945ccaa]718 </xsl:call-template>
719 <xsl:value-of select="$interface"/>
720 <xsl:call-template name="outputsysdnet">
721 <xsl:with-param name="netstring"
[5af9ab4]722 select="substring-after($netstring,'&lt;network-device-name&gt;')"/>
[945ccaa]723 </xsl:call-template>
724 </xsl:when>
725 <xsl:when test="contains($netstring,'192.168.0.1') and
726 contains($netstring,'Gateway')">
727 <xsl:call-template name="outputsysdnet">
728 <xsl:with-param name="netstring"
729 select="substring-before($netstring,'192.168.0.1')"/>
730 </xsl:call-template>
731 <xsl:value-of select="$gateway"/>
732 <xsl:call-template name="outputsysdnet">
733 <xsl:with-param name="netstring"
734 select="substring-after($netstring,'192.168.0.1')"/>
735 </xsl:call-template>
736 </xsl:when>
737 <xsl:when test="contains($netstring,'192.168.0.1') and
738 not(contains($netstring,'Gateway'))">
739 <xsl:call-template name="outputsysdnet">
740 <xsl:with-param name="netstring"
741 select="substring-before($netstring,'192.168.0.1')"/>
742 </xsl:call-template>
743 <xsl:value-of select="$nameserver1"/>
744 <xsl:text>
745DNS=</xsl:text>
746 <xsl:value-of select="$nameserver2"/>
747 <xsl:call-template name="outputsysdnet">
748 <xsl:with-param name="netstring"
749 select="substring-after($netstring,'192.168.0.1')"/>
750 </xsl:call-template>
751 </xsl:when>
752 <xsl:when test="contains($netstring,'192.168.0.2')">
753 <xsl:call-template name="outputsysdnet">
754 <xsl:with-param name="netstring"
755 select="substring-before($netstring,'192.168.0.2')"/>
756 </xsl:call-template>
757 <xsl:value-of select="$ip"/>
758 <xsl:call-template name="outputsysdnet">
759 <xsl:with-param name="netstring"
760 select="substring-after($netstring,'192.168.0.2')"/>
761 </xsl:call-template>
762 </xsl:when>
763 <xsl:when test="contains($netstring,'24')">
764 <xsl:call-template name="outputsysdnet">
765 <xsl:with-param name="netstring"
766 select="substring-before($netstring,'24')"/>
767 </xsl:call-template>
768 <xsl:value-of select="$prefix"/>
769 <xsl:call-template name="outputsysdnet">
770 <xsl:with-param name="netstring"
771 select="substring-after($netstring,'24')"/>
772 </xsl:call-template>
773 </xsl:when>
774 <xsl:when test="contains($netstring,'&lt;Your Domain Name&gt;')">
775 <xsl:call-template name="outputsysdnet">
776 <xsl:with-param name="netstring"
777 select="substring-before($netstring,'&lt;Your Domain Name&gt;')"/>
778 </xsl:call-template>
779 <xsl:value-of select="$domain"/>
780 <xsl:call-template name="outputsysdnet">
781 <xsl:with-param name="netstring"
782 select="substring-after($netstring,'&lt;Your Domain Name&gt;')"/>
783 </xsl:call-template>
784 </xsl:when>
785 <xsl:otherwise>
786 <xsl:value-of select="$netstring"/>
[3b43e17b]787 </xsl:otherwise>
788 </xsl:choose>
789 </xsl:template>
790
791 <xsl:template name="outputsysvconsole">
792 <!-- We suppose that book example has the following values:
793 - KEYMAP: bg_bds-utf8
794 - FONT: LatArCyrHeb-16
795 Change below if book changes -->
796 <xsl:param name="consolestring" select="''"/>
797 <xsl:choose>
798 <xsl:when test="contains($consolestring,'bg_bds-utf8')">
799 <xsl:call-template name="outputsysvconsole">
800 <xsl:with-param
801 name="consolestring"
802 select="substring-before($consolestring,'bg_bds-utf8')"/>
803 </xsl:call-template>
804 <xsl:value-of select="$keymap"/>
805 <xsl:call-template name="outputsysvconsole">
806 <xsl:with-param
807 name="consolestring"
808 select="substring-after($consolestring,'bg_bds-utf8')"/>
809 </xsl:call-template>
810 </xsl:when>
811 <xsl:when test="contains($consolestring,'LatArCyrHeb-16')">
812 <xsl:call-template name="outputsysvconsole">
813 <xsl:with-param
814 name="consolestring"
815 select="substring-before($consolestring,'LatArCyrHeb-16')"/>
816 </xsl:call-template>
817 <xsl:value-of select="$font"/>
818 <xsl:text>"
[3142368]819LOGLEVEL="</xsl:text>
[3b43e17b]820 <xsl:copy-of select="$log-level"/>
821 <xsl:call-template name="outputsysvconsole">
822 <xsl:with-param
823 name="consolestring"
824 select="substring-after($consolestring,'LatArCyrHeb-16')"/>
825 </xsl:call-template>
826 </xsl:when>
827 <xsl:otherwise>
828 <xsl:copy-of select="$consolestring"/>
829 </xsl:otherwise>
830 </xsl:choose>
831 </xsl:template>
832
833 <xsl:template name="outputsysdconsole">
834 <!-- We suppose that book example has the following values:
835 - KEYMAP: de-latin1
836 - FONT: Lat2-Terminus16
837 Change below if book changes -->
838 <xsl:param name="consolestring" select="''"/>
839 <xsl:choose>
840 <xsl:when test="contains($consolestring,'de-latin1')">
841 <xsl:call-template name="outputsysdconsole">
842 <xsl:with-param
843 name="consolestring"
844 select="substring-before($consolestring,'de-latin1')"/>
845 </xsl:call-template>
846 <xsl:value-of select="$keymap"/>
847 <xsl:call-template name="outputsysdconsole">
848 <xsl:with-param
849 name="consolestring"
850 select="substring-after($consolestring,'de-latin1')"/>
851 </xsl:call-template>
852 </xsl:when>
853 <xsl:when test="contains($consolestring,'Lat2-Terminus16')">
854 <xsl:call-template name="outputsysdconsole">
855 <xsl:with-param
856 name="consolestring"
857 select="substring-before($consolestring,'Lat2-Terminus16')"/>
858 </xsl:call-template>
859 <xsl:value-of select="$font"/>
860 <xsl:call-template name="outputsysdconsole">
861 <xsl:with-param
862 name="consolestring"
863 select="substring-after($consolestring,'Lat2-Terminus16')"/>
864 </xsl:call-template>
865 </xsl:when>
866 <xsl:otherwise>
867 <xsl:copy-of select="$consolestring"/>
[945ccaa]868 </xsl:otherwise>
869 </xsl:choose>
870 </xsl:template>
871
[7072e1f]872 <xsl:template name="outputpkgdest">
873 <xsl:param name="outputstring" select="foo"/>
874 <xsl:choose>
875 <xsl:when test="contains($outputstring,'make ')">
876 <xsl:choose>
877 <xsl:when test="not(starts-with($outputstring,'make'))">
878 <xsl:call-template name="outputpkgdest">
879 <xsl:with-param name="outputstring"
880 select="substring-before($outputstring,'make')"/>
881 </xsl:call-template>
882 <xsl:call-template name="outputpkgdest">
883 <xsl:with-param
884 name="outputstring"
885 select="substring-after($outputstring,
886 substring-before($outputstring,'make'))"/>
887 </xsl:call-template>
888 </xsl:when>
889 <xsl:otherwise>
890 <xsl:choose>
891<!-- special cases (no DESTDIR) here -->
892 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
893 <xsl:text>make install_root=$PKG_DEST -j1</xsl:text>
894 <xsl:value-of
895 select="substring-before(substring-after(string(),'make'),
896 'install')"/>
897 <xsl:text>install&#xA;</xsl:text>
898 </xsl:when>
899 <xsl:when test="ancestor::sect1[@id='ch-system-bzip2']">
900 <xsl:text>make PREFIX=$PKG_DEST/usr install&#xA;</xsl:text>
901 </xsl:when>
902 <xsl:when test="ancestor::sect1[@id='ch-system-sysklogd']">
903 <xsl:text>make BINDIR=$PKG_DEST/sbin prefix=$PKG_DEST install&#xA;</xsl:text>
904 </xsl:when>
905 <xsl:when test="ancestor::sect1[@id='ch-system-iproute2']">
[b1f4a8d]906 <xsl:text>make DESTDIR=$PKG_DEST DOCDIR=</xsl:text>
[7072e1f]907 <xsl:value-of
[b1f4a8d]908 select="substring-before(substring-after(string(),'DOCDIR='),
[7072e1f]909 'install')"/>
910 <xsl:text>install&#xA;</xsl:text>
911 </xsl:when>
912 <xsl:when test="ancestor::sect1[@id='ch-system-sysvinit']">
913 <xsl:text>make ROOT=$PKG_DEST</xsl:text>
914 <xsl:value-of
915 select="substring-before(substring-after(string(),'make'),
916 'install')"/>
917 <xsl:text>install&#xA;</xsl:text>
918 </xsl:when>
919 <xsl:when test="ancestor::sect1[@id='ch-bootable-kernel']">
920 <xsl:text>make INSTALL_MOD_PATH=$PKG_DEST</xsl:text>
921 <xsl:value-of
922 select="substring-before(substring-after(string(),'make'),
923 'install')"/>
924 <xsl:text>install&#xA;</xsl:text>
925 </xsl:when>
926 <xsl:otherwise>
[560bef1]927 <xsl:text>make DESTDIR=$PKG_DEST</xsl:text>
[e6e0c85]928 <xsl:call-template name="outputpkgdest">
[560bef1]929 <xsl:with-param
[7072e1f]930 name="outputstring"
931 select="substring-after($outputstring,'make')"/>
[560bef1]932 </xsl:call-template>
[7072e1f]933 </xsl:otherwise>
934 </xsl:choose>
935 </xsl:otherwise>
936 </xsl:choose>
937 </xsl:when>
[1cb4c76]938 <xsl:when test="contains($outputstring,'ninja install')">
[4696ddd]939 <xsl:choose>
[1cb4c76]940 <xsl:when test="not(starts-with($outputstring,'ninja install'))">
[4696ddd]941 <xsl:call-template name="outputpkgdest">
942 <xsl:with-param name="outputstring"
[1cb4c76]943 select="substring-before($outputstring,'ninja install')"/>
[4696ddd]944 </xsl:call-template>
945 <xsl:call-template name="outputpkgdest">
946 <xsl:with-param
947 name="outputstring"
948 select="substring-after($outputstring,
[1cb4c76]949 substring-before($outputstring,'ninja install'))"/>
[4696ddd]950 </xsl:call-template>
951 </xsl:when>
[1cb4c76]952 <xsl:otherwise> <!-- "ninja" is the first word and is followed by
953 "install"-->
[4696ddd]954 <xsl:text>DESTDIR=$PKG_DEST ninja</xsl:text>
955 <xsl:call-template name="outputpkgdest">
956 <xsl:with-param
957 name="outputstring"
958 select="substring-after($outputstring,'ninja')"/>
959 </xsl:call-template>
960 </xsl:otherwise>
961 </xsl:choose>
962 </xsl:when>
963 <xsl:otherwise> <!-- no make nor ninja in this string -->
[7072e1f]964 <xsl:choose>
965 <xsl:when test="contains($outputstring,'&gt;/') and
966 not(contains(substring-before($outputstring,'&gt;/'),' /'))">
967 <xsl:value-of select="substring-before($outputstring,'&gt;/')"/>
968 <xsl:text>&gt;$PKG_DEST/</xsl:text>
969 <xsl:call-template name="outputpkgdest">
970 <xsl:with-param name="outputstring" select="substring-after($outputstring,'&gt;/')"/>
971 </xsl:call-template>
972 </xsl:when>
973 <xsl:when test="contains($outputstring,' /')">
974 <xsl:value-of select="substring-before($outputstring,' /')"/>
975 <xsl:text> $PKG_DEST/</xsl:text>
976 <xsl:call-template name="outputpkgdest">
977 <xsl:with-param name="outputstring" select="substring-after($outputstring,' /')"/>
978 </xsl:call-template>
979 </xsl:when>
980 <xsl:otherwise>
981 <xsl:value-of select="$outputstring"/>
982 </xsl:otherwise>
983 </xsl:choose>
984 </xsl:otherwise>
985 </xsl:choose>
986 </xsl:template>
[945ccaa]987
988 <xsl:variable name="APOS">'</xsl:variable>
989 <xsl:template name="output-wrap">
990 <xsl:param name="commands" select="''"/>
991 <xsl:choose>
992 <xsl:when test="contains($commands,string($APOS))">
993 <xsl:call-template name="output-wrap">
994 <xsl:with-param name="commands"
995 select="substring-before($commands,string($APOS))"/>
996 </xsl:call-template>
997 <xsl:text>'\''</xsl:text>
998 <xsl:call-template name="output-wrap">
999 <xsl:with-param name="commands"
1000 select="substring-after($commands,string($APOS))"/>
1001 </xsl:call-template>
1002 </xsl:when>
1003 <xsl:otherwise>
1004 <xsl:value-of select="$commands"/>
1005 </xsl:otherwise>
1006 </xsl:choose>
1007 </xsl:template>
1008
[dc7fd7b]1009 <xsl:template name="comment-strip">
1010 <xsl:param name="instructions" select="''"/>
1011 <xsl:choose>
1012 <xsl:when test="contains($instructions,'&#xA;')">
1013 <xsl:call-template name="comment-strip">
1014 <xsl:with-param name="instructions"
1015 select="substring-before($instructions,'&#xA;')"/>
1016 </xsl:call-template>
1017 <xsl:call-template name="comment-strip">
1018 <xsl:with-param name="instructions"
1019 select="substring-after($instructions,'&#xA;')"/>
1020 </xsl:call-template>
1021 </xsl:when>
1022 <xsl:when test="contains($instructions,'\*.la')">
1023 <xsl:if test="$del-la-files='n'">
1024 <xsl:text># </xsl:text>
1025 </xsl:if>
1026 <xsl:value-of select="$instructions"/>
1027 <xsl:text>&#xA;</xsl:text>
1028 </xsl:when>
1029 <xsl:when test="contains($instructions,'strip ')">
1030 <xsl:if test="$strip='n'">
1031 <xsl:text># </xsl:text>
1032 </xsl:if>
1033 <xsl:value-of select="$instructions"/>
1034 <xsl:text> || true&#xA;</xsl:text>
1035 </xsl:when>
1036 <xsl:otherwise>
1037 <xsl:value-of select="$instructions"/>
1038 <xsl:text>&#xA;</xsl:text>
1039 </xsl:otherwise>
1040 </xsl:choose>
1041 </xsl:template>
1042
[5a8939e]1043 <xsl:template name="comment-test">
1044 <xsl:param name="instructions" select="''"/>
1045 <xsl:choose>
1046 <xsl:when test="contains($instructions,'&#xA;')">
1047 <xsl:call-template name="comment-test">
1048 <xsl:with-param name="instructions"
1049 select="substring-before($instructions,'&#xA;')"/>
1050 </xsl:call-template>
1051 <xsl:call-template name="comment-test">
1052 <xsl:with-param name="instructions"
1053 select="substring-after($instructions,'&#xA;')"/>
1054 </xsl:call-template>
1055 </xsl:when>
1056 <xsl:otherwise>
1057 <xsl:if test="$testsuite = '0' or
1058 $testsuite = '1' and
1059 not(ancestor::sect1[@id='ch-system-gcc']) and
1060 not(ancestor::sect1[@id='ch-system-glibc']) and
1061 not(ancestor::sect1[@id='ch-system-gmp']) and
1062 not(ancestor::sect1[@id='ch-system-mpfr']) and
1063 not(ancestor::sect1[@id='ch-system-binutils']) or
1064 $testsuite = '2' and
1065 ancestor::chapter[@id='chapter-temporary-tools']">
1066 <xsl:text># </xsl:text>
1067 </xsl:if>
1068 <xsl:choose>
1069 <xsl:when test="$bomb-testsuite = 'n'">
1070 <xsl:choose>
1071 <xsl:when test="contains(string(), 'make -k')">
1072 <xsl:value-of select="$instructions"/>
1073 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
1074 </xsl:when>
1075 <xsl:when test="contains($instructions, 'make')">
1076 <xsl:value-of select="substring-before($instructions, 'make')"/>
1077 <xsl:text>make -k</xsl:text>
1078 <xsl:value-of select="substring-after($instructions, 'make')"/>
1079 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
1080 </xsl:when>
1081 <xsl:otherwise>
1082 <xsl:value-of select="$instructions"/>
[764a5d7]1083 <xsl:if
1084 test="not(contains($instructions, '&gt;&gt;')) and
1085 substring($instructions,
1086 string-length($instructions)) != '\'">
[5a8939e]1087 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
1088 </xsl:if>
1089 <xsl:text>&#xA;</xsl:text>
1090 </xsl:otherwise>
1091 </xsl:choose>
1092 </xsl:when>
1093 <xsl:otherwise>
1094 <!-- bomb-testsuite != 'n'-->
1095 <xsl:choose>
1096 <xsl:when test="contains($instructions, 'make -k')">
1097 <xsl:value-of select="$instructions"/>
1098 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
1099 </xsl:when>
1100 <xsl:otherwise>
1101 <xsl:value-of select="$instructions"/>
[764a5d7]1102 <xsl:if test="not(contains($instructions, '&gt;&gt;')) and
1103 substring($instructions,
1104 string-length($instructions)) != '\'">
[5a8939e]1105 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
1106 </xsl:if>
1107 <xsl:text>&#xA;</xsl:text>
1108 </xsl:otherwise>
1109 </xsl:choose>
1110 </xsl:otherwise> <!-- end not bomb-test=n -->
1111 </xsl:choose>
1112 </xsl:otherwise>
1113 </xsl:choose>
1114 </xsl:template>
1115
[2758d94]1116 <xsl:template name="basename">
1117 <xsl:param name="path" select="''"/>
1118 <xsl:choose>
1119 <xsl:when test="contains($path,'/') and substring-after($path,'/')!=''">
1120 <xsl:call-template name="basename">
1121 <xsl:with-param name="path" select="substring-after($path,'/')"/>
1122 </xsl:call-template>
1123 </xsl:when>
1124 <xsl:when test="contains($path,'/') and substring-after($path,'/')=''">
1125 <xsl:value-of select="substring-before($path,'/')"/>
1126 </xsl:when>
1127 <xsl:otherwise>
1128 <xsl:value-of select="$path"/>
1129 </xsl:otherwise>
1130 </xsl:choose>
1131 </xsl:template>
1132
1133 <xsl:template name="start-script">
1134 <xsl:param name="order" select="'073'"/>
1135 <xsl:text>
[5451eae]1136<!-- save the timer, so that unpacking, and du is not counted -->
1137PREV_SEC=${SECONDS}
1138 <!-- get the location of the system root -->
[2758d94]1139if [ -h /tools ]; then
1140 ROOT=$(dirname $(readlink /tools))/
1141else
1142 ROOT=/
1143fi
[5451eae]1144SCRIPT_ROOT=</xsl:text>
1145 <xsl:copy-of select="$script-root"/>
1146 <xsl:text>
1147</xsl:text>
1148 <xsl:if test="sect2[@role='installation']">
1149 <xsl:text>
[2758d94]1150SRC_DIR=${ROOT}sources
1151<!-- Set variables, for use by the Makefile and package manager -->
1152VERSION=</xsl:text><!-- needed for Makefile, and may be used in PackInstall-->
[5451eae]1153 <xsl:copy-of select=".//sect1info/productnumber/text()"/>
1154 <xsl:text>
[2758d94]1155PKG_DEST=${SRC_DIR}/</xsl:text>
[5451eae]1156 <xsl:copy-of select="$order"/>
1157 <xsl:text>-</xsl:text>
1158 <xsl:copy-of select=".//sect1info/productname/text()"/>
1159 <xsl:text>
1160<!-- Get the tarball name from sect1info -->
[2758d94]1161PACKAGE=</xsl:text>
[5451eae]1162 <xsl:call-template name="basename">
1163 <xsl:with-param name="path" select=".//sect1info/address/text()"/>
1164 </xsl:call-template>
1165 <xsl:if test = "( ../@id != 'chapter-temporary-tools' or
[2758d94]1166 starts-with(@id,'ch-system') ) and $pkgmngt = 'y'">
[5451eae]1167 <xsl:text>
[2758d94]1168source ${ROOT}${SCRIPT_ROOT}/packInstall.sh
1169export -f packInstall</xsl:text>
[5451eae]1170 <xsl:if test="$wrap-install='y'">
1171 <xsl:text>
[2758d94]1172export -f wrapInstall
1173</xsl:text>
[5451eae]1174 </xsl:if>
[2758d94]1175 </xsl:if>
1176<!-- Get the build directory name and clean remnants of previous attempts -->
[5451eae]1177 <xsl:text>
[2758d94]1178cd $SRC_DIR
1179PKGDIR=$(tar -tf $PACKAGE | head -n1 | sed 's@^./@@;s@/.*@@')
1180export PKGDIR VERSION PKG_DEST
1181
1182if [ -d "$PKGDIR" ]; then rm -rf $PKGDIR; fi
1183if [ -d "${PKGDIR%-*}-build" ]; then rm -rf ${PKGDIR%-*}-build; fi
[5451eae]1184</xsl:text>
1185 </xsl:if>
1186 <xsl:text>
1187echo "KB: $(du -skx --exclude=lost+found --exclude=var/lib --exclude=$SCRIPT_ROOT $ROOT)"
1188</xsl:text>
1189 <xsl:if test="sect2[@role='installation']">
1190 <xsl:text>
[2758d94]1191<!-- At last unpack and change directory -->
1192tar -xf $PACKAGE
1193cd $PKGDIR
[5451eae]1194</xsl:text>
1195 </xsl:if>
1196 <xsl:text>SECONDS=${PREV_SEC}
[2758d94]1197
1198# Start of LFS book script
1199</xsl:text>
1200 </xsl:template>
1201
1202 <xsl:template name="end-script">
1203 <xsl:text>
1204# End of LFS book script
1205
[5451eae]1206echo "KB: $(du -skx --exclude=lost+found --exclude=var/lib --exclude=$SCRIPT_ROOT $ROOT)"
1207</xsl:text>
1208 <xsl:if test="sect2[@role='installation']">
1209 <xsl:text>cd $SRC_DIR
[2758d94]1210rm -rf $PKGDIR
1211if [ -d "${PKGDIR%-*}-build" ]; then rm -rf ${PKGDIR%-*}-build; fi
1212</xsl:text>
[5451eae]1213 </xsl:if>
[2758d94]1214 </xsl:template>
1215
[557fe91]1216</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.