source: LFS/lfs.xsl@ 4dfe8f9

ablfs-more trunk
Last change on this file since 4dfe8f9 was 594ff3d, checked in by Pierre Labastie <pierre.labastie@…>, 2 years ago

Remove the "Abort on testsuite failure" config (4)

Remove the bomb-testsuite param in lfs.xsl, with the associated
code.
This implies not passing this param in func_book_parser.

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