source: LFS/lfs.xsl@ 55e82d2

ablfs-more trunk
Last change on this file since 55e82d2 was 55e82d2, checked in by Pierre Labastie <pierre.labastie@…>, 2 years ago

Various updates for pacman PM

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