source: LFS/lfs.xsl@ b6e981a

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

LFS/lfs.xsl: fix cases when using DESTDIR

We cannot use only the fact that it is not in chapter-temporary-tools
since now we have several chapter for the temporary system.
so use a list of chapters (non negated).

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