source: LFS/lfs.xsl@ dd7e0f67

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

Fix a forgotten new IDREF

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