source: LFS/lfs.xsl@ 924a237

ablfs-more trunk
Last change on this file since 924a237 was 4c36783, checked in by Pierre Labastie <pierre.labastie@…>, 3 years ago

oRemove legacy: do not run tests in temporary tools (2)

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