source: LFS/lfs.xsl@ 13e52a5

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

Add the multilib book: fixes ticket #1722

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