source: LFS/lfs.xsl@ ee842e2

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

Various fixes for recent pacman with new book

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