source: LFS/lfs.xsl@ 36f5dce

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

Fix lfs.xsl for cross2, and change scriptlet numbering for trunk and cross2

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