source: LFS/lfs.xsl@ 33a4e41

ablfs-more legacy trunk
Last change on this file since 33a4e41 was 33a4e41, checked in by DJ Lucas <dj@…>, 3 years ago

Fix package management and put back optional stripping again for backwards compatibility.

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