source: LFS/lfs.xsl@ a26389a

ablfs-more legacy trunk
Last change on this file since a26389a was 323ae3e, checked in by Pierre Labastie <pierre@…>, 4 years ago

Add -j1 to "make install" in the
lfs book (done long ago in blfs)

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