source: LFS/lfs.xsl@ b8e5cad

ablfs-more legacy trunk
Last change on this file since b8e5cad was fd4a798, checked in by Pierre Labastie <pierre.labastie@…>, 3 years ago

Remove $Id$ comments, they are useless with git

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