source: LFS/lfs.xsl@ 7933ed7

ablfs-more legacy trunk
Last change on this file since 7933ed7 was 5451eae, checked in by Pierre Labastie <pierre@…>, 5 years ago

Fix generation of the SBU-DU stats:
The "create-sbu_du.sh" script expects all the logs containing
"Totalseconds" also contains two lines starting with "KB:" with disk usage
stats. Generates those lines for all the logs. Hopefully, the stats are
fairly accurate now...

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