source: LFS/lfs.xsl@ ddb0feb

ablfs-more trunk
Last change on this file since ddb0feb was 3b27f93, checked in by Pierre Labastie <pierre.labastie@…>, 14 months ago

Apply a timeout to kernel config in LFS

If the kernel-config file is not up to date (missing options or
whatever), the kernel "make" will hang, waiting for input. So
run "make oldconfig" explicitly, with a timeout.

Fixes: #1736

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