source: LFS/lfs.xsl@ bcae37d

ablfs-more legacy trunk
Last change on this file since bcae37d was bcae37d, checked in by Thomas Trepl (Moody) <thomas@…>, 3 years ago

Rename ch-system-strippingagain to ch-system-stripping

  • Property mode set to 100644
File size: 52.3 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2
3<!-- $Id$ -->
4
5<xsl:stylesheet
6 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
7 xmlns:exsl="http://exslt.org/common"
8 extension-element-prefixes="exsl"
9 version="1.0">
10
11<!-- Parameters -->
12
13 <!-- use package management ?
14 n = no, original behavior
15 y = yes, add PKG_DEST to scripts in install commands of chapter06-08
16 -->
17 <xsl:param name="pkgmngt" select="'n'"/>
18
19 <!-- Package management with "porg style" ?
20 n = no, same as pkgmngt description above
21 y = yes, wrap install commands of chapter06-08 into a bash function.
22 note that pkgmngt must be 'y' in this case
23 -->
24 <xsl:param name="wrap-install" select='"n"'/>
25
26 <!-- Run test suites?
27 0 = none
28 1 = only chapter06 critical testsuites
29 2 = all chapter06 testsuites
30 3 = all chapter05 and chapter06 testsuites
31 -->
32 <xsl:param name="testsuite" select="1"/>
33
34 <!-- Bomb on test suites failures?
35 n = no, I want to build the full system and review the logs
36 y = yes, bomb at the first test suite failure to can review the build dir
37 -->
38 <xsl:param name="bomb-testsuite" select="'n'"/>
39
40 <!-- Install non wide character ncurses 5? -->
41 <xsl:param name="ncurses5" select="'n'"/>
42
43 <!-- Should we strip excutables and libraries? -->
44 <xsl:param name='strip' select="'n'"/>
45
46 <!-- Should we remove .la files after chapter 5 and chapter 6? -->
47 <xsl:param name='del-la-files' select="'y'"/>
48
49 <!-- Time zone -->
50 <xsl:param name="timezone" select="'GMT'"/>
51
52 <!-- Page size -->
53 <xsl:param name="page" select="'letter'"/>
54
55 <!-- Locale settings -->
56 <xsl:param name="lang" select="'C'"/>
57
58 <!-- Install the whole set of locales -->
59 <xsl:param name='full-locale' select='"n"'/>
60
61 <!-- Hostname -->
62 <xsl:param name='hostname' select='"HOSTNAME"'/>
63
64 <!-- Network parameters: interface, ip, gateway, prefix, broadcast, domain
65 and nameservers -->
66 <xsl:param name='interface' select="'eth0'"/>
67 <xsl:param name='ip' select='"10.0.2.9"'/>
68 <xsl:param name='gateway' select='"10.0.2.2"'/>
69 <xsl:param name='prefix' select='24'/>
70 <xsl:param name='broadcast' select='"10.0.2.255"'/>
71 <xsl:param name='domain' select='"lfs.org"'/>
72 <xsl:param name='nameserver1' select='"10.0.2.3"'/>
73 <xsl:param name='nameserver2' select='"8.8.8.8"'/>
74
75 <!-- Console parameters: font, fontmap, unicode (y/n), keymap, local (y:
76 hardware clock set to local time/n:hardware clock set to UTC)
77 and log-level -->
78 <xsl:param name='font' select="'lat0-16'"/>
79 <xsl:param name='keymap' select="'us'"/>
80 <xsl:param name='local' select="'n'"/>
81 <xsl:param name='log-level' select="'4'"/>
82
83 <!-- The scripts root is needed for printing disk usage -->
84 <xsl:param name='script-root' select="'jhalfs'"/>
85
86<!-- End parameters -->
87
88<!-- bashdir is used at the beginning of chapter 6, for the #! line.
89 If we created a /tools directory in chapter 4, bash is in /tools/bin,
90otherwise it is in /bin.-->
91 <xsl:variable name="bashdir">
92 <xsl:choose>
93 <xsl:when test="//sect1[@id='ch-preps-creatingtoolsdir']">
94 <xsl:text>/tools</xsl:text>
95 </xsl:when>
96 <xsl:otherwise>
97 <xsl:text></xsl:text>
98 </xsl:otherwise>
99 </xsl:choose>
100 </xsl:variable>
101
102<!-- Start of templates -->
103 <xsl:template match="/">
104 <xsl:apply-templates select="//chapter[
105 @id='chapter-final-preps' or
106 @id='chapter-cross-tools' or
107 @id='chapter-temporary-tools' or
108 @id='chapter-chroot-temporary-tools' or
109 @id='chapter-building-system' or
110 @id='chapter-config' or
111 @id='chapter-bootscripts' or
112 @id='chapter-bootable']"/>
113 </xsl:template>
114
115 <xsl:template match="chapter">
116 <xsl:apply-templates select="./sect1[
117 .//screen[not(@role) or @role != 'nodump']/
118 userinput[not(starts-with(string(),'chroot'))]]">
119 <xsl:with-param name="chap-num" select="position()+3"/>
120 </xsl:apply-templates>
121<!-- The last condition is a hack to allow old versions of the
122 book where the chroot commands did not have role="nodump".
123 It only works if the chroot command is the only one on the page -->
124 </xsl:template>
125
126 <xsl:template match="sect1">
127 <xsl:param name="chap-num" select="'1'"/>
128 <!-- The dirs names -->
129 <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
130 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
131 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
132 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
133 <!-- The file names -->
134 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
135 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
136 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
137 <!-- The build order -->
138 <xsl:variable name="position" select="position()"/>
139 <xsl:variable name="order">
140 <xsl:value-of select="$chap-num"/>
141 <xsl:if test="string-length($position) = 1">
142 <xsl:text>0</xsl:text>
143 </xsl:if>
144 <xsl:value-of select="$position"/>
145 </xsl:variable>
146 <!-- Creating dirs and files -->
147 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
148 <xsl:text>#!</xsl:text>
149 <xsl:if test="@id='ch-system-creatingdirs' or
150 @id='ch-system-createfiles' or
151 @id='ch-system-stripping'">
152 <xsl:copy-of select="$bashdir"/>
153 </xsl:if>
154 <xsl:text>/bin/bash&#xA;set +h&#xA;</xsl:text>
155 <xsl:if test="not(@id='ch-tools-stripping') 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']">
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-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']">
961 <xsl:text>make -j1 DESTDIR=$PKG_DEST DOCDIR=</xsl:text>
962 <xsl:value-of
963 select="substring-before(substring-after(string(),'DOCDIR='),
964 'install')"/>
965 <xsl:text>install&#xA;</xsl:text>
966 </xsl:when>
967 <xsl:when test="ancestor::sect1[@id='ch-system-sysvinit']">
968 <xsl:text>make -j1 ROOT=$PKG_DEST</xsl:text>
969 <xsl:value-of
970 select="substring-before(substring-after(string(),'make'),
971 'install')"/>
972 <xsl:text>install&#xA;</xsl:text>
973 </xsl:when>
974 <xsl:when test="ancestor::sect1[@id='ch-bootable-kernel']">
975 <xsl:text>make -j1 INSTALL_MOD_PATH=$PKG_DEST</xsl:text>
976 <xsl:value-of
977 select="substring-before(substring-after(string(),'make'),
978 'install')"/>
979 <xsl:text>install&#xA;</xsl:text>
980 </xsl:when>
981 <xsl:otherwise>
982 <xsl:text>make -j1 DESTDIR=$PKG_DEST</xsl:text>
983 <xsl:call-template name="outputpkgdest">
984 <xsl:with-param
985 name="outputstring"
986 select="substring-after($outputstring,'make')"/>
987 </xsl:call-template>
988 </xsl:otherwise>
989 </xsl:choose>
990 </xsl:otherwise>
991 </xsl:choose>
992 </xsl:when>
993 <xsl:when test="contains($outputstring,'ninja install')">
994 <xsl:choose>
995 <xsl:when test="not(starts-with($outputstring,'ninja install'))">
996 <xsl:call-template name="outputpkgdest">
997 <xsl:with-param name="outputstring"
998 select="substring-before($outputstring,'ninja install')"/>
999 </xsl:call-template>
1000 <xsl:call-template name="outputpkgdest">
1001 <xsl:with-param
1002 name="outputstring"
1003 select="substring-after($outputstring,
1004 substring-before($outputstring,'ninja install'))"/>
1005 </xsl:call-template>
1006 </xsl:when>
1007 <xsl:otherwise> <!-- "ninja" is the first word and is followed by
1008 "install"-->
1009 <xsl:text>DESTDIR=$PKG_DEST ninja</xsl:text>
1010 <xsl:call-template name="outputpkgdest">
1011 <xsl:with-param
1012 name="outputstring"
1013 select="substring-after($outputstring,'ninja')"/>
1014 </xsl:call-template>
1015 </xsl:otherwise>
1016 </xsl:choose>
1017 </xsl:when>
1018 <xsl:otherwise> <!-- no make nor ninja in this string -->
1019 <xsl:choose>
1020 <xsl:when test="contains($outputstring,'&gt;/') and
1021 not(contains(substring-before($outputstring,'&gt;/'),' /'))">
1022 <xsl:value-of select="substring-before($outputstring,'&gt;/')"/>
1023 <xsl:text>&gt;$PKG_DEST/</xsl:text>
1024 <xsl:call-template name="outputpkgdest">
1025 <xsl:with-param name="outputstring" select="substring-after($outputstring,'&gt;/')"/>
1026 </xsl:call-template>
1027 </xsl:when>
1028 <xsl:when test="contains($outputstring,' /')">
1029 <xsl:value-of select="substring-before($outputstring,' /')"/>
1030 <xsl:text> $PKG_DEST/</xsl:text>
1031 <xsl:call-template name="outputpkgdest">
1032 <xsl:with-param name="outputstring" select="substring-after($outputstring,' /')"/>
1033 </xsl:call-template>
1034 </xsl:when>
1035 <xsl:otherwise>
1036 <xsl:value-of select="$outputstring"/>
1037 </xsl:otherwise>
1038 </xsl:choose>
1039 </xsl:otherwise>
1040 </xsl:choose>
1041 </xsl:template>
1042
1043 <xsl:variable name="APOS">'</xsl:variable>
1044 <xsl:template name="output-wrap">
1045 <xsl:param name="commands" select="''"/>
1046 <xsl:choose>
1047 <xsl:when test="contains($commands,string($APOS))">
1048 <xsl:call-template name="output-wrap">
1049 <xsl:with-param name="commands"
1050 select="substring-before($commands,string($APOS))"/>
1051 </xsl:call-template>
1052 <xsl:text>'\''</xsl:text>
1053 <xsl:call-template name="output-wrap">
1054 <xsl:with-param name="commands"
1055 select="substring-after($commands,string($APOS))"/>
1056 </xsl:call-template>
1057 </xsl:when>
1058 <xsl:otherwise>
1059 <xsl:value-of select="$commands"/>
1060 </xsl:otherwise>
1061 </xsl:choose>
1062 </xsl:template>
1063
1064 <xsl:template name="comment-strip">
1065 <xsl:param name="instructions" select="''"/>
1066 <xsl:choose>
1067 <xsl:when test="contains($instructions,'&#xA;')">
1068 <xsl:call-template name="comment-strip">
1069 <xsl:with-param name="instructions"
1070 select="substring-before($instructions,'&#xA;')"/>
1071 </xsl:call-template>
1072 <xsl:call-template name="comment-strip">
1073 <xsl:with-param name="instructions"
1074 select="substring-after($instructions,'&#xA;')"/>
1075 </xsl:call-template>
1076 </xsl:when>
1077 <xsl:when test="contains($instructions,'\*.la')">
1078 <xsl:if test="$del-la-files='n'">
1079 <xsl:text># </xsl:text>
1080 </xsl:if>
1081 <xsl:value-of select="$instructions"/>
1082 <xsl:text>&#xA;</xsl:text>
1083 </xsl:when>
1084 <xsl:when test="contains($instructions,'strip ')">
1085 <xsl:if test="$strip='n'">
1086 <xsl:text># </xsl:text>
1087 </xsl:if>
1088 <xsl:value-of select="$instructions"/>
1089 <xsl:text> || true&#xA;</xsl:text>
1090 </xsl:when>
1091 <xsl:otherwise>
1092 <xsl:value-of select="$instructions"/>
1093 <xsl:text>&#xA;</xsl:text>
1094 </xsl:otherwise>
1095 </xsl:choose>
1096 </xsl:template>
1097
1098 <xsl:template name="comment-test">
1099 <xsl:param name="instructions" select="''"/>
1100 <xsl:param name="eof-seen" select="false()"/>
1101 <xsl:choose>
1102 <xsl:when test="contains($instructions,'&#xA;')">
1103 <xsl:call-template name="comment-test">
1104 <xsl:with-param name="instructions"
1105 select="substring-before($instructions,'&#xA;')"/>
1106 <xsl:with-param name="eof-seen" select="$eof-seen"/>
1107 </xsl:call-template>
1108 <xsl:choose>
1109 <xsl:when test="contains(substring-before($instructions,'&#xA;'),
1110 'EOF')">
1111 <xsl:call-template name="comment-test">
1112 <xsl:with-param name="instructions"
1113 select="substring-after($instructions,'&#xA;')"/>
1114 <xsl:with-param name="eof-seen" select="not($eof-seen)"/>
1115 </xsl:call-template>
1116 </xsl:when>
1117 <xsl:otherwise>
1118 <xsl:call-template name="comment-test">
1119 <xsl:with-param name="instructions"
1120 select="substring-after($instructions,'&#xA;')"/>
1121 <xsl:with-param name="eof-seen" select="$eof-seen"/>
1122 </xsl:call-template>
1123 </xsl:otherwise>
1124 </xsl:choose>
1125 </xsl:when>
1126 <xsl:otherwise>
1127 <xsl:if test="$testsuite = '0' or
1128 $testsuite = '1' and
1129 not(ancestor::sect1[@id='ch-system-gcc']) and
1130 not(ancestor::sect1[@id='ch-system-glibc']) and
1131 not(ancestor::sect1[@id='ch-system-gmp']) and
1132 not(ancestor::sect1[@id='ch-system-mpfr']) and
1133 not(ancestor::sect1[@id='ch-system-binutils']) or
1134 $testsuite = '2' and
1135 ancestor::chapter[@id='chapter-temporary-tools']">
1136 <xsl:text># </xsl:text>
1137 </xsl:if>
1138 <xsl:choose>
1139 <xsl:when test="$bomb-testsuite = 'n'">
1140 <xsl:choose>
1141 <xsl:when test="contains(string(), 'make -k')">
1142 <xsl:value-of select="$instructions"/>
1143 <xsl:if test="not($eof-seen)">
1144 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true</xsl:text>
1145 </xsl:if>
1146 <xsl:text>&#xA;</xsl:text>
1147 </xsl:when>
1148 <xsl:when test="contains($instructions, 'make')">
1149 <xsl:value-of select="substring-before($instructions, 'make')"/>
1150 <xsl:text>make -k</xsl:text>
1151 <xsl:value-of select="substring-after($instructions, 'make')"/>
1152 <xsl:if test="not($eof-seen)">
1153 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true</xsl:text>
1154 </xsl:if>
1155 <xsl:text>&#xA;</xsl:text>
1156 </xsl:when>
1157 <xsl:otherwise>
1158 <xsl:value-of select="$instructions"/>
1159 <xsl:if
1160 test="not(contains($instructions, '&gt;&gt;')) and
1161 not($eof-seen) and
1162 substring($instructions,
1163 string-length($instructions)) != '\'">
1164 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true</xsl:text>
1165 </xsl:if>
1166 <xsl:text>&#xA;</xsl:text>
1167 </xsl:otherwise>
1168 </xsl:choose>
1169 </xsl:when>
1170 <xsl:otherwise>
1171 <!-- bomb-testsuite != 'n'-->
1172 <xsl:choose>
1173 <xsl:when test="contains($instructions, 'make -k')">
1174 <xsl:value-of select="$instructions"/>
1175 <xsl:if test="not($eof-seen)">
1176 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true</xsl:text>
1177 </xsl:if>
1178 <xsl:text>&#xA;</xsl:text>
1179 </xsl:when>
1180 <xsl:otherwise>
1181 <xsl:value-of select="$instructions"/>
1182 <xsl:if test="not(contains($instructions, '&gt;&gt;')) and
1183 not($eof-seen) and
1184 substring($instructions,
1185 string-length($instructions)) != '\'">
1186 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
1187 </xsl:if>
1188 <xsl:text>&#xA;</xsl:text>
1189 </xsl:otherwise>
1190 </xsl:choose>
1191 </xsl:otherwise> <!-- end not bomb-test=n -->
1192 </xsl:choose>
1193 </xsl:otherwise>
1194 </xsl:choose>
1195 </xsl:template>
1196
1197 <xsl:template name="basename">
1198 <xsl:param name="path" select="''"/>
1199 <xsl:choose>
1200 <xsl:when test="contains($path,'/') and substring-after($path,'/')!=''">
1201 <xsl:call-template name="basename">
1202 <xsl:with-param name="path" select="substring-after($path,'/')"/>
1203 </xsl:call-template>
1204 </xsl:when>
1205 <xsl:when test="contains($path,'/') and substring-after($path,'/')=''">
1206 <xsl:value-of select="substring-before($path,'/')"/>
1207 </xsl:when>
1208 <xsl:otherwise>
1209 <xsl:value-of select="$path"/>
1210 </xsl:otherwise>
1211 </xsl:choose>
1212 </xsl:template>
1213
1214 <xsl:template name="start-script">
1215 <xsl:param name="order" select="'073'"/>
1216 <xsl:text>
1217<!-- save the timer, so that unpacking, and du is not counted -->
1218PREV_SEC=${SECONDS}
1219 <!-- get the location of the system root -->
1220ROOT=</xsl:text>
1221 <xsl:choose>
1222 <xsl:when test="starts-with(./@id, 'ch-tools') or
1223 contains (./@id, 'kernfs')">
1224 <xsl:text>$LFS/
1225</xsl:text>
1226 </xsl:when>
1227 <xsl:otherwise>
1228 <xsl:text>/
1229</xsl:text>
1230 </xsl:otherwise>
1231 </xsl:choose>
1232 <xsl:text>
1233SCRIPT_ROOT=</xsl:text>
1234 <xsl:copy-of select="$script-root"/>
1235 <xsl:text>
1236</xsl:text>
1237 <xsl:if test="sect2[@role='installation']">
1238 <xsl:text>
1239SRC_DIR=${ROOT}sources
1240<!-- Set variables, for use by the Makefile and package manager -->
1241VERSION=</xsl:text><!-- needed for Makefile, and may be used in PackInstall-->
1242 <xsl:copy-of select=".//sect1info/productnumber/text()"/>
1243 <xsl:text>
1244PKG_DEST=${SRC_DIR}/</xsl:text>
1245 <xsl:copy-of select="$order"/>
1246 <xsl:text>-</xsl:text>
1247 <xsl:copy-of select=".//sect1info/productname/text()"/>
1248 <xsl:text>
1249<!-- Get the tarball name from sect1info -->
1250PACKAGE=</xsl:text>
1251 <xsl:call-template name="basename">
1252 <xsl:with-param name="path" select=".//sect1info/address/text()"/>
1253 </xsl:call-template>
1254 <xsl:if test = "( ../@id = 'chapter-building-system' or
1255 ../@id = 'chapter-config' or
1256 ../@id = 'chapter-bootscripts' or
1257 ../@id = 'chapter-bootable' or
1258 starts-with(@id,'ch-system') ) and $pkgmngt = 'y'">
1259<!-- the last alternative for old books where some sections in
1260 chapter-config had ch-system -->
1261 <xsl:text>
1262source ${ROOT}${SCRIPT_ROOT}/packInstall.sh
1263export -f packInstall</xsl:text>
1264 <xsl:if test="$wrap-install='y'">
1265 <xsl:text>
1266export -f wrapInstall
1267</xsl:text>
1268 </xsl:if>
1269 </xsl:if>
1270<!-- Get the build directory name and clean remnants of previous attempts -->
1271 <xsl:text>
1272cd $SRC_DIR
1273PKGDIR=$(tar -tf $PACKAGE | head -n1 | sed 's@^./@@;s@/.*@@')
1274export PKGDIR VERSION PKG_DEST
1275
1276if [ -d "$PKGDIR" ]; then rm -rf $PKGDIR; fi
1277if [ -d "${PKGDIR%-*}-build" ]; then rm -rf ${PKGDIR%-*}-build; fi
1278</xsl:text>
1279 </xsl:if>
1280 <xsl:text>
1281echo "KB: $(du -skx --exclude=lost+found --exclude=var/lib --exclude=$SCRIPT_ROOT $ROOT)"
1282</xsl:text>
1283 <xsl:if test="sect2[@role='installation']">
1284 <xsl:text>
1285<!-- At last unpack and change directory -->
1286tar -xf $PACKAGE
1287cd $PKGDIR
1288</xsl:text>
1289 </xsl:if>
1290 <xsl:text>SECONDS=${PREV_SEC}
1291
1292# Start of LFS book script
1293</xsl:text>
1294 </xsl:template>
1295
1296 <xsl:template name="end-script">
1297 <xsl:text>
1298# End of LFS book script
1299
1300echo "KB: $(du -skx --exclude=lost+found --exclude=var/lib --exclude=$SCRIPT_ROOT $ROOT)"
1301</xsl:text>
1302 <xsl:if test="sect2[@role='installation']">
1303 <xsl:text>cd $SRC_DIR
1304rm -rf $PKGDIR
1305if [ -d "${PKGDIR%-*}-build" ]; then rm -rf ${PKGDIR%-*}-build; fi
1306</xsl:text>
1307 </xsl:if>
1308 </xsl:template>
1309
1310</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.