source: LFS/lfs.xsl@ a690d42

ablfs-more legacy trunk
Last change on this file since a690d42 was fd4a798, checked in by Pierre Labastie <pierre.labastie@…>, 3 years ago

Remove $Id$ comments, they are useless with git

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