source: LFS/lfs.xsl@ bea551c

trunk
Last change on this file since bea551c was 0e2c6bc, checked in by Xi Ruoyao <xry111@…>, 4 months ago

Don't add >> $TEST_LOG if already redirecting to an absolute path

One example of such a command is

echo 'NAME="Linux From Scratch"' > /etc/os-release

in systemd. If adding >> $TEST_LOG we'll not create the /etc/os-release
files and test failures will happen.

  • Property mode set to 100644
File size: 52.1 KB
RevLine 
[7072e1f]1<?xml version="1.0" encoding="ISO-8859-1"?>
[db181c47]2
[7072e1f]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">
[557fe91]8
[945ccaa]9<!-- Parameters -->
10
[7072e1f]11 <!-- use package management ?
12 n = no, original behavior
[55e82d2]13 y = yes, add PKG_DEST to scripts in install commands of chapter08-10
[7072e1f]14 -->
[945ccaa]15 <xsl:param name="pkgmngt" select="'n'"/>
16
17 <!-- Package management with "porg style" ?
18 n = no, same as pkgmngt description above
[55e82d2]19 y = yes, wrap install commands of chapter08-10 into a bash function.
[945ccaa]20 note that pkgmngt must be 'y' in this case
21 -->
22 <xsl:param name="wrap-install" select='"n"'/>
[2e1c1c3]23
[31d6944]24 <!-- Run test suites?
25 0 = none
[4c36783]26 1 = only chapter08 critical testsuites
27 2 (or more) = all chapter08 testsuites
[28f4756]28 -->
[31d6944]29 <xsl:param name="testsuite" select="1"/>
[01e51a1]30
[1b02a9a]31 <!-- Parallelism (LFS >= 12.1) -->
[3c43655]32 <xsl:param name="jobs" select="1"/>
[1b02a9a]33
[a9360e1]34 <!-- value of jobs for binutils-pass1 -->
35 <xsl:param name="jobs-bp1" select="1"/>
36
[085435e]37 <!-- Install non wide character ncurses 5? -->
38 <xsl:param name="ncurses5" select="'n'"/>
[2e1c1c3]39
[dc7fd7b]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
[877cc6a]46 <!-- Time zone -->
[945ccaa]47 <xsl:param name="timezone" select="'GMT'"/>
[2e1c1c3]48
[877cc6a]49 <!-- Page size -->
[945ccaa]50 <xsl:param name="page" select="'letter'"/>
[2e1c1c3]51
[877cc6a]52 <!-- Locale settings -->
[945ccaa]53 <xsl:param name="lang" select="'C'"/>
[b339c94]54
55 <!-- Install the whole set of locales -->
[945ccaa]56 <xsl:param name='full-locale' select='"n"'/>
[2e1c1c3]57
[945ccaa]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
[3b43e17b]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
[2758d94]80 <!-- The scripts root is needed for printing disk usage -->
81 <xsl:param name='script-root' select="'jhalfs'"/>
82
[945ccaa]83<!-- End parameters -->
84
[4762fb9]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>
[a2b5689]90 <xsl:when test="//sect1[@id='ch-preps-creatingtoolsdir']">
[4762fb9]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>
[36f5dce]98
99<!-- Start of templates -->
[557fe91]100 <xsl:template match="/">
[36f5dce]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']"/>
[557fe91]110 </xsl:template>
[2e1c1c3]111
[36f5dce]112 <xsl:template match="chapter">
113 <xsl:apply-templates select="./sect1[
[13e52a5]114 .//screen[not(@role) or @role != 'nodump']/
[36f5dce]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
[d68eb1b]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 -->
[36f5dce]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)"/>
[7072e1f]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">
[36f5dce]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"/>
[7072e1f]142 </xsl:variable>
143 <!-- Creating dirs and files -->
144 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
[4762fb9]145 <xsl:text>#!</xsl:text>
146 <xsl:if test="@id='ch-system-creatingdirs' or
147 @id='ch-system-createfiles' or
[33a4e41]148 @id='ch-system-strippingagain' or
[bcae37d]149 @id='ch-system-stripping'">
[4762fb9]150 <xsl:copy-of select="$bashdir"/>
151 </xsl:if>
152 <xsl:text>/bin/bash&#xA;set +h&#xA;</xsl:text>
[7072e1f]153 <xsl:if test="not(@id='ch-tools-stripping') and
[33a4e41]154 not(@id='ch-system-strippingagain') and
[bcae37d]155 not(@id='ch-system-stripping')">
[7072e1f]156 <xsl:text>set -e&#xA;</xsl:text>
157 </xsl:if>
158 <xsl:text>&#xA;</xsl:text>
[a131250]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>
[13e52a5]164 <xsl:apply-templates
165 select="sect2 |
166 screen[not(@role) or @role!='nodump']/userinput"/>
[49f8b03]167 <xsl:if test="contains(@id,'creatingdirs') and $pkgmngt='y'">
[f0a31de]168 <xsl:apply-templates
169 select="document('packageManager.xml')//sect1[
170 @id='ch-pkgmngt-creatingdirs'
[e6e0c85]171 ]//userinput"
172 mode="pkgmngt"/>
[f0a31de]173 </xsl:if>
[3484658]174 <xsl:if test="contains(@id,'createfiles') and $pkgmngt='y'">
[f0a31de]175 <xsl:apply-templates
176 select="document('packageManager.xml')//sect1[
177 @id='ch-pkgmngt-createfiles'
[e6e0c85]178 ]//userinput"
179 mode="pkgmngt"/>
[f0a31de]180 </xsl:if>
[a131250]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>
[f0a31de]185 <xsl:text>exit&#xA;</xsl:text>
186 </exsl:document>
[49f8b03]187 <!-- Inclusion of package manager scriptlets -->
188 <xsl:if test="$pkgmngt='y' and
[33a4e41]189 following-sibling::sect1[1][@id='ch-tools-stripping' or @id='ch-tools-cleanup']">
[55e82d2]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>
[49f8b03]197 </xsl:if>
198 <xsl:if test="$pkgmngt='y' and
[33a4e41]199 following-sibling::sect1[2][@id='ch-system-strippingagain' or @id='ch-system-stripping']">
[49f8b03]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>
[f0a31de]208 </xsl:template>
209
210 <xsl:template match="sect2">
211 <xsl:apply-templates
[13e52a5]212 select=".//screen[not(@role) or @role != 'nodump']/userinput[
[f0a31de]213 @remap = 'pre' or
214 @remap = 'configure' or
215 @remap = 'make' or
216 @remap = 'test' and
[f2e80ac]217 not(current()/../@id='ch-tools-dejagnu') and
218 not(current()/../@id='ch-system-systemd')]"/>
[f0a31de]219 <xsl:if
[49f8b03]220 test="ancestor::chapter[@id = 'chapter-building-system' or
221 @id = 'chapter-config' or
[f017b22]222 @id = 'chapter-bootscripts' or
[49f8b03]223 @id = 'chapter-bootable'] and
[f0a31de]224 $pkgmngt = 'y' and
225 descendant::screen[not(@role) or
226 @role != 'nodump']/userinput[
227 @remap='install']">
[945ccaa]228 <xsl:choose>
229 <xsl:when test="$wrap-install='y'">
230 <xsl:text>wrapInstall '
231</xsl:text>
232 </xsl:when>
233 <xsl:otherwise>
[adbd09b]234<!-- We cannot know which directory(ies) are needed by the package. Create a
[55e82d2]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}
[adbd09b]239mkdir -pv $PKG_DEST/usr/{bin,include,lib/pkgconfig,sbin}
[2758d94]240mkdir -pv $PKG_DEST/usr/share/{doc,info,bash-completion/completions}
[7072e1f]241mkdir -pv $PKG_DEST/usr/share/man/man{1..8}
242case $(uname -m) in
[adbd09b]243 x86_64) mkdir -v $PKG_DEST/lib64 ;;
[7072e1f]244esac
[55e82d2]245ln -sv usr/sbin $PKG_DEST
246ln -sv usr/bin $PKG_DEST
247ln -sv usr/lib $PKG_DEST
[7072e1f]248</xsl:text>
[945ccaa]249 </xsl:otherwise>
250 </xsl:choose>
[f0a31de]251 </xsl:if>
252 <xsl:apply-templates
[13e52a5]253 select=".//screen[not(@role) or @role != 'nodump']/
254 userinput[@remap = 'install']"/>
[49f8b03]255 <xsl:if test="ancestor::chapter[@id = 'chapter-building-system' or
256 @id = 'chapter-config' or
[f017b22]257 @id = 'chapter-bootscripts' or
[49f8b03]258 @id = 'chapter-bootable'] and
[f0a31de]259 descendant::screen[not(@role) or
260 @role != 'nodump']/userinput[
261 @remap='install']">
[945ccaa]262 <xsl:choose>
[dc7fd7b]263 <xsl:when test="$pkgmngt='n'"/>
[945ccaa]264 <xsl:when test="$wrap-install='y'">
265 <xsl:if test="../@id = 'ch-system-man-pages'">
[560bef1]266<!-- these files are provided by the shadow package -->
[945ccaa]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>'
[9bbb9c8]277PREV_SEC=${SECONDS}
[945ccaa]278packInstall
[9bbb9c8]279SECONDS=${PREV_SEC}
[945ccaa]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}
[a983256]286</xsl:text>
[945ccaa]287 </xsl:if>
[a983256]288<!-- nologin is installed by util-linux. remove it from shadow -->
[945ccaa]289 <xsl:if test="../@id = 'ch-system-shadow'">
290 <xsl:text>rm -fv $PKG_DEST/usr/share/man/man8/nologin.8
[a983256]291rm -fv $PKG_DEST/sbin/nologin
[7072e1f]292</xsl:text>
[945ccaa]293 </xsl:if>
[55e82d2]294<!-- remove empty directories and symlinks-->
[adbd09b]295 <xsl:text>for dir in $PKG_DEST/usr/share/man/man{1..8} \
[2758d94]296 $PKG_DEST/usr/share/bash-completion{/completions,} \
297 $PKG_DEST/usr/share/{doc,info,man,} \
[adbd09b]298 $PKG_DEST/usr/lib/pkgconfig \
299 $PKG_DEST/usr/{lib,bin,sbin,include} \
[55e82d2]300 $PKG_DEST/{boot,etc}; do
[adbd09b]301 [ -d "$dir" ] &amp;&amp; [ -z "$(ls $dir)" ] &amp;&amp; rmdir -v $dir
[7072e1f]302done
[adbd09b]303[ -d $PKG_DEST/lib64 ] &amp;&amp; [ -z "$(ls $PKG_DEST/lib64)" ] &amp;&amp;
304 rmdir -v $PKG_DEST/lib64
[55e82d2]305rm -v $PKG_DEST/{lib,bin,sbin}
[46c6113]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
[9bbb9c8]312PREV_SEC=${SECONDS}
[7072e1f]313packInstall
[9bbb9c8]314SECONDS=${PREV_SEC}
[7072e1f]315rm -rf $PKG_DEST
316</xsl:text>
[945ccaa]317 </xsl:otherwise>
318 </xsl:choose>
[f0a31de]319 </xsl:if>
320 <xsl:if test="../@id='ch-system-glibc' and @role='installation'">
321 <xsl:choose>
322 <xsl:when test="$full-locale='y'">
[cfdb089]323 <xsl:for-each select="//userinput[@remap='locale-full']">
324 <xsl:copy-of select="."/>
325 <xsl:text>&#xA;</xsl:text>
326 </xsl:for-each>
[f0a31de]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
[b339c94]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>
[f0a31de]341 </xsl:if>
342 </xsl:otherwise>
343 </xsl:choose>
[c4cf6de]344 </xsl:if>
[f0a31de]345 <xsl:apply-templates
[13e52a5]346 select=".//screen[not(@role) or @role != 'nodump']/userinput[
[f2e80ac]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'
[13e52a5]351 ]"/>
[085435e]352 <xsl:if test="../@id='ch-system-ncurses' and $ncurses5='y'">
353 <xsl:apply-templates select=".//screen[@role='nodump']"/>
354 </xsl:if>
[557fe91]355 </xsl:template>
356
[f0a31de]357 <xsl:template match="sect1" mode="pkgmngt">
[2758d94]358 <xsl:param name="dirname" select="'chapter05'"/>
[7072e1f]359 <!-- The build order -->
[2758d94]360 <xsl:param name="order" select="'062'"/>
[7072e1f]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')"/>
[3ac3ae1]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>
[7072e1f]371 <!-- Creating dirs and files -->
[8099885]372 <xsl:if test="count(descendant::screen/userinput) &gt; 0 and
373 count(descendant::screen/userinput) &gt;
374 count(descendant::screen[@role='nodump'])">
[3ac3ae1]375 <exsl:document href="{$dirname}/{$order}-{$pos}-{$filename}"
[8099885]376 method="text">
377 <xsl:text>#!/bin/bash
[7072e1f]378set +h
379set -e
380</xsl:text>
[2758d94]381 <xsl:call-template name="start-script">
[88a8275]382 <xsl:with-param name="order" select="concat($order,'-',$pos)"/>
[2758d94]383 </xsl:call-template>
[8099885]384 <xsl:apply-templates
385 select=".//screen[not(@role) or
386 @role != 'nodump']/userinput[@remap != 'adjust']"
[7072e1f]387 mode="pkgmngt"/>
[49f8b03]388 <xsl:if test="$dirname = 'chapter06' or $dirname = 'chapter08'">
[9bbb9c8]389 <xsl:text>PREV_SEC=${SECONDS}
390packInstall
391SECONDS=${PREV_SEC}
[945ccaa]392rm -rf "$PKG_DEST"
[7072e1f]393</xsl:text>
[8099885]394 </xsl:if>
395 <xsl:apply-templates
396 select=".//screen[not(@role) or
397 @role != 'nodump'
398 ]/userinput[not(@remap) or
399 @remap='adjust'
[7072e1f]400 ]"
401 mode="pkgmngt"/>
[8099885]402 <xsl:text>
[7072e1f]403echo -e "\n\nTotalseconds: $SECONDS\n"
[2758d94]404</xsl:text>
405 <xsl:call-template name="end-script"/>
406 <xsl:text>exit
[7072e1f]407</xsl:text>
[8099885]408 </exsl:document>
409 </xsl:if>
[557fe91]410 </xsl:template>
411
[7072e1f]412 <xsl:template match="userinput" mode="pkgmngt">
413 <xsl:apply-templates/>
414 <xsl:text>&#xA;</xsl:text>
415 </xsl:template>
[2e1c1c3]416
[7072e1f]417 <xsl:template match="userinput">
[3eb60fa]418 <xsl:choose>
[fd691b4]419 <!-- Copying the kernel config file -->
420 <xsl:when test="string() = 'make mrproper'">
421 <xsl:text>make mrproper&#xA;</xsl:text>
[7072e1f]422 <xsl:if test="ancestor::sect1[@id='ch-bootable-kernel']">
[bcfb3bf]423 <xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
[3b27f93]424 <xsl:text>timeout 60 make oldconfig ||\&#xA;</xsl:text>
425 <xsl:text>{ echo kernel config is not up to date; exit 124; }&#xA;</xsl:text>
[bcfb3bf]426 </xsl:if>
[92568bf]427 </xsl:when>
[7072e1f]428<!-- test instructions -->
[1d5f3e3]429 <xsl:when test="@remap = 'test'">
[5a8939e]430 <xsl:call-template name="comment-test">
431 <xsl:with-param name="instructions" select="string()"/>
432 </xsl:call-template>
[4afcedb]433 </xsl:when>
[7072e1f]434<!-- End of test instructions -->
[dc7fd7b]435<!-- If the instructions contain "strip ", it may mean they contain also .la
436 file removal (and possibly other clean up). We therefore call a template
437 to comment them out appropriately and also to not stop if stripping
438 fails. -->
439 <xsl:when test="contains(string(),'strip ') or
440 contains(string(),'\*.la')">
441 <xsl:call-template name="comment-strip">
442 <xsl:with-param name="instructions" select="string()"/>
443 </xsl:call-template>
[1f025ca]444 </xsl:when>
[f017b22]445<!-- Package management for installation chapters -->
[7072e1f]446<!-- Add $PKG_DEST to installation commands -->
[323ae3e]447<!-- Also add -j1 to make install -->
[7072e1f]448 <xsl:when test="@remap='install' and
[f017b22]449 ancestor::chapter[@id='chapter-building-system' or
450 @id = 'chapter-config' or
451 @id = 'chapter-bootscripts' or
452 @id = 'chapter-bootable']">
[7072e1f]453 <xsl:choose>
454 <xsl:when test="$pkgmngt='n'">
455 <xsl:choose>
456 <xsl:when test="contains(string(),'firmware,udev')">
457 <xsl:text>if [[ ! -d /lib/udev/devices ]] ; then&#xA;</xsl:text>
458 <xsl:apply-templates/>
459 <xsl:text>&#xA;fi&#xA;</xsl:text>
460 </xsl:when>
[323ae3e]461 <xsl:when test="contains(string(),'make ')">
462 <xsl:copy-of select="substring-before(string(), 'make ')"/>
463 <xsl:text>make -j1 </xsl:text>
464 <xsl:copy-of select="substring-after(string(), 'make ')"/>
465 <xsl:text>&#xA;</xsl:text>
466 </xsl:when>
[7072e1f]467 <xsl:otherwise>
468 <xsl:apply-templates/>
469 <xsl:text>&#xA;</xsl:text>
470 </xsl:otherwise>
471 </xsl:choose>
472 </xsl:when>
[945ccaa]473 <xsl:when test="$wrap-install='y'">
474 <xsl:choose>
475 <xsl:when test="./literal">
476 <xsl:call-template name="output-wrap">
477 <xsl:with-param name="commands" select="text()[1]"/>
478 </xsl:call-template>
479 <xsl:apply-templates select="literal"/>
480 <xsl:call-template name="output-wrap">
481 <xsl:with-param name="commands" select="text()[2]"/>
482 </xsl:call-template>
483 </xsl:when>
484 <xsl:otherwise>
485 <xsl:call-template name="output-wrap">
486 <xsl:with-param name="commands" select="string()"/>
487 </xsl:call-template>
488 </xsl:otherwise>
489 </xsl:choose>
490 <xsl:text>&#xA;</xsl:text>
491 </xsl:when>
492 <xsl:otherwise><!--pkgmngt = 'y' and wrap-install='n'-->
[7072e1f]493 <xsl:choose>
494 <xsl:when test="./literal">
495 <xsl:call-template name="outputpkgdest">
[560bef1]496 <xsl:with-param name="outputstring" select="text()[1]"/>
[7072e1f]497 </xsl:call-template>
498 <xsl:apply-templates select="literal"/>
499 <xsl:call-template name="outputpkgdest">
[560bef1]500 <xsl:with-param name="outputstring" select="text()[2]"/>
[7072e1f]501 </xsl:call-template>
502 </xsl:when>
503 <xsl:otherwise>
504 <xsl:call-template name="outputpkgdest">
505 <xsl:with-param name="outputstring" select="string()"/>
506 </xsl:call-template>
507 </xsl:otherwise>
508 </xsl:choose>
[ad747ed]509 <xsl:text>&#xA;</xsl:text>
[7072e1f]510 </xsl:otherwise>
511 </xsl:choose>
[323ae3e]512 </xsl:when> <!-- @remap='install' and not temporary tools -->
[57ef0c1]513 <!-- if package management, we should make an independant package for
514 tzdata. -->
515 <xsl:when test="contains(string(),'tzdata') and $pkgmngt='y'">
516 <xsl:text>
[945ccaa]517OLD_PKG_DEST="$PKG_DEST"
[57ef0c1]518OLD_PKGDIR=$PKGDIR
[56d8426]519PKG_DEST=$(dirname $OLD_PKG_DEST)/001-tzdata
[57ef0c1]520PKGDIR=$(dirname $PKGDIR)/tzdata-</xsl:text>
521 <xsl:copy-of select="substring-before(
522 substring-after(string(),'tzdata'),
523 '.tar')"/>
524 <xsl:text>
525</xsl:text>
[945ccaa]526 <xsl:choose>
527 <xsl:when test="$wrap-install='n'">
528 <xsl:copy-of select="substring-before(string(),'ZONEINFO=')"/>
529 <xsl:text>ZONEINFO=$PKG_DEST</xsl:text>
530 <xsl:copy-of select="substring-after(string(),'ZONEINFO=')"/>
531 <xsl:text>
[9bbb9c8]532PREV_SEC=${SECONDS}
[57ef0c1]533packInstall
[9bbb9c8]534SECONDS=${PREV_SEC}
[57ef0c1]535rm -rf $PKG_DEST
[945ccaa]536</xsl:text>
537 </xsl:when>
538 <xsl:otherwise><!-- wrap-install='y' -->
539 <xsl:copy-of select="substring-before(string(),'ZONEINFO=')"/>
540 <xsl:text>
541wrapInstall '
542ZONEINFO=</xsl:text>
543 <xsl:copy-of select="substring-after(string(),'ZONEINFO=')"/>
544 <xsl:text>'
[9bbb9c8]545PREV_SEC=${SECONDS}
[945ccaa]546packInstall
[9bbb9c8]547SECONDS=${PREV_SEC}
[945ccaa]548</xsl:text>
549 </xsl:otherwise>
550 </xsl:choose>
551 <xsl:text>
[57ef0c1]552PKG_DEST=$OLD_PKG_DEST
553unset OLD_PKG_DEST
554PKGDIR=$OLD_PKGDIR
555unset OLD_PKGDIR
556</xsl:text>
557 </xsl:when><!-- addition for tzdata + package management -->
[7072e1f]558 <!-- End addition for package management -->
[f017b22]559 <!-- add -j1 to make install in non final chapters -->
560 <xsl:when test="ancestor::chapter[@id='chapter-temporary-tools' or
561 @id='chapter-chroot-temporary-tools' or
562 @id='chapter-cross-tools'] and
[323ae3e]563 @remap='install'">
564 <xsl:choose>
565 <xsl:when test="contains(string(),'make ')">
566 <xsl:copy-of select="substring-before(string(), 'make ')"/>
567 <xsl:text>make -j1 </xsl:text>
568 <xsl:copy-of select="substring-after(string(), 'make ')"/>
569 </xsl:when>
570 <xsl:otherwise>
571 <xsl:apply-templates/>
572 </xsl:otherwise>
573 </xsl:choose>
574 <xsl:text>&#xA;</xsl:text>
[f017b22]575 </xsl:when><!-- temp chapters install -->
[57a5e9a]576 <!-- In jhalfs chaningowner is executed AFTER userdel lfs
577 so chown \-\- from lfs errors out. -->
578 <xsl:when test="contains(string(),'--from lfs')">
579 <xsl:copy-of select="substring-before(string(), '--from lfs')"/>
580 <xsl:choose>
581 <xsl:when test="contains(substring-after(string(),'--from lfs'),
582 '--from lfs')">
583 <xsl:copy-of select="substring-before(
584 substring-after(string(),'--from lfs'),
585 '--from lfs')"/>
586 <xsl:copy-of select="substring-after(
587 substring-after(string(),'--from lfs'),
588 '--from lfs')"/>
589 </xsl:when>
590 <xsl:otherwise>
[4b80795]591 <xsl:copy-of select="substring-after(string(), '--from lfs')"/>
[57a5e9a]592 </xsl:otherwise>
593 </xsl:choose>
594 <xsl:text>&#xA;</xsl:text>
595 </xsl:when>
[fd691b4]596 <!-- The rest of commands -->
[1f025ca]597 <xsl:otherwise>
598 <xsl:apply-templates/>
[fd691b4]599 <xsl:text>&#xA;</xsl:text>
[1f025ca]600 </xsl:otherwise>
601 </xsl:choose>
602 </xsl:template>
[2e1c1c3]603
[557fe91]604 <xsl:template match="replaceable">
[a41ce58]605 <xsl:choose>
[2a54650]606 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
[877cc6a]607 <xsl:value-of select="$timezone"/>
[2a54650]608 </xsl:when>
[a41ce58]609 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
[877cc6a]610 <xsl:value-of select="$page"/>
[a41ce58]611 </xsl:when>
[81a7fb8]612 <xsl:when test="contains(string(.),'&lt;ll&gt;_&lt;CC&gt;')">
613 <xsl:value-of select="$lang"/>
614 </xsl:when>
[945ccaa]615 <xsl:when test="contains(string(.),'Domain')">
616 <xsl:value-of select="$domain"/>
617 </xsl:when>
618 <xsl:when test="contains(string(.),'primary')">
619 <xsl:value-of select="$nameserver1"/>
620 </xsl:when>
621 <xsl:when test="contains(string(.),'secondary')">
622 <xsl:value-of select="$nameserver2"/>
623 </xsl:when>
624 <xsl:when test="contains(string(.),'192.168.1.1')">
625 <xsl:value-of select="$ip"/>
626 </xsl:when>
627 <xsl:when test="contains(string(.),'192.168.0.2')">
628 <xsl:value-of select="$ip"/>
629 </xsl:when>
[f5e658d]630 <xsl:when test="contains(string(.),'eth0')">
631 <xsl:value-of select="$interface"/>
632 </xsl:when>
[945ccaa]633<!-- Only adapted to LFS-20170310 and later -->
634 <xsl:when test="contains(string(.),'HOSTNAME')">
635 <xsl:value-of select="$hostname"/>
636 </xsl:when>
637 <xsl:when test="contains(string(.),'FQDN')">
638 <xsl:value-of select="$hostname"/>
639 <xsl:text>.</xsl:text>
640 <xsl:value-of select="$domain"/>
641 </xsl:when>
642 <xsl:when test="contains(string(.),'alias')"/>
643 <xsl:when test="contains(string(.),'&lt;lfs&gt;')">
644 <xsl:value-of select="$hostname"/>
645 </xsl:when>
[1b02a9a]646 <xsl:when test="contains(string(.),'$(nproc)')">
[3c43655]647 <xsl:value-of select="$jobs"/>
[1b02a9a]648 </xsl:when>
[a41ce58]649 <xsl:otherwise>
650 <xsl:text>**EDITME</xsl:text>
651 <xsl:apply-templates/>
652 <xsl:text>EDITME**</xsl:text>
653 </xsl:otherwise>
654 </xsl:choose>
[557fe91]655 </xsl:template>
[2e1c1c3]656
[945ccaa]657 <xsl:template match="literal">
658 <xsl:choose>
659 <xsl:when test="contains(string(),'ONBOOT')">
660 <xsl:call-template name="outputnet">
661 <xsl:with-param name="netstring" select="string()"/>
662 </xsl:call-template>
663 </xsl:when>
664 <xsl:when test="contains(string(),'[Match]')">
665 <xsl:call-template name="outputsysdnet">
666 <xsl:with-param name="netstring" select="string()"/>
667 </xsl:call-template>
668 </xsl:when>
[3b43e17b]669 <xsl:when test="contains(string(),'0.0 0 0.0')">
670 <xsl:copy-of select="substring-before(string(),'LOCAL')"/>
671 <xsl:if test="$local='y'"><xsl:text>LOCAL</xsl:text></xsl:if>
672 <xsl:if test="$local='n'"><xsl:text>UTC</xsl:text></xsl:if>
673 </xsl:when>
674 <xsl:when test="contains(string(),'UTC=1')">
675 <xsl:copy-of select="substring-before(string(),'1')"/>
676 <xsl:if test="$local='y'"><xsl:text>0</xsl:text></xsl:if>
677 <xsl:if test="$local='n'"><xsl:text>1</xsl:text></xsl:if>
678 <xsl:copy-of select="substring-after(string(),'1')"/>
679 </xsl:when>
680 <xsl:when test="contains(string(),'bg_bds-')">
681 <xsl:call-template name="outputsysvconsole">
682 <xsl:with-param name="consolestring" select="string()"/>
683 </xsl:call-template>
684 </xsl:when>
685 <xsl:when test="contains(string(),'de-latin1')">
686 <xsl:call-template name="outputsysdconsole">
687 <xsl:with-param name="consolestring" select="string()"/>
688 </xsl:call-template>
689 </xsl:when>
[945ccaa]690 <xsl:otherwise>
691 <xsl:apply-templates/>
692 </xsl:otherwise>
693 </xsl:choose>
694 </xsl:template>
695
696 <xsl:template name="outputnet">
697 <xsl:param name="netstring" select="''"/>
698 <!-- We suppose that book example has the following values:
699 - interface: eth0
700 - ip: 192.168.1.2
701 - gateway: 192.168.1.1
702 - prefix: 24
703 - broadcast: 192.168.1.255
704 Change below if book changes -->
705 <xsl:choose>
706 <xsl:when test="contains($netstring,'eth0')">
707 <xsl:call-template name="outputnet">
708 <xsl:with-param name="netstring"
709 select="substring-before($netstring,'eth0')"/>
710 </xsl:call-template>
711 <xsl:value-of select="$interface"/>
712 <xsl:call-template name="outputnet">
713 <xsl:with-param name="netstring"
714 select="substring-after($netstring,'eth0')"/>
715 </xsl:call-template>
716 </xsl:when>
717 <xsl:when test="contains($netstring,'192.168.1.1')">
718 <xsl:call-template name="outputnet">
719 <xsl:with-param name="netstring"
720 select="substring-before($netstring,'192.168.1.1')"/>
721 </xsl:call-template>
722 <xsl:value-of select="$gateway"/>
723 <xsl:call-template name="outputnet">
724 <xsl:with-param name="netstring"
725 select="substring-after($netstring,'192.168.1.1')"/>
726 </xsl:call-template>
727 </xsl:when>
728 <!-- must test this before the following, because 192.168.1.255 contains
729 192.168.1.2! -->
730 <xsl:when test="contains($netstring,'192.168.1.255')">
731 <xsl:call-template name="outputnet">
732 <xsl:with-param name="netstring"
733 select="substring-before($netstring,'192.168.1.255')"/>
734 </xsl:call-template>
735 <xsl:value-of select="$broadcast"/>
736 <xsl:call-template name="outputnet">
737 <xsl:with-param name="netstring"
738 select="substring-after($netstring,'192.168.1.255')"/>
739 </xsl:call-template>
740 </xsl:when>
741 <xsl:when test="contains($netstring,'192.168.1.2')">
742 <xsl:call-template name="outputnet">
743 <xsl:with-param name="netstring"
744 select="substring-before($netstring,'192.168.1.2')"/>
745 </xsl:call-template>
746 <xsl:value-of select="$ip"/>
747 <xsl:call-template name="outputnet">
748 <xsl:with-param name="netstring"
749 select="substring-after($netstring,'192.168.1.2')"/>
750 </xsl:call-template>
751 </xsl:when>
752 <xsl:when test="contains($netstring,'24')">
753 <xsl:call-template name="outputnet">
754 <xsl:with-param name="netstring"
755 select="substring-before($netstring,'24')"/>
756 </xsl:call-template>
757 <xsl:value-of select="$prefix"/>
758 <xsl:call-template name="outputnet">
759 <xsl:with-param name="netstring"
760 select="substring-after($netstring,'24')"/>
761 </xsl:call-template>
762 </xsl:when>
763 <xsl:otherwise>
764 <xsl:value-of select="$netstring"/>
765 </xsl:otherwise>
766 </xsl:choose>
767 </xsl:template>
768
769 <xsl:template name="outputsysdnet">
770 <xsl:param name="netstring" select="''"/>
771 <!-- We suppose that book example has the following values:
[5af9ab4]772 - interface: <network-device-name>
[945ccaa]773 - ip: 192.168.0.2
774 - gateway: 192.168.0.1
775 - prefix: 24
776 - DNS: 192.168.0.1
777 - Domain: <Your Domain Name>
778 and gateway comes before DNS. Change below if book changes -->
779 <xsl:choose>
[5af9ab4]780 <xsl:when test="contains($netstring,'&lt;network-device-name&gt;')">
[945ccaa]781 <xsl:call-template name="outputsysdnet">
782 <xsl:with-param name="netstring"
[5af9ab4]783 select="substring-before($netstring,'&lt;network-device-name&gt;')"/>
[945ccaa]784 </xsl:call-template>
785 <xsl:value-of select="$interface"/>
786 <xsl:call-template name="outputsysdnet">
787 <xsl:with-param name="netstring"
[5af9ab4]788 select="substring-after($netstring,'&lt;network-device-name&gt;')"/>
[945ccaa]789 </xsl:call-template>
790 </xsl:when>
791 <xsl:when test="contains($netstring,'192.168.0.1') and
792 contains($netstring,'Gateway')">
793 <xsl:call-template name="outputsysdnet">
794 <xsl:with-param name="netstring"
795 select="substring-before($netstring,'192.168.0.1')"/>
796 </xsl:call-template>
797 <xsl:value-of select="$gateway"/>
798 <xsl:call-template name="outputsysdnet">
799 <xsl:with-param name="netstring"
800 select="substring-after($netstring,'192.168.0.1')"/>
801 </xsl:call-template>
802 </xsl:when>
803 <xsl:when test="contains($netstring,'192.168.0.1') and
804 not(contains($netstring,'Gateway'))">
805 <xsl:call-template name="outputsysdnet">
806 <xsl:with-param name="netstring"
807 select="substring-before($netstring,'192.168.0.1')"/>
808 </xsl:call-template>
809 <xsl:value-of select="$nameserver1"/>
810 <xsl:text>
811DNS=</xsl:text>
812 <xsl:value-of select="$nameserver2"/>
813 <xsl:call-template name="outputsysdnet">
814 <xsl:with-param name="netstring"
815 select="substring-after($netstring,'192.168.0.1')"/>
816 </xsl:call-template>
817 </xsl:when>
818 <xsl:when test="contains($netstring,'192.168.0.2')">
819 <xsl:call-template name="outputsysdnet">
820 <xsl:with-param name="netstring"
821 select="substring-before($netstring,'192.168.0.2')"/>
822 </xsl:call-template>
823 <xsl:value-of select="$ip"/>
824 <xsl:call-template name="outputsysdnet">
825 <xsl:with-param name="netstring"
826 select="substring-after($netstring,'192.168.0.2')"/>
827 </xsl:call-template>
828 </xsl:when>
829 <xsl:when test="contains($netstring,'24')">
830 <xsl:call-template name="outputsysdnet">
831 <xsl:with-param name="netstring"
832 select="substring-before($netstring,'24')"/>
833 </xsl:call-template>
834 <xsl:value-of select="$prefix"/>
835 <xsl:call-template name="outputsysdnet">
836 <xsl:with-param name="netstring"
837 select="substring-after($netstring,'24')"/>
838 </xsl:call-template>
839 </xsl:when>
840 <xsl:when test="contains($netstring,'&lt;Your Domain Name&gt;')">
841 <xsl:call-template name="outputsysdnet">
842 <xsl:with-param name="netstring"
843 select="substring-before($netstring,'&lt;Your Domain Name&gt;')"/>
844 </xsl:call-template>
845 <xsl:value-of select="$domain"/>
846 <xsl:call-template name="outputsysdnet">
847 <xsl:with-param name="netstring"
848 select="substring-after($netstring,'&lt;Your Domain Name&gt;')"/>
849 </xsl:call-template>
850 </xsl:when>
851 <xsl:otherwise>
852 <xsl:value-of select="$netstring"/>
[3b43e17b]853 </xsl:otherwise>
854 </xsl:choose>
855 </xsl:template>
856
857 <xsl:template name="outputsysvconsole">
858 <!-- We suppose that book example has the following values:
859 - KEYMAP: bg_bds-utf8
860 - FONT: LatArCyrHeb-16
861 Change below if book changes -->
862 <xsl:param name="consolestring" select="''"/>
863 <xsl:choose>
864 <xsl:when test="contains($consolestring,'bg_bds-utf8')">
865 <xsl:call-template name="outputsysvconsole">
866 <xsl:with-param
867 name="consolestring"
868 select="substring-before($consolestring,'bg_bds-utf8')"/>
869 </xsl:call-template>
870 <xsl:value-of select="$keymap"/>
871 <xsl:call-template name="outputsysvconsole">
872 <xsl:with-param
873 name="consolestring"
874 select="substring-after($consolestring,'bg_bds-utf8')"/>
875 </xsl:call-template>
876 </xsl:when>
877 <xsl:when test="contains($consolestring,'LatArCyrHeb-16')">
878 <xsl:call-template name="outputsysvconsole">
879 <xsl:with-param
880 name="consolestring"
881 select="substring-before($consolestring,'LatArCyrHeb-16')"/>
882 </xsl:call-template>
883 <xsl:value-of select="$font"/>
884 <xsl:text>"
[3142368]885LOGLEVEL="</xsl:text>
[3b43e17b]886 <xsl:copy-of select="$log-level"/>
887 <xsl:call-template name="outputsysvconsole">
888 <xsl:with-param
889 name="consolestring"
890 select="substring-after($consolestring,'LatArCyrHeb-16')"/>
891 </xsl:call-template>
892 </xsl:when>
893 <xsl:otherwise>
894 <xsl:copy-of select="$consolestring"/>
895 </xsl:otherwise>
896 </xsl:choose>
897 </xsl:template>
898
899 <xsl:template name="outputsysdconsole">
900 <!-- We suppose that book example has the following values:
901 - KEYMAP: de-latin1
902 - FONT: Lat2-Terminus16
903 Change below if book changes -->
904 <xsl:param name="consolestring" select="''"/>
905 <xsl:choose>
906 <xsl:when test="contains($consolestring,'de-latin1')">
907 <xsl:call-template name="outputsysdconsole">
908 <xsl:with-param
909 name="consolestring"
910 select="substring-before($consolestring,'de-latin1')"/>
911 </xsl:call-template>
912 <xsl:value-of select="$keymap"/>
913 <xsl:call-template name="outputsysdconsole">
914 <xsl:with-param
915 name="consolestring"
916 select="substring-after($consolestring,'de-latin1')"/>
917 </xsl:call-template>
918 </xsl:when>
919 <xsl:when test="contains($consolestring,'Lat2-Terminus16')">
920 <xsl:call-template name="outputsysdconsole">
921 <xsl:with-param
922 name="consolestring"
923 select="substring-before($consolestring,'Lat2-Terminus16')"/>
924 </xsl:call-template>
925 <xsl:value-of select="$font"/>
926 <xsl:call-template name="outputsysdconsole">
927 <xsl:with-param
928 name="consolestring"
929 select="substring-after($consolestring,'Lat2-Terminus16')"/>
930 </xsl:call-template>
931 </xsl:when>
932 <xsl:otherwise>
933 <xsl:copy-of select="$consolestring"/>
[945ccaa]934 </xsl:otherwise>
935 </xsl:choose>
936 </xsl:template>
937
[7072e1f]938 <xsl:template name="outputpkgdest">
939 <xsl:param name="outputstring" select="foo"/>
940 <xsl:choose>
941 <xsl:when test="contains($outputstring,'make ')">
942 <xsl:choose>
943 <xsl:when test="not(starts-with($outputstring,'make'))">
944 <xsl:call-template name="outputpkgdest">
945 <xsl:with-param name="outputstring"
946 select="substring-before($outputstring,'make')"/>
947 </xsl:call-template>
948 <xsl:call-template name="outputpkgdest">
949 <xsl:with-param
950 name="outputstring"
951 select="substring-after($outputstring,
952 substring-before($outputstring,'make'))"/>
953 </xsl:call-template>
954 </xsl:when>
955 <xsl:otherwise>
956 <xsl:choose>
957<!-- special cases (no DESTDIR) here -->
958 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
959 <xsl:text>make install_root=$PKG_DEST -j1</xsl:text>
960 <xsl:value-of
961 select="substring-before(substring-after(string(),'make'),
962 'install')"/>
963 <xsl:text>install&#xA;</xsl:text>
964 </xsl:when>
965 <xsl:when test="ancestor::sect1[@id='ch-system-bzip2']">
[323ae3e]966 <xsl:text>make -j1 PREFIX=$PKG_DEST/usr install&#xA;</xsl:text>
[7072e1f]967 </xsl:when>
968 <xsl:when test="ancestor::sect1[@id='ch-system-sysklogd']">
[323ae3e]969 <xsl:text>make -j1 BINDIR=$PKG_DEST/sbin prefix=$PKG_DEST install&#xA;</xsl:text>
[7072e1f]970 </xsl:when>
[b5d1c50]971 <xsl:when test="ancestor::sect1[@id='ch-system-iproute2'] and
972 contains($outputstring,'DOCDIR')">
973 <xsl:text>make -j1 DESTDIR=$PKG_DEST DOCDIR=</xsl:text>
974 <xsl:value-of
975 select="substring-before(substring-after(string(),'DOCDIR='),
976 'install')"/>
977 <xsl:text>install&#xA;</xsl:text>
[7072e1f]978 </xsl:when>
979 <xsl:when test="ancestor::sect1[@id='ch-system-sysvinit']">
[323ae3e]980 <xsl:text>make -j1 ROOT=$PKG_DEST</xsl:text>
[7072e1f]981 <xsl:value-of
982 select="substring-before(substring-after(string(),'make'),
983 'install')"/>
984 <xsl:text>install&#xA;</xsl:text>
985 </xsl:when>
986 <xsl:when test="ancestor::sect1[@id='ch-bootable-kernel']">
[323ae3e]987 <xsl:text>make -j1 INSTALL_MOD_PATH=$PKG_DEST</xsl:text>
[7072e1f]988 <xsl:value-of
989 select="substring-before(substring-after(string(),'make'),
990 'install')"/>
991 <xsl:text>install&#xA;</xsl:text>
992 </xsl:when>
993 <xsl:otherwise>
[323ae3e]994 <xsl:text>make -j1 DESTDIR=$PKG_DEST</xsl:text>
[e6e0c85]995 <xsl:call-template name="outputpkgdest">
[560bef1]996 <xsl:with-param
[7072e1f]997 name="outputstring"
998 select="substring-after($outputstring,'make')"/>
[560bef1]999 </xsl:call-template>
[7072e1f]1000 </xsl:otherwise>
1001 </xsl:choose>
1002 </xsl:otherwise>
1003 </xsl:choose>
1004 </xsl:when>
[1cb4c76]1005 <xsl:when test="contains($outputstring,'ninja install')">
[4696ddd]1006 <xsl:choose>
[1cb4c76]1007 <xsl:when test="not(starts-with($outputstring,'ninja install'))">
[4696ddd]1008 <xsl:call-template name="outputpkgdest">
1009 <xsl:with-param name="outputstring"
[1cb4c76]1010 select="substring-before($outputstring,'ninja install')"/>
[4696ddd]1011 </xsl:call-template>
1012 <xsl:call-template name="outputpkgdest">
1013 <xsl:with-param
1014 name="outputstring"
1015 select="substring-after($outputstring,
[1cb4c76]1016 substring-before($outputstring,'ninja install'))"/>
[4696ddd]1017 </xsl:call-template>
1018 </xsl:when>
[1cb4c76]1019 <xsl:otherwise> <!-- "ninja" is the first word and is followed by
1020 "install"-->
[4696ddd]1021 <xsl:text>DESTDIR=$PKG_DEST ninja</xsl:text>
1022 <xsl:call-template name="outputpkgdest">
1023 <xsl:with-param
1024 name="outputstring"
1025 select="substring-after($outputstring,'ninja')"/>
1026 </xsl:call-template>
1027 </xsl:otherwise>
1028 </xsl:choose>
1029 </xsl:when>
1030 <xsl:otherwise> <!-- no make nor ninja in this string -->
[7072e1f]1031 <xsl:choose>
1032 <xsl:when test="contains($outputstring,'&gt;/') and
1033 not(contains(substring-before($outputstring,'&gt;/'),' /'))">
1034 <xsl:value-of select="substring-before($outputstring,'&gt;/')"/>
1035 <xsl:text>&gt;$PKG_DEST/</xsl:text>
1036 <xsl:call-template name="outputpkgdest">
1037 <xsl:with-param name="outputstring" select="substring-after($outputstring,'&gt;/')"/>
1038 </xsl:call-template>
1039 </xsl:when>
1040 <xsl:when test="contains($outputstring,' /')">
1041 <xsl:value-of select="substring-before($outputstring,' /')"/>
1042 <xsl:text> $PKG_DEST/</xsl:text>
1043 <xsl:call-template name="outputpkgdest">
1044 <xsl:with-param name="outputstring" select="substring-after($outputstring,' /')"/>
1045 </xsl:call-template>
1046 </xsl:when>
1047 <xsl:otherwise>
1048 <xsl:value-of select="$outputstring"/>
1049 </xsl:otherwise>
1050 </xsl:choose>
1051 </xsl:otherwise>
1052 </xsl:choose>
1053 </xsl:template>
[945ccaa]1054
1055 <xsl:variable name="APOS">'</xsl:variable>
1056 <xsl:template name="output-wrap">
1057 <xsl:param name="commands" select="''"/>
1058 <xsl:choose>
1059 <xsl:when test="contains($commands,string($APOS))">
1060 <xsl:call-template name="output-wrap">
1061 <xsl:with-param name="commands"
1062 select="substring-before($commands,string($APOS))"/>
1063 </xsl:call-template>
1064 <xsl:text>'\''</xsl:text>
1065 <xsl:call-template name="output-wrap">
1066 <xsl:with-param name="commands"
1067 select="substring-after($commands,string($APOS))"/>
1068 </xsl:call-template>
1069 </xsl:when>
1070 <xsl:otherwise>
1071 <xsl:value-of select="$commands"/>
1072 </xsl:otherwise>
1073 </xsl:choose>
1074 </xsl:template>
1075
[dc7fd7b]1076 <xsl:template name="comment-strip">
1077 <xsl:param name="instructions" select="''"/>
1078 <xsl:choose>
1079 <xsl:when test="contains($instructions,'&#xA;')">
1080 <xsl:call-template name="comment-strip">
1081 <xsl:with-param name="instructions"
1082 select="substring-before($instructions,'&#xA;')"/>
1083 </xsl:call-template>
1084 <xsl:call-template name="comment-strip">
1085 <xsl:with-param name="instructions"
1086 select="substring-after($instructions,'&#xA;')"/>
1087 </xsl:call-template>
1088 </xsl:when>
1089 <xsl:when test="contains($instructions,'\*.la')">
1090 <xsl:if test="$del-la-files='n'">
1091 <xsl:text># </xsl:text>
1092 </xsl:if>
1093 <xsl:value-of select="$instructions"/>
1094 <xsl:text>&#xA;</xsl:text>
1095 </xsl:when>
1096 <xsl:when test="contains($instructions,'strip ')">
1097 <xsl:if test="$strip='n'">
1098 <xsl:text># </xsl:text>
1099 </xsl:if>
1100 <xsl:value-of select="$instructions"/>
1101 <xsl:text> || true&#xA;</xsl:text>
1102 </xsl:when>
1103 <xsl:otherwise>
1104 <xsl:value-of select="$instructions"/>
1105 <xsl:text>&#xA;</xsl:text>
1106 </xsl:otherwise>
1107 </xsl:choose>
1108 </xsl:template>
1109
[5a8939e]1110 <xsl:template name="comment-test">
1111 <xsl:param name="instructions" select="''"/>
[6caa5b8]1112 <xsl:param name="eof-seen" select="false()"/>
[5a8939e]1113 <xsl:choose>
1114 <xsl:when test="contains($instructions,'&#xA;')">
1115 <xsl:call-template name="comment-test">
1116 <xsl:with-param name="instructions"
1117 select="substring-before($instructions,'&#xA;')"/>
[6caa5b8]1118 <xsl:with-param name="eof-seen" select="$eof-seen"/>
[5a8939e]1119 </xsl:call-template>
[6caa5b8]1120 <xsl:choose>
1121 <xsl:when test="contains(substring-before($instructions,'&#xA;'),
1122 'EOF')">
1123 <xsl:call-template name="comment-test">
1124 <xsl:with-param name="instructions"
1125 select="substring-after($instructions,'&#xA;')"/>
1126 <xsl:with-param name="eof-seen" select="not($eof-seen)"/>
1127 </xsl:call-template>
1128 </xsl:when>
1129 <xsl:otherwise>
1130 <xsl:call-template name="comment-test">
1131 <xsl:with-param name="instructions"
1132 select="substring-after($instructions,'&#xA;')"/>
1133 <xsl:with-param name="eof-seen" select="$eof-seen"/>
1134 </xsl:call-template>
1135 </xsl:otherwise>
1136 </xsl:choose>
[5a8939e]1137 </xsl:when>
1138 <xsl:otherwise>
1139 <xsl:if test="$testsuite = '0' or
1140 $testsuite = '1' and
1141 not(ancestor::sect1[@id='ch-system-gcc']) and
1142 not(ancestor::sect1[@id='ch-system-glibc']) and
1143 not(ancestor::sect1[@id='ch-system-gmp']) and
1144 not(ancestor::sect1[@id='ch-system-mpfr']) and
[4c36783]1145 not(ancestor::sect1[@id='ch-system-binutils'])">
[5a8939e]1146 <xsl:text># </xsl:text>
1147 </xsl:if>
1148 <xsl:choose>
[594ff3d]1149 <xsl:when test="contains(string(), 'make -k')">
1150 <xsl:value-of select="$instructions"/>
1151 <xsl:if test="not($eof-seen)">
1152 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true</xsl:text>
1153 </xsl:if>
1154 <xsl:text>&#xA;</xsl:text>
1155 </xsl:when>
1156 <xsl:when test="contains($instructions, 'make')">
1157 <xsl:value-of select="substring-before($instructions, 'make')"/>
1158 <xsl:text>make -k</xsl:text>
1159 <xsl:value-of select="substring-after($instructions, 'make')"/>
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>
[5a8939e]1164 </xsl:when>
1165 <xsl:otherwise>
[594ff3d]1166 <xsl:value-of select="$instructions"/>
1167 <xsl:if
1168 test="not(contains($instructions, '&gt;&gt;')) and
[0e2c6bc]1169 not(contains($instructions, '&gt; /')) and
[594ff3d]1170 not($eof-seen) and
1171 substring($instructions,
1172 string-length($instructions)) != '\'">
1173 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true</xsl:text>
1174 </xsl:if>
1175 <xsl:text>&#xA;</xsl:text>
1176 </xsl:otherwise>
[5a8939e]1177 </xsl:choose>
1178 </xsl:otherwise>
1179 </xsl:choose>
1180 </xsl:template>
1181
[2758d94]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>
[5451eae]1202<!-- save the timer, so that unpacking, and du is not counted -->
1203PREV_SEC=${SECONDS}
1204 <!-- get the location of the system root -->
[1dce189]1205ROOT=</xsl:text>
1206 <xsl:choose>
[123105f]1207 <xsl:when test="starts-with(./@id, 'ch-tools') or
1208 contains (./@id, 'kernfs')">
[1dce189]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>
[5451eae]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>
[2758d94]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-->
[5451eae]1227 <xsl:copy-of select=".//sect1info/productnumber/text()"/>
1228 <xsl:text>
[2758d94]1229PKG_DEST=${SRC_DIR}/</xsl:text>
[5451eae]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 -->
[2758d94]1235PACKAGE=</xsl:text>
[5451eae]1236 <xsl:call-template name="basename">
1237 <xsl:with-param name="path" select=".//sect1info/address/text()"/>
1238 </xsl:call-template>
[49f8b03]1239 <xsl:if test = "( ../@id = 'chapter-building-system' or
[f017b22]1240 ../@id = 'chapter-config' or
1241 ../@id = 'chapter-bootscripts' or
1242 ../@id = 'chapter-bootable' or
[49f8b03]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 -->
[5451eae]1246 <xsl:text>
[2758d94]1247source ${ROOT}${SCRIPT_ROOT}/packInstall.sh
1248export -f packInstall</xsl:text>
[5451eae]1249 <xsl:if test="$wrap-install='y'">
1250 <xsl:text>
[2758d94]1251export -f wrapInstall
1252</xsl:text>
[5451eae]1253 </xsl:if>
[2758d94]1254 </xsl:if>
1255<!-- Get the build directory name and clean remnants of previous attempts -->
[5451eae]1256 <xsl:text>
[2758d94]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
[55e82d2]1262if [ -d "$PKG_DEST" ]; then rm -rf $PKG_DEST; fi
[2758d94]1263if [ -d "${PKGDIR%-*}-build" ]; then rm -rf ${PKGDIR%-*}-build; fi
[5451eae]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>
[2758d94]1271<!-- At last unpack and change directory -->
1272tar -xf $PACKAGE
1273cd $PKGDIR
[5451eae]1274</xsl:text>
1275 </xsl:if>
[078ef3c]1276 <xsl:text>
1277export MAKEFLAGS="-j</xsl:text>
[a9360e1]1278 <xsl:choose>
1279 <xsl:when test="@id='ch-tools-binutils-pass1'">
1280 <xsl:value-of select="$jobs-bp1"/>
1281 </xsl:when>
1282 <xsl:otherwise>
1283 <xsl:value-of select="$jobs"/>
1284 </xsl:otherwise>
1285 </xsl:choose>
[078ef3c]1286 <xsl:text>"
1287</xsl:text>
[5451eae]1288 <xsl:text>SECONDS=${PREV_SEC}
[2758d94]1289
1290# Start of LFS book script
1291</xsl:text>
1292 </xsl:template>
1293
1294 <xsl:template name="end-script">
1295 <xsl:text>
1296# End of LFS book script
1297
[5451eae]1298echo "KB: $(du -skx --exclude=lost+found --exclude=var/lib --exclude=$SCRIPT_ROOT $ROOT)"
1299</xsl:text>
1300 <xsl:if test="sect2[@role='installation']">
1301 <xsl:text>cd $SRC_DIR
[2758d94]1302rm -rf $PKGDIR
1303if [ -d "${PKGDIR%-*}-build" ]; then rm -rf ${PKGDIR%-*}-build; fi
1304</xsl:text>
[5451eae]1305 </xsl:if>
[2758d94]1306 </xsl:template>
1307
[557fe91]1308</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.