source: LFS/lfs.xsl@ 3930460

ablfs-more legacy trunk
Last change on this file since 3930460 was 085435e, checked in by Pierre Labastie <pierre@…>, 5 years ago

Remove the obsolete vim-lang instructions and variable, and add non-wide-
charater ncurses library

  • Property mode set to 100644
File size: 48.9 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2
3<!-- $Id$ -->
4
5<xsl:stylesheet
6 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
7 xmlns:exsl="http://exslt.org/common"
8 extension-element-prefixes="exsl"
9 version="1.0">
10
11<!-- Parameters -->
12
13 <!-- 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 <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:if test="../@id='ch-system-ncurses' and $ncurses5='y'">
361 <xsl:apply-templates select=".//screen[@role='nodump']"/>
362 </xsl:if>
363 </xsl:template>
364
365 <xsl:template match="sect1" mode="pkgmngt">
366 <xsl:param name="dirname" select="'chapter05'"/>
367 <!-- The build order -->
368 <xsl:param name="order" select="'062'"/>
369<!-- The file names -->
370 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
371 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
372 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
373 <!-- Creating dirs and files -->
374 <xsl:if test="count(descendant::screen/userinput) &gt; 0 and
375 count(descendant::screen/userinput) &gt;
376 count(descendant::screen[@role='nodump'])">
377 <exsl:document href="{$dirname}/{$order}-{position()}-{$filename}"
378 method="text">
379 <xsl:text>#!/bin/bash
380set +h
381set -e
382</xsl:text>
383 <xsl:call-template name="start-script">
384 <xsl:with-param name="order" select="concat($order,'-',position())"/>
385 </xsl:call-template>
386 <xsl:apply-templates
387 select=".//screen[not(@role) or
388 @role != 'nodump']/userinput[@remap != 'adjust']"
389 mode="pkgmngt"/>
390 <xsl:if test="$dirname = 'chapter06'">
391 <xsl:text>PREV_SEC=${SECONDS}
392packInstall
393SECONDS=${PREV_SEC}
394rm -rf "$PKG_DEST"
395</xsl:text>
396 </xsl:if>
397 <xsl:apply-templates
398 select=".//screen[not(@role) or
399 @role != 'nodump'
400 ]/userinput[not(@remap) or
401 @remap='adjust'
402 ]"
403 mode="pkgmngt"/>
404 <xsl:text>
405echo -e "\n\nTotalseconds: $SECONDS\n"
406</xsl:text>
407 <xsl:call-template name="end-script"/>
408 <xsl:text>exit
409</xsl:text>
410 </exsl:document>
411 </xsl:if>
412 </xsl:template>
413
414 <xsl:template match="userinput" mode="pkgmngt">
415 <xsl:apply-templates/>
416 <xsl:text>&#xA;</xsl:text>
417 </xsl:template>
418
419 <xsl:template match="userinput">
420 <xsl:choose>
421 <!-- Copying the kernel config file -->
422 <xsl:when test="string() = 'make mrproper'">
423 <xsl:text>make mrproper&#xA;</xsl:text>
424 <xsl:if test="ancestor::sect1[@id='ch-bootable-kernel']">
425 <xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
426 </xsl:if>
427 </xsl:when>
428<!-- test instructions -->
429 <xsl:when test="@remap = 'test'">
430 <xsl:call-template name="comment-test">
431 <xsl:with-param name="instructions" select="string()"/>
432 </xsl:call-template>
433 </xsl:when>
434<!-- End of test instructions -->
435<!-- If the instructions contain "strip ", it may mean they contain also .la
436 file removal (and possibly other clean up). We therefore call a template
437 to comment them out appropriately and also to not stop if stripping
438 fails. -->
439 <xsl:when test="contains(string(),'strip ') or
440 contains(string(),'\*.la')">
441 <xsl:call-template name="comment-strip">
442 <xsl:with-param name="instructions" select="string()"/>
443 </xsl:call-template>
444 </xsl:when>
445<!-- Package management -->
446<!-- Add $PKG_DEST to installation commands -->
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: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' -->
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 <!-- The rest of commands -->
552 <xsl:otherwise>
553 <xsl:apply-templates/>
554 <xsl:text>&#xA;</xsl:text>
555 </xsl:otherwise>
556 </xsl:choose>
557 </xsl:template>
558
559 <xsl:template match="replaceable">
560 <xsl:choose>
561 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
562 <xsl:value-of select="$timezone"/>
563 </xsl:when>
564 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
565 <xsl:value-of select="$page"/>
566 </xsl:when>
567 <xsl:when test="contains(string(.),'&lt;ll&gt;_&lt;CC&gt;')">
568 <xsl:value-of select="$lang"/>
569 </xsl:when>
570 <xsl:when test="contains(string(.),'Domain')">
571 <xsl:value-of select="$domain"/>
572 </xsl:when>
573 <xsl:when test="contains(string(.),'primary')">
574 <xsl:value-of select="$nameserver1"/>
575 </xsl:when>
576 <xsl:when test="contains(string(.),'secondary')">
577 <xsl:value-of select="$nameserver2"/>
578 </xsl:when>
579 <xsl:when test="contains(string(.),'192.168.1.1')">
580 <xsl:value-of select="$ip"/>
581 </xsl:when>
582 <xsl:when test="contains(string(.),'192.168.0.2')">
583 <xsl:value-of select="$ip"/>
584 </xsl:when>
585 <xsl:when test="contains(string(.),'eth0')">
586 <xsl:value-of select="$interface"/>
587 </xsl:when>
588<!-- Only adapted to LFS-20170310 and later -->
589 <xsl:when test="contains(string(.),'HOSTNAME')">
590 <xsl:value-of select="$hostname"/>
591 </xsl:when>
592 <xsl:when test="contains(string(.),'FQDN')">
593 <xsl:value-of select="$hostname"/>
594 <xsl:text>.</xsl:text>
595 <xsl:value-of select="$domain"/>
596 </xsl:when>
597 <xsl:when test="contains(string(.),'alias')"/>
598 <xsl:when test="contains(string(.),'&lt;lfs&gt;')">
599 <xsl:value-of select="$hostname"/>
600 </xsl:when>
601 <xsl:otherwise>
602 <xsl:text>**EDITME</xsl:text>
603 <xsl:apply-templates/>
604 <xsl:text>EDITME**</xsl:text>
605 </xsl:otherwise>
606 </xsl:choose>
607 </xsl:template>
608
609 <xsl:template match="literal">
610 <xsl:choose>
611 <xsl:when test="contains(string(),'ONBOOT')">
612 <xsl:call-template name="outputnet">
613 <xsl:with-param name="netstring" select="string()"/>
614 </xsl:call-template>
615 </xsl:when>
616 <xsl:when test="contains(string(),'[Match]')">
617 <xsl:call-template name="outputsysdnet">
618 <xsl:with-param name="netstring" select="string()"/>
619 </xsl:call-template>
620 </xsl:when>
621 <xsl:when test="contains(string(),'0.0 0 0.0')">
622 <xsl:copy-of select="substring-before(string(),'LOCAL')"/>
623 <xsl:if test="$local='y'"><xsl:text>LOCAL</xsl:text></xsl:if>
624 <xsl:if test="$local='n'"><xsl:text>UTC</xsl:text></xsl:if>
625 </xsl:when>
626 <xsl:when test="contains(string(),'UTC=1')">
627 <xsl:copy-of select="substring-before(string(),'1')"/>
628 <xsl:if test="$local='y'"><xsl:text>0</xsl:text></xsl:if>
629 <xsl:if test="$local='n'"><xsl:text>1</xsl:text></xsl:if>
630 <xsl:copy-of select="substring-after(string(),'1')"/>
631 </xsl:when>
632 <xsl:when test="contains(string(),'bg_bds-')">
633 <xsl:call-template name="outputsysvconsole">
634 <xsl:with-param name="consolestring" select="string()"/>
635 </xsl:call-template>
636 </xsl:when>
637 <xsl:when test="contains(string(),'de-latin1')">
638 <xsl:call-template name="outputsysdconsole">
639 <xsl:with-param name="consolestring" select="string()"/>
640 </xsl:call-template>
641 </xsl:when>
642 <xsl:otherwise>
643 <xsl:apply-templates/>
644 </xsl:otherwise>
645 </xsl:choose>
646 </xsl:template>
647
648 <xsl:template name="outputnet">
649 <xsl:param name="netstring" select="''"/>
650 <!-- We suppose that book example has the following values:
651 - interface: eth0
652 - ip: 192.168.1.2
653 - gateway: 192.168.1.1
654 - prefix: 24
655 - broadcast: 192.168.1.255
656 Change below if book changes -->
657 <xsl:choose>
658 <xsl:when test="contains($netstring,'eth0')">
659 <xsl:call-template name="outputnet">
660 <xsl:with-param name="netstring"
661 select="substring-before($netstring,'eth0')"/>
662 </xsl:call-template>
663 <xsl:value-of select="$interface"/>
664 <xsl:call-template name="outputnet">
665 <xsl:with-param name="netstring"
666 select="substring-after($netstring,'eth0')"/>
667 </xsl:call-template>
668 </xsl:when>
669 <xsl:when test="contains($netstring,'192.168.1.1')">
670 <xsl:call-template name="outputnet">
671 <xsl:with-param name="netstring"
672 select="substring-before($netstring,'192.168.1.1')"/>
673 </xsl:call-template>
674 <xsl:value-of select="$gateway"/>
675 <xsl:call-template name="outputnet">
676 <xsl:with-param name="netstring"
677 select="substring-after($netstring,'192.168.1.1')"/>
678 </xsl:call-template>
679 </xsl:when>
680 <!-- must test this before the following, because 192.168.1.255 contains
681 192.168.1.2! -->
682 <xsl:when test="contains($netstring,'192.168.1.255')">
683 <xsl:call-template name="outputnet">
684 <xsl:with-param name="netstring"
685 select="substring-before($netstring,'192.168.1.255')"/>
686 </xsl:call-template>
687 <xsl:value-of select="$broadcast"/>
688 <xsl:call-template name="outputnet">
689 <xsl:with-param name="netstring"
690 select="substring-after($netstring,'192.168.1.255')"/>
691 </xsl:call-template>
692 </xsl:when>
693 <xsl:when test="contains($netstring,'192.168.1.2')">
694 <xsl:call-template name="outputnet">
695 <xsl:with-param name="netstring"
696 select="substring-before($netstring,'192.168.1.2')"/>
697 </xsl:call-template>
698 <xsl:value-of select="$ip"/>
699 <xsl:call-template name="outputnet">
700 <xsl:with-param name="netstring"
701 select="substring-after($netstring,'192.168.1.2')"/>
702 </xsl:call-template>
703 </xsl:when>
704 <xsl:when test="contains($netstring,'24')">
705 <xsl:call-template name="outputnet">
706 <xsl:with-param name="netstring"
707 select="substring-before($netstring,'24')"/>
708 </xsl:call-template>
709 <xsl:value-of select="$prefix"/>
710 <xsl:call-template name="outputnet">
711 <xsl:with-param name="netstring"
712 select="substring-after($netstring,'24')"/>
713 </xsl:call-template>
714 </xsl:when>
715 <xsl:otherwise>
716 <xsl:value-of select="$netstring"/>
717 </xsl:otherwise>
718 </xsl:choose>
719 </xsl:template>
720
721 <xsl:template name="outputsysdnet">
722 <xsl:param name="netstring" select="''"/>
723 <!-- We suppose that book example has the following values:
724 - interface: <network-device-name>
725 - ip: 192.168.0.2
726 - gateway: 192.168.0.1
727 - prefix: 24
728 - DNS: 192.168.0.1
729 - Domain: <Your Domain Name>
730 and gateway comes before DNS. Change below if book changes -->
731 <xsl:choose>
732 <xsl:when test="contains($netstring,'&lt;network-device-name&gt;')">
733 <xsl:call-template name="outputsysdnet">
734 <xsl:with-param name="netstring"
735 select="substring-before($netstring,'&lt;network-device-name&gt;')"/>
736 </xsl:call-template>
737 <xsl:value-of select="$interface"/>
738 <xsl:call-template name="outputsysdnet">
739 <xsl:with-param name="netstring"
740 select="substring-after($netstring,'&lt;network-device-name&gt;')"/>
741 </xsl:call-template>
742 </xsl:when>
743 <xsl:when test="contains($netstring,'192.168.0.1') and
744 contains($netstring,'Gateway')">
745 <xsl:call-template name="outputsysdnet">
746 <xsl:with-param name="netstring"
747 select="substring-before($netstring,'192.168.0.1')"/>
748 </xsl:call-template>
749 <xsl:value-of select="$gateway"/>
750 <xsl:call-template name="outputsysdnet">
751 <xsl:with-param name="netstring"
752 select="substring-after($netstring,'192.168.0.1')"/>
753 </xsl:call-template>
754 </xsl:when>
755 <xsl:when test="contains($netstring,'192.168.0.1') and
756 not(contains($netstring,'Gateway'))">
757 <xsl:call-template name="outputsysdnet">
758 <xsl:with-param name="netstring"
759 select="substring-before($netstring,'192.168.0.1')"/>
760 </xsl:call-template>
761 <xsl:value-of select="$nameserver1"/>
762 <xsl:text>
763DNS=</xsl:text>
764 <xsl:value-of select="$nameserver2"/>
765 <xsl:call-template name="outputsysdnet">
766 <xsl:with-param name="netstring"
767 select="substring-after($netstring,'192.168.0.1')"/>
768 </xsl:call-template>
769 </xsl:when>
770 <xsl:when test="contains($netstring,'192.168.0.2')">
771 <xsl:call-template name="outputsysdnet">
772 <xsl:with-param name="netstring"
773 select="substring-before($netstring,'192.168.0.2')"/>
774 </xsl:call-template>
775 <xsl:value-of select="$ip"/>
776 <xsl:call-template name="outputsysdnet">
777 <xsl:with-param name="netstring"
778 select="substring-after($netstring,'192.168.0.2')"/>
779 </xsl:call-template>
780 </xsl:when>
781 <xsl:when test="contains($netstring,'24')">
782 <xsl:call-template name="outputsysdnet">
783 <xsl:with-param name="netstring"
784 select="substring-before($netstring,'24')"/>
785 </xsl:call-template>
786 <xsl:value-of select="$prefix"/>
787 <xsl:call-template name="outputsysdnet">
788 <xsl:with-param name="netstring"
789 select="substring-after($netstring,'24')"/>
790 </xsl:call-template>
791 </xsl:when>
792 <xsl:when test="contains($netstring,'&lt;Your Domain Name&gt;')">
793 <xsl:call-template name="outputsysdnet">
794 <xsl:with-param name="netstring"
795 select="substring-before($netstring,'&lt;Your Domain Name&gt;')"/>
796 </xsl:call-template>
797 <xsl:value-of select="$domain"/>
798 <xsl:call-template name="outputsysdnet">
799 <xsl:with-param name="netstring"
800 select="substring-after($netstring,'&lt;Your Domain Name&gt;')"/>
801 </xsl:call-template>
802 </xsl:when>
803 <xsl:otherwise>
804 <xsl:value-of select="$netstring"/>
805 </xsl:otherwise>
806 </xsl:choose>
807 </xsl:template>
808
809 <xsl:template name="outputsysvconsole">
810 <!-- We suppose that book example has the following values:
811 - KEYMAP: bg_bds-utf8
812 - FONT: LatArCyrHeb-16
813 Change below if book changes -->
814 <xsl:param name="consolestring" select="''"/>
815 <xsl:choose>
816 <xsl:when test="contains($consolestring,'bg_bds-utf8')">
817 <xsl:call-template name="outputsysvconsole">
818 <xsl:with-param
819 name="consolestring"
820 select="substring-before($consolestring,'bg_bds-utf8')"/>
821 </xsl:call-template>
822 <xsl:value-of select="$keymap"/>
823 <xsl:call-template name="outputsysvconsole">
824 <xsl:with-param
825 name="consolestring"
826 select="substring-after($consolestring,'bg_bds-utf8')"/>
827 </xsl:call-template>
828 </xsl:when>
829 <xsl:when test="contains($consolestring,'LatArCyrHeb-16')">
830 <xsl:call-template name="outputsysvconsole">
831 <xsl:with-param
832 name="consolestring"
833 select="substring-before($consolestring,'LatArCyrHeb-16')"/>
834 </xsl:call-template>
835 <xsl:value-of select="$font"/>
836 <xsl:text>"
837LOGLEVEL="</xsl:text>
838 <xsl:copy-of select="$log-level"/>
839 <xsl:call-template name="outputsysvconsole">
840 <xsl:with-param
841 name="consolestring"
842 select="substring-after($consolestring,'LatArCyrHeb-16')"/>
843 </xsl:call-template>
844 </xsl:when>
845 <xsl:otherwise>
846 <xsl:copy-of select="$consolestring"/>
847 </xsl:otherwise>
848 </xsl:choose>
849 </xsl:template>
850
851 <xsl:template name="outputsysdconsole">
852 <!-- We suppose that book example has the following values:
853 - KEYMAP: de-latin1
854 - FONT: Lat2-Terminus16
855 Change below if book changes -->
856 <xsl:param name="consolestring" select="''"/>
857 <xsl:choose>
858 <xsl:when test="contains($consolestring,'de-latin1')">
859 <xsl:call-template name="outputsysdconsole">
860 <xsl:with-param
861 name="consolestring"
862 select="substring-before($consolestring,'de-latin1')"/>
863 </xsl:call-template>
864 <xsl:value-of select="$keymap"/>
865 <xsl:call-template name="outputsysdconsole">
866 <xsl:with-param
867 name="consolestring"
868 select="substring-after($consolestring,'de-latin1')"/>
869 </xsl:call-template>
870 </xsl:when>
871 <xsl:when test="contains($consolestring,'Lat2-Terminus16')">
872 <xsl:call-template name="outputsysdconsole">
873 <xsl:with-param
874 name="consolestring"
875 select="substring-before($consolestring,'Lat2-Terminus16')"/>
876 </xsl:call-template>
877 <xsl:value-of select="$font"/>
878 <xsl:call-template name="outputsysdconsole">
879 <xsl:with-param
880 name="consolestring"
881 select="substring-after($consolestring,'Lat2-Terminus16')"/>
882 </xsl:call-template>
883 </xsl:when>
884 <xsl:otherwise>
885 <xsl:copy-of select="$consolestring"/>
886 </xsl:otherwise>
887 </xsl:choose>
888 </xsl:template>
889
890 <xsl:template name="outputpkgdest">
891 <xsl:param name="outputstring" select="foo"/>
892 <xsl:choose>
893 <xsl:when test="contains($outputstring,'make ')">
894 <xsl:choose>
895 <xsl:when test="not(starts-with($outputstring,'make'))">
896 <xsl:call-template name="outputpkgdest">
897 <xsl:with-param name="outputstring"
898 select="substring-before($outputstring,'make')"/>
899 </xsl:call-template>
900 <xsl:call-template name="outputpkgdest">
901 <xsl:with-param
902 name="outputstring"
903 select="substring-after($outputstring,
904 substring-before($outputstring,'make'))"/>
905 </xsl:call-template>
906 </xsl:when>
907 <xsl:otherwise>
908 <xsl:choose>
909<!-- special cases (no DESTDIR) here -->
910 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
911 <xsl:text>make install_root=$PKG_DEST -j1</xsl:text>
912 <xsl:value-of
913 select="substring-before(substring-after(string(),'make'),
914 'install')"/>
915 <xsl:text>install&#xA;</xsl:text>
916 </xsl:when>
917 <xsl:when test="ancestor::sect1[@id='ch-system-bzip2']">
918 <xsl:text>make PREFIX=$PKG_DEST/usr install&#xA;</xsl:text>
919 </xsl:when>
920 <xsl:when test="ancestor::sect1[@id='ch-system-sysklogd']">
921 <xsl:text>make BINDIR=$PKG_DEST/sbin prefix=$PKG_DEST install&#xA;</xsl:text>
922 </xsl:when>
923 <xsl:when test="ancestor::sect1[@id='ch-system-iproute2']">
924 <xsl:text>make DESTDIR=$PKG_DEST DOCDIR=</xsl:text>
925 <xsl:value-of
926 select="substring-before(substring-after(string(),'DOCDIR='),
927 'install')"/>
928 <xsl:text>install&#xA;</xsl:text>
929 </xsl:when>
930 <xsl:when test="ancestor::sect1[@id='ch-system-sysvinit']">
931 <xsl:text>make ROOT=$PKG_DEST</xsl:text>
932 <xsl:value-of
933 select="substring-before(substring-after(string(),'make'),
934 'install')"/>
935 <xsl:text>install&#xA;</xsl:text>
936 </xsl:when>
937 <xsl:when test="ancestor::sect1[@id='ch-bootable-kernel']">
938 <xsl:text>make INSTALL_MOD_PATH=$PKG_DEST</xsl:text>
939 <xsl:value-of
940 select="substring-before(substring-after(string(),'make'),
941 'install')"/>
942 <xsl:text>install&#xA;</xsl:text>
943 </xsl:when>
944 <xsl:otherwise>
945 <xsl:text>make DESTDIR=$PKG_DEST</xsl:text>
946 <xsl:call-template name="outputpkgdest">
947 <xsl:with-param
948 name="outputstring"
949 select="substring-after($outputstring,'make')"/>
950 </xsl:call-template>
951 </xsl:otherwise>
952 </xsl:choose>
953 </xsl:otherwise>
954 </xsl:choose>
955 </xsl:when>
956 <xsl:when test="contains($outputstring,'ninja install')">
957 <xsl:choose>
958 <xsl:when test="not(starts-with($outputstring,'ninja install'))">
959 <xsl:call-template name="outputpkgdest">
960 <xsl:with-param name="outputstring"
961 select="substring-before($outputstring,'ninja install')"/>
962 </xsl:call-template>
963 <xsl:call-template name="outputpkgdest">
964 <xsl:with-param
965 name="outputstring"
966 select="substring-after($outputstring,
967 substring-before($outputstring,'ninja install'))"/>
968 </xsl:call-template>
969 </xsl:when>
970 <xsl:otherwise> <!-- "ninja" is the first word and is followed by
971 "install"-->
972 <xsl:text>DESTDIR=$PKG_DEST ninja</xsl:text>
973 <xsl:call-template name="outputpkgdest">
974 <xsl:with-param
975 name="outputstring"
976 select="substring-after($outputstring,'ninja')"/>
977 </xsl:call-template>
978 </xsl:otherwise>
979 </xsl:choose>
980 </xsl:when>
981 <xsl:otherwise> <!-- no make nor ninja in this string -->
982 <xsl:choose>
983 <xsl:when test="contains($outputstring,'&gt;/') and
984 not(contains(substring-before($outputstring,'&gt;/'),' /'))">
985 <xsl:value-of select="substring-before($outputstring,'&gt;/')"/>
986 <xsl:text>&gt;$PKG_DEST/</xsl:text>
987 <xsl:call-template name="outputpkgdest">
988 <xsl:with-param name="outputstring" select="substring-after($outputstring,'&gt;/')"/>
989 </xsl:call-template>
990 </xsl:when>
991 <xsl:when test="contains($outputstring,' /')">
992 <xsl:value-of select="substring-before($outputstring,' /')"/>
993 <xsl:text> $PKG_DEST/</xsl:text>
994 <xsl:call-template name="outputpkgdest">
995 <xsl:with-param name="outputstring" select="substring-after($outputstring,' /')"/>
996 </xsl:call-template>
997 </xsl:when>
998 <xsl:otherwise>
999 <xsl:value-of select="$outputstring"/>
1000 </xsl:otherwise>
1001 </xsl:choose>
1002 </xsl:otherwise>
1003 </xsl:choose>
1004 </xsl:template>
1005
1006 <xsl:variable name="APOS">'</xsl:variable>
1007 <xsl:template name="output-wrap">
1008 <xsl:param name="commands" select="''"/>
1009 <xsl:choose>
1010 <xsl:when test="contains($commands,string($APOS))">
1011 <xsl:call-template name="output-wrap">
1012 <xsl:with-param name="commands"
1013 select="substring-before($commands,string($APOS))"/>
1014 </xsl:call-template>
1015 <xsl:text>'\''</xsl:text>
1016 <xsl:call-template name="output-wrap">
1017 <xsl:with-param name="commands"
1018 select="substring-after($commands,string($APOS))"/>
1019 </xsl:call-template>
1020 </xsl:when>
1021 <xsl:otherwise>
1022 <xsl:value-of select="$commands"/>
1023 </xsl:otherwise>
1024 </xsl:choose>
1025 </xsl:template>
1026
1027 <xsl:template name="comment-strip">
1028 <xsl:param name="instructions" select="''"/>
1029 <xsl:choose>
1030 <xsl:when test="contains($instructions,'&#xA;')">
1031 <xsl:call-template name="comment-strip">
1032 <xsl:with-param name="instructions"
1033 select="substring-before($instructions,'&#xA;')"/>
1034 </xsl:call-template>
1035 <xsl:call-template name="comment-strip">
1036 <xsl:with-param name="instructions"
1037 select="substring-after($instructions,'&#xA;')"/>
1038 </xsl:call-template>
1039 </xsl:when>
1040 <xsl:when test="contains($instructions,'\*.la')">
1041 <xsl:if test="$del-la-files='n'">
1042 <xsl:text># </xsl:text>
1043 </xsl:if>
1044 <xsl:value-of select="$instructions"/>
1045 <xsl:text>&#xA;</xsl:text>
1046 </xsl:when>
1047 <xsl:when test="contains($instructions,'strip ')">
1048 <xsl:if test="$strip='n'">
1049 <xsl:text># </xsl:text>
1050 </xsl:if>
1051 <xsl:value-of select="$instructions"/>
1052 <xsl:text> || true&#xA;</xsl:text>
1053 </xsl:when>
1054 <xsl:otherwise>
1055 <xsl:value-of select="$instructions"/>
1056 <xsl:text>&#xA;</xsl:text>
1057 </xsl:otherwise>
1058 </xsl:choose>
1059 </xsl:template>
1060
1061 <xsl:template name="comment-test">
1062 <xsl:param name="instructions" select="''"/>
1063 <xsl:choose>
1064 <xsl:when test="contains($instructions,'&#xA;')">
1065 <xsl:call-template name="comment-test">
1066 <xsl:with-param name="instructions"
1067 select="substring-before($instructions,'&#xA;')"/>
1068 </xsl:call-template>
1069 <xsl:call-template name="comment-test">
1070 <xsl:with-param name="instructions"
1071 select="substring-after($instructions,'&#xA;')"/>
1072 </xsl:call-template>
1073 </xsl:when>
1074 <xsl:otherwise>
1075 <xsl:if test="$testsuite = '0' or
1076 $testsuite = '1' and
1077 not(ancestor::sect1[@id='ch-system-gcc']) and
1078 not(ancestor::sect1[@id='ch-system-glibc']) and
1079 not(ancestor::sect1[@id='ch-system-gmp']) and
1080 not(ancestor::sect1[@id='ch-system-mpfr']) and
1081 not(ancestor::sect1[@id='ch-system-binutils']) or
1082 $testsuite = '2' and
1083 ancestor::chapter[@id='chapter-temporary-tools']">
1084 <xsl:text># </xsl:text>
1085 </xsl:if>
1086 <xsl:choose>
1087 <xsl:when test="$bomb-testsuite = 'n'">
1088 <xsl:choose>
1089 <xsl:when test="contains(string(), 'make -k')">
1090 <xsl:value-of select="$instructions"/>
1091 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
1092 </xsl:when>
1093 <xsl:when test="contains($instructions, 'make')">
1094 <xsl:value-of select="substring-before($instructions, 'make')"/>
1095 <xsl:text>make -k</xsl:text>
1096 <xsl:value-of select="substring-after($instructions, 'make')"/>
1097 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
1098 </xsl:when>
1099 <xsl:otherwise>
1100 <xsl:value-of select="$instructions"/>
1101 <xsl:if
1102 test="not(contains($instructions, '&gt;&gt;')) and
1103 substring($instructions,
1104 string-length($instructions)) != '\'">
1105 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
1106 </xsl:if>
1107 <xsl:text>&#xA;</xsl:text>
1108 </xsl:otherwise>
1109 </xsl:choose>
1110 </xsl:when>
1111 <xsl:otherwise>
1112 <!-- bomb-testsuite != 'n'-->
1113 <xsl:choose>
1114 <xsl:when test="contains($instructions, 'make -k')">
1115 <xsl:value-of select="$instructions"/>
1116 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
1117 </xsl:when>
1118 <xsl:otherwise>
1119 <xsl:value-of select="$instructions"/>
1120 <xsl:if test="not(contains($instructions, '&gt;&gt;')) and
1121 substring($instructions,
1122 string-length($instructions)) != '\'">
1123 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
1124 </xsl:if>
1125 <xsl:text>&#xA;</xsl:text>
1126 </xsl:otherwise>
1127 </xsl:choose>
1128 </xsl:otherwise> <!-- end not bomb-test=n -->
1129 </xsl:choose>
1130 </xsl:otherwise>
1131 </xsl:choose>
1132 </xsl:template>
1133
1134 <xsl:template name="basename">
1135 <xsl:param name="path" select="''"/>
1136 <xsl:choose>
1137 <xsl:when test="contains($path,'/') and substring-after($path,'/')!=''">
1138 <xsl:call-template name="basename">
1139 <xsl:with-param name="path" select="substring-after($path,'/')"/>
1140 </xsl:call-template>
1141 </xsl:when>
1142 <xsl:when test="contains($path,'/') and substring-after($path,'/')=''">
1143 <xsl:value-of select="substring-before($path,'/')"/>
1144 </xsl:when>
1145 <xsl:otherwise>
1146 <xsl:value-of select="$path"/>
1147 </xsl:otherwise>
1148 </xsl:choose>
1149 </xsl:template>
1150
1151 <xsl:template name="start-script">
1152 <xsl:param name="order" select="'073'"/>
1153 <xsl:text>
1154<!-- save the timer, so that unpacking, and du is not counted -->
1155PREV_SEC=${SECONDS}
1156 <!-- get the location of the system root -->
1157if [ -h /tools ]; then
1158 ROOT=$(dirname $(readlink /tools))/
1159else
1160 ROOT=/
1161fi
1162SCRIPT_ROOT=</xsl:text>
1163 <xsl:copy-of select="$script-root"/>
1164 <xsl:text>
1165</xsl:text>
1166 <xsl:if test="sect2[@role='installation']">
1167 <xsl:text>
1168SRC_DIR=${ROOT}sources
1169<!-- Set variables, for use by the Makefile and package manager -->
1170VERSION=</xsl:text><!-- needed for Makefile, and may be used in PackInstall-->
1171 <xsl:copy-of select=".//sect1info/productnumber/text()"/>
1172 <xsl:text>
1173PKG_DEST=${SRC_DIR}/</xsl:text>
1174 <xsl:copy-of select="$order"/>
1175 <xsl:text>-</xsl:text>
1176 <xsl:copy-of select=".//sect1info/productname/text()"/>
1177 <xsl:text>
1178<!-- Get the tarball name from sect1info -->
1179PACKAGE=</xsl:text>
1180 <xsl:call-template name="basename">
1181 <xsl:with-param name="path" select=".//sect1info/address/text()"/>
1182 </xsl:call-template>
1183 <xsl:if test = "( ../@id != 'chapter-temporary-tools' or
1184 starts-with(@id,'ch-system') ) and $pkgmngt = 'y'">
1185 <xsl:text>
1186source ${ROOT}${SCRIPT_ROOT}/packInstall.sh
1187export -f packInstall</xsl:text>
1188 <xsl:if test="$wrap-install='y'">
1189 <xsl:text>
1190export -f wrapInstall
1191</xsl:text>
1192 </xsl:if>
1193 </xsl:if>
1194<!-- Get the build directory name and clean remnants of previous attempts -->
1195 <xsl:text>
1196cd $SRC_DIR
1197PKGDIR=$(tar -tf $PACKAGE | head -n1 | sed 's@^./@@;s@/.*@@')
1198export PKGDIR VERSION PKG_DEST
1199
1200if [ -d "$PKGDIR" ]; then rm -rf $PKGDIR; fi
1201if [ -d "${PKGDIR%-*}-build" ]; then rm -rf ${PKGDIR%-*}-build; fi
1202</xsl:text>
1203 </xsl:if>
1204 <xsl:text>
1205echo "KB: $(du -skx --exclude=lost+found --exclude=var/lib --exclude=$SCRIPT_ROOT $ROOT)"
1206</xsl:text>
1207 <xsl:if test="sect2[@role='installation']">
1208 <xsl:text>
1209<!-- At last unpack and change directory -->
1210tar -xf $PACKAGE
1211cd $PKGDIR
1212</xsl:text>
1213 </xsl:if>
1214 <xsl:text>SECONDS=${PREV_SEC}
1215
1216# Start of LFS book script
1217</xsl:text>
1218 </xsl:template>
1219
1220 <xsl:template name="end-script">
1221 <xsl:text>
1222# End of LFS book script
1223
1224echo "KB: $(du -skx --exclude=lost+found --exclude=var/lib --exclude=$SCRIPT_ROOT $ROOT)"
1225</xsl:text>
1226 <xsl:if test="sect2[@role='installation']">
1227 <xsl:text>cd $SRC_DIR
1228rm -rf $PKGDIR
1229if [ -d "${PKGDIR%-*}-build" ]; then rm -rf ${PKGDIR%-*}-build; fi
1230</xsl:text>
1231 </xsl:if>
1232 </xsl:template>
1233
1234</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.