source: LFS/lfs.xsl@ 28ef51b

ablfs-more trunk
Last change on this file since 28ef51b was 4c36783, checked in by Pierre Labastie <pierre.labastie@…>, 3 years ago

oRemove legacy: do not run tests in temporary tools (2)

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