source: LFS/lfs.xsl@ 1d5f3e3

ablfs-more legacy trunk
Last change on this file since 1d5f3e3 was 1d5f3e3, checked in by Pierre Labastie <pierre@…>, 7 years ago

Always generate test instructions, and comment unwanted ones out.
Fixes ticket #1695

  • Property mode set to 100644
File size: 38.5 KB
RevLine 
[7072e1f]1<?xml version="1.0" encoding="ISO-8859-1"?>
[db181c47]2
[877cc6a]3<!-- $Id$ -->
4
[7072e1f]5<xsl:stylesheet
6 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
7 xmlns:exsl="http://exslt.org/common"
8 extension-element-prefixes="exsl"
9 version="1.0">
[557fe91]10
[945ccaa]11<!-- Parameters -->
12
[0ad3a33]13 <!-- which revision attribute to include: can only be sysv or systemd,
14 but we leave checking to the caller-->
15 <xsl:param name="revision" select="'sysv'"/>
16
[7072e1f]17 <!-- use package management ?
18 n = no, original behavior
19 y = yes, add PKG_DEST to scripts in install commands of chapter06-08
20 -->
[945ccaa]21 <xsl:param name="pkgmngt" select="'n'"/>
22
23 <!-- Package management with "porg style" ?
24 n = no, same as pkgmngt description above
25 y = yes, wrap install commands of chapter06-08 into a bash function.
26 note that pkgmngt must be 'y' in this case
27 -->
28 <xsl:param name="wrap-install" select='"n"'/>
[7072e1f]29
[31d6944]30 <!-- Run test suites?
31 0 = none
[945ccaa]32 1 = only chapter06 critical testsuites
[31d6944]33 2 = all chapter06 testsuites
[28f4756]34 3 = all chapter05 and chapter06 testsuites
35 -->
[31d6944]36 <xsl:param name="testsuite" select="1"/>
[01e51a1]37
[28f4756]38 <!-- Bomb on test suites failures?
[401f81e]39 n = no, I want to build the full system and review the logs
40 y = yes, bomb at the first test suite failure to can review the build dir
[28f4756]41 -->
[945ccaa]42 <xsl:param name="bomb-testsuite" select="'n'"/>
[28f4756]43
[7072e1f]44 <!-- Install vim-lang package? OBSOLETE should always be 'n'-->
[945ccaa]45 <xsl:param name="vim-lang" select="'n'"/>
[7072e1f]46
[877cc6a]47 <!-- Time zone -->
[945ccaa]48 <xsl:param name="timezone" select="'GMT'"/>
[7072e1f]49
[877cc6a]50 <!-- Page size -->
[945ccaa]51 <xsl:param name="page" select="'letter'"/>
[7072e1f]52
[877cc6a]53 <!-- Locale settings -->
[945ccaa]54 <xsl:param name="lang" select="'C'"/>
[b339c94]55
56 <!-- Install the whole set of locales -->
[945ccaa]57 <xsl:param name='full-locale' select='"n"'/>
[7072e1f]58
[945ccaa]59 <!-- Hostname -->
60 <xsl:param name='hostname' select='"HOSTNAME"'/>
61
62 <!-- Network parameters: interface, ip, gateway, prefix, broadcast, domain
63 and nameservers -->
64 <xsl:param name='interface' select="'eth0'"/>
65 <xsl:param name='ip' select='"10.0.2.9"'/>
66 <xsl:param name='gateway' select='"10.0.2.2"'/>
67 <xsl:param name='prefix' select='24'/>
68 <xsl:param name='broadcast' select='"10.0.2.255"'/>
69 <xsl:param name='domain' select='"lfs.org"'/>
70 <xsl:param name='nameserver1' select='"10.0.2.3"'/>
71 <xsl:param name='nameserver2' select='"8.8.8.8"'/>
72
73<!-- End parameters -->
74
[557fe91]75 <xsl:template match="/">
[0ad3a33]76 <xsl:apply-templates select="//sect1[not(@revision) or
77 @revision=$revision]"/>
[557fe91]78 </xsl:template>
[7072e1f]79
[557fe91]80 <xsl:template match="sect1">
[1814367]81<!-- Since this xsl:if tag encloses the whole template, it would
82 be much better to transpose this condition to the select part
83 of the "calling" apply-template. But that would change the numbering,
84 so that it would be difficult to compare to previous versions. So for
85 version 2.4, let us keep this -->
[7072e1f]86 <xsl:if test="(../@id='chapter-temporary-tools' or
[14eaa9f]87 ../@id='chapter-building-system' or
88 ../@id='chapter-bootscripts' or
89 ../@id='chapter-bootable') and
[1814367]90 (sect2[not(@revision) or @revision=$revision]//..|.)/
91 screen[(not(@role) or @role != 'nodump') and
92 (not(@revision) or @revision=$revision)]/
93 userinput[not(starts-with(string(),'chroot'))]">
[d68eb1b]94<!-- The last condition is a hack to allow previous versions of the
95 book where the chroot commands did not have role="nodump".
96 It only works if the chroot command is the only one on the page -->
[c4cf6de]97 <!-- The dirs names -->
98 <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
99 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
100 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
101 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
[7072e1f]102 <!-- The file names -->
103 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
104 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
105 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
106 <!-- The build order -->
107 <xsl:variable name="position" select="position()"/>
108 <xsl:variable name="order">
109 <xsl:choose>
110 <xsl:when test="string-length($position) = 1">
111 <xsl:text>00</xsl:text>
112 <xsl:value-of select="$position"/>
113 </xsl:when>
114 <xsl:when test="string-length($position) = 2">
115 <xsl:text>0</xsl:text>
116 <xsl:value-of select="$position"/>
117 </xsl:when>
118 <xsl:otherwise>
119 <xsl:value-of select="$position"/>
120 </xsl:otherwise>
121 </xsl:choose>
122 </xsl:variable>
123 <!-- Inclusion of package manager scriptlets -->
124 <xsl:if test="@id='ch-tools-stripping' and $pkgmngt='y'">
125 <xsl:apply-templates
[575bcf3]126 select="document('packageManager.xml')//sect1[contains(@id,'ch-tools')]"
[7072e1f]127 mode="pkgmngt">
[575bcf3]128 <xsl:with-param name="order" select="$order"/>
[7072e1f]129 <xsl:with-param name="dirname" select="$dirname"/>
130 </xsl:apply-templates>
131 </xsl:if>
132 <xsl:if test="@id='ch-system-strippingagain' and $pkgmngt='y'">
133 <xsl:apply-templates
[575bcf3]134 select="document('packageManager.xml')//sect1[contains(@id,'ch-system')]"
[7072e1f]135 mode="pkgmngt">
[575bcf3]136 <xsl:with-param name="order" select="$order"/>
[7072e1f]137 <xsl:with-param name="dirname" select="$dirname"/>
138 </xsl:apply-templates>
139 </xsl:if>
140 <!-- Creating dirs and files -->
141 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
142 <xsl:choose>
143 <xsl:when test="@id='ch-system-creatingdirs' or
144 @id='ch-system-createfiles' or
145 @id='ch-system-strippingagain'">
146 <xsl:text>#!/tools/bin/bash&#xA;set +h&#xA;</xsl:text>
147 </xsl:when>
148 <xsl:otherwise>
149 <xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
150 </xsl:otherwise>
151 </xsl:choose>
152 <xsl:if test="not(@id='ch-tools-stripping') and
153 not(@id='ch-system-strippingagain')">
154 <xsl:text>set -e&#xA;</xsl:text>
155 </xsl:if>
156 <xsl:text>&#xA;</xsl:text>
157 <xsl:if test="sect2[@role='installation']">
158 <xsl:text>cd $PKGDIR&#xA;</xsl:text>
159 </xsl:if>
[0ad3a33]160 <xsl:apply-templates select="sect2[not(@revision) or
161 @revision=$revision] |
162 screen[(not(@role) or
163 @role!='nodump') and
164 (not(@revision) or
165 @revision=$revision)]/userinput"/>
[e6e0c85]166 <xsl:if test="@id='ch-system-creatingdirs' and $pkgmngt='y'">
[f0a31de]167 <xsl:apply-templates
168 select="document('packageManager.xml')//sect1[
169 @id='ch-pkgmngt-creatingdirs'
[e6e0c85]170 ]//userinput"
171 mode="pkgmngt"/>
[f0a31de]172 </xsl:if>
[e6e0c85]173 <xsl:if test="@id='ch-system-createfiles' and $pkgmngt='y'">
[f0a31de]174 <xsl:apply-templates
175 select="document('packageManager.xml')//sect1[
176 @id='ch-pkgmngt-createfiles'
[e6e0c85]177 ]//userinput"
178 mode="pkgmngt"/>
[f0a31de]179 </xsl:if>
[d68eb1b]180 <xsl:text>echo -e "\n\nTotalseconds: $SECONDS\n"&#xA;</xsl:text>
[f0a31de]181 <xsl:text>exit&#xA;</xsl:text>
182 </exsl:document>
183 </xsl:if>
184 </xsl:template>
185
186 <xsl:template match="sect2">
187 <xsl:apply-templates
[0ad3a33]188 select=".//screen[(not(@role) or
189 @role != 'nodump') and
190 (not(@revision) or
191 @revision=$revision)]/userinput[
[f0a31de]192 @remap = 'pre' or
193 @remap = 'configure' or
194 @remap = 'make' or
195 @remap = 'test' and
[f2e80ac]196 not(current()/../@id='ch-tools-dejagnu') and
197 not(current()/../@id='ch-system-systemd')]"/>
[f0a31de]198 <xsl:if
199 test="ancestor::chapter[@id != 'chapter-temporary-tools'] and
200 $pkgmngt = 'y' and
201 descendant::screen[not(@role) or
202 @role != 'nodump']/userinput[
203 @remap='install']">
[945ccaa]204 <xsl:choose>
205 <xsl:when test="$wrap-install='y'">
206 <xsl:text>wrapInstall '
207</xsl:text>
208 </xsl:when>
209 <xsl:otherwise>
210 <xsl:text>mkdir -pv $PKG_DEST/{boot,etc,lib,bin,sbin}
[7072e1f]211mkdir -pv $PKG_DEST/usr/{lib,bin,sbin,include}
212mkdir -pv $PKG_DEST/usr/share/{doc,info,man}
213mkdir -pv $PKG_DEST/usr/share/man/man{1..8}
214ln -sv share/{man,doc,info} $PKG_DEST/usr
215case $(uname -m) in
216 x86_64) ln -sv lib $PKG_DEST/lib64 &amp;&amp; ln -sv lib $PKG_DEST/usr/lib64 ;;
217esac
218</xsl:text>
[945ccaa]219 </xsl:otherwise>
220 </xsl:choose>
[f0a31de]221 </xsl:if>
222 <xsl:if test="../@id = 'ch-system-glibc' and
[90f304c]223 @role='installation' and
[945ccaa]224 $pkgmngt = 'y' and
225 $wrap-install = 'n'">
[f0a31de]226 <xsl:text>mkdir -pv $PKG_DEST/usr/include/{rpc,rpcsvc}
[7072e1f]227</xsl:text>
[f0a31de]228 </xsl:if>
229 <xsl:apply-templates
[0ad3a33]230 select=".//screen[(not(@role) or
231 @role != 'nodump') and
232 (not(@revision) or
233 @revision=$revision)]/userinput[@remap = 'install']"/>
[f0a31de]234 <xsl:if test="ancestor::chapter[@id != 'chapter-temporary-tools'] and
235 $pkgmngt = 'y' and
236 descendant::screen[not(@role) or
237 @role != 'nodump']/userinput[
238 @remap='install']">
[945ccaa]239 <xsl:choose>
240 <xsl:when test="$wrap-install='y'">
241 <xsl:if test="../@id = 'ch-system-man-pages'">
[560bef1]242<!-- these files are provided by the shadow package -->
[945ccaa]243 <xsl:text>rm -fv /usr/share/man/{man3/getspnam.3,man5/passwd.5}
[560bef1]244</xsl:text>
[945ccaa]245 </xsl:if>
[560bef1]246<!-- Attr man/man2 pages are already installed by man-pages. As of
[00313dd]247 March 2013, they are the same pages.
248 November 2015: now they are more accurate
249 in man-pages, and the man5 section is also in man-pages... -->
[945ccaa]250 <xsl:if test="../@id = 'ch-system-attr'">
251 <xsl:text>rm -fv /usr/share/man/man2/*
252rm -fv /usr/share/man/man5/*
253</xsl:text>
254 </xsl:if>
255<!-- nologin is installed by util-linux. remove it from shadow -->
256 <xsl:if test="../@id = 'ch-system-shadow'">
257 <xsl:text>rm -fv /usr/share/man/man8/nologin.8
258rm -fv /sbin/nologin
259</xsl:text>
260 </xsl:if>
261 <xsl:text>'
[9bbb9c8]262PREV_SEC=${SECONDS}
[945ccaa]263packInstall
[9bbb9c8]264SECONDS=${PREV_SEC}
[945ccaa]265</xsl:text>
266 </xsl:when>
267 <xsl:otherwise>
268 <xsl:if test="../@id = 'ch-system-man-pages'">
269<!-- these files are provided by the shadow package -->
270 <xsl:text>rm -fv $PKG_DEST/usr/share/man/{man3/getspnam.3,man5/passwd.5}
271</xsl:text>
272 </xsl:if>
273<!-- Attr man/man2 pages are already installed by man-pages. As of
274 March 2013, they are the same pages.
275 November 2015: now they are more accurate
276 in man-pages, and the man5 section is also in man-pages... -->
277 <xsl:if test="../@id = 'ch-system-attr'">
278 <xsl:text>rm -fv $PKG_DEST/usr/share/man/man2/*
[00313dd]279rm -fv $PKG_DEST/usr/share/man/man5/*
[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>
288 <xsl:text>rm -fv $PKG_DEST/{,usr/}lib64
[7072e1f]289rm -fv $PKG_DEST/usr/{man,doc,info}
290for dir in $PKG_DEST/usr/share/man/man{1..8}; do
291 [[ -z $(ls $dir) ]] &amp;&amp; rmdir -v $dir
292done
293for dir in $PKG_DEST/usr/share/{doc,info,man}; do
294 [[ -z $(ls $dir) ]] &amp;&amp; rmdir -v $dir
295done
296for dir in $PKG_DEST/usr/{lib,bin,sbin,include}; do
297 [[ -z $(ls $dir) ]] &amp;&amp; rmdir -v $dir
298done
299for dir in $PKG_DEST/{boot,etc,lib,bin,sbin}; do
300 [[ -z $(ls $dir) ]] &amp;&amp; rmdir -v $dir
301done
[9bbb9c8]302PREV_SEC=${SECONDS}
[7072e1f]303packInstall
[9bbb9c8]304SECONDS=${PREV_SEC}
[7072e1f]305rm -rf $PKG_DEST
306</xsl:text>
[945ccaa]307 </xsl:otherwise>
308 </xsl:choose>
[f0a31de]309 </xsl:if>
310 <xsl:if test="$testsuite='3' and
311 ../@id='ch-tools-glibc' and
312 @role='installation'">
313 <xsl:copy-of select="//userinput[@remap='locale-test']"/>
314 <xsl:text>&#xA;</xsl:text>
315 </xsl:if>
316 <xsl:if test="../@id='ch-system-glibc' and @role='installation'">
317 <xsl:choose>
318 <xsl:when test="$full-locale='y'">
319 <xsl:copy-of select="//userinput[@remap='locale-full']"/>
320 <xsl:text>&#xA;</xsl:text>
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
340 select=".//screen[
[0ad3a33]341 (not(@role) or
342 @role != 'nodump') and
343 (not(@revision) or
344 @revision=$revision)
[f0a31de]345 ]/userinput[
[f2e80ac]346 not(@remap) or
347 @remap='adjust' or
348 @remap='test' and current()/../@id='ch-tools-dejagnu' or
349 @remap='test' and current()/../@id='ch-system-systemd'
[f0a31de]350 ]"/>
[557fe91]351 </xsl:template>
352
[f0a31de]353 <xsl:template match="sect1" mode="pkgmngt">
[7072e1f]354 <xsl:param name="dirname" select="chapter05"/>
355 <!-- The build order -->
[575bcf3]356 <xsl:param name="order" select="062"/>
[7072e1f]357<!-- The file names -->
358 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
359 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
360 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
361 <!-- Creating dirs and files -->
[8099885]362 <xsl:if test="count(descendant::screen/userinput) &gt; 0 and
363 count(descendant::screen/userinput) &gt;
364 count(descendant::screen[@role='nodump'])">
365 <exsl:document href="{$dirname}/{$order}-{position()}-{$filename}"
366 method="text">
367 <xsl:text>#!/bin/bash
[7072e1f]368set +h
369set -e
370
371cd $PKGDIR
372</xsl:text>
[8099885]373 <xsl:apply-templates
374 select=".//screen[not(@role) or
375 @role != 'nodump']/userinput[@remap != 'adjust']"
[7072e1f]376 mode="pkgmngt"/>
[8099885]377 <xsl:if test="$dirname = 'chapter06'">
[9bbb9c8]378 <xsl:text>PREV_SEC=${SECONDS}
379packInstall
380SECONDS=${PREV_SEC}
[945ccaa]381rm -rf "$PKG_DEST"
[7072e1f]382</xsl:text>
[8099885]383 </xsl:if>
384 <xsl:apply-templates
385 select=".//screen[not(@role) or
386 @role != 'nodump'
387 ]/userinput[not(@remap) or
388 @remap='adjust'
[7072e1f]389 ]"
390 mode="pkgmngt"/>
[8099885]391 <xsl:text>
[7072e1f]392echo -e "\n\nTotalseconds: $SECONDS\n"
393exit
394</xsl:text>
[8099885]395 </exsl:document>
396 </xsl:if>
[557fe91]397 </xsl:template>
398
[7072e1f]399 <xsl:template match="userinput" mode="pkgmngt">
400 <xsl:apply-templates/>
401 <xsl:text>&#xA;</xsl:text>
402 </xsl:template>
403
404 <xsl:template match="userinput">
[3eb60fa]405 <xsl:choose>
[fd691b4]406 <!-- Copying the kernel config file -->
407 <xsl:when test="string() = 'make mrproper'">
408 <xsl:text>make mrproper&#xA;</xsl:text>
[7072e1f]409 <xsl:if test="ancestor::sect1[@id='ch-bootable-kernel']">
[bcfb3bf]410 <xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
411 </xsl:if>
[92568bf]412 </xsl:when>
[7072e1f]413<!-- test instructions -->
[1d5f3e3]414 <xsl:when test="@remap = 'test'">
415 <xsl:if test="$testsuite = '0' or
416 $testsuite = '1' and
[4afcedb]417 not(ancestor::sect1[@id='ch-system-gcc']) and
418 not(ancestor::sect1[@id='ch-system-glibc']) and
[7072e1f]419 not(ancestor::sect1[@id='ch-system-gmp']) and
420 not(ancestor::sect1[@id='ch-system-mpfr']) and
[1d5f3e3]421 not(ancestor::sect1[@id='ch-system-binutils']) or
422 $testsuite = '2' and
423 ancestor::chapter[@id='chapter-temporary-tools']">
424 <xsl:text># </xsl:text>
425 </xsl:if>
426 <xsl:choose>
427 <xsl:when test="$bomb-testsuite = 'n'">
428 <xsl:choose>
429 <!-- special case for glibc -->
430 <xsl:when test="contains(string(), 'glibc-check-log')">
431 <xsl:value-of
432 select="substring-before(string(),'2&gt;&amp;1')"/>
433 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
434 </xsl:when>
435 <!-- special case for procps-ng -->
436 <xsl:when test="contains(string(), 'pushd')">
437 <xsl:text>{ </xsl:text>
438 <xsl:apply-templates/>
439 <xsl:text>; } &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
440 </xsl:when>
441 <xsl:when test="contains(string(), 'make -k')">
442 <xsl:apply-templates/>
443 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
444 </xsl:when>
445 <xsl:when test="contains(string(), 'make')">
446 <xsl:value-of select="substring-before(string(),'make')"/>
447 <xsl:text>make -k</xsl:text>
448 <xsl:value-of select="substring-after(string(),'make')"/>
449 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
450 </xsl:when>
451 <xsl:otherwise>
452 <xsl:apply-templates/>
453 <xsl:if test="not(contains(string(), '&gt;&gt;'))">
454 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
455 </xsl:if>
456 <xsl:text>&#xA;</xsl:text>
457 </xsl:otherwise>
458 </xsl:choose>
459 </xsl:when>
[4afcedb]460 <xsl:otherwise>
[1d5f3e3]461 <!-- bomb-testsuite != 'n'-->
[4afcedb]462 <xsl:choose>
[1d5f3e3]463 <!-- special case for glibc -->
464 <xsl:when test="contains(string(), 'glibc-check-log')">
465 <xsl:value-of
466 select="substring-before(string(),'2&gt;&amp;1')"/>
467 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
468 </xsl:when>
469 <!-- special case for gmp -->
470 <xsl:when test="contains(string(), 'tee gmp-check-log')">
471 <xsl:text>(</xsl:text>
472 <xsl:apply-templates/>
473 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 &amp;&amp; exit $PIPESTATUS)&#xA;</xsl:text>
474 </xsl:when>
475 <!-- special case for procps-ng -->
476 <xsl:when test="contains(string(), 'pushd')">
477 <xsl:text>{ </xsl:text>
478 <xsl:apply-templates/>
479 <xsl:text>; } &gt;&gt; $TEST_LOG 2&gt;&amp;1&#xA;</xsl:text>
480 </xsl:when>
481 <xsl:when test="contains(string(), 'make -k')">
482 <xsl:apply-templates/>
483 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
[4afcedb]484 </xsl:when>
485 <xsl:otherwise>
[1d5f3e3]486 <xsl:apply-templates/>
487 <xsl:if test="not(contains(string(), '&gt;&gt;'))">
488 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
489 </xsl:if>
490 <xsl:text>&#xA;</xsl:text>
[4afcedb]491 </xsl:otherwise>
492 </xsl:choose>
[1d5f3e3]493 </xsl:otherwise> <!-- end not bomb-test=n -->
[4afcedb]494 </xsl:choose>
495 </xsl:when>
[7072e1f]496<!-- End of test instructions -->
[fd691b4]497 <!-- Don't stop on strip run -->
498 <xsl:when test="contains(string(),'strip ')">
[3eb60fa]499 <xsl:apply-templates/>
[fd691b4]500 <xsl:text> || true&#xA;</xsl:text>
[1f025ca]501 </xsl:when>
[7072e1f]502<!-- Package management -->
503<!-- Add $PKG_DEST to installation commands -->
504 <xsl:when test="@remap='install' and
505 not(ancestor::chapter[
506 @id='chapter-temporary-tools'
507 ])">
508 <xsl:choose>
509 <xsl:when test="$pkgmngt='n'">
510 <xsl:choose>
511 <xsl:when test="contains(string(),'firmware,udev')">
512 <xsl:text>if [[ ! -d /lib/udev/devices ]] ; then&#xA;</xsl:text>
513 <xsl:apply-templates/>
514 <xsl:text>&#xA;fi&#xA;</xsl:text>
515 </xsl:when>
516 <xsl:otherwise>
517 <xsl:apply-templates/>
518 <xsl:text>&#xA;</xsl:text>
519 </xsl:otherwise>
520 </xsl:choose>
521 </xsl:when>
[945ccaa]522 <xsl:when test="$wrap-install='y'">
523 <xsl:choose>
524 <xsl:when test="./literal">
525 <xsl:call-template name="output-wrap">
526 <xsl:with-param name="commands" select="text()[1]"/>
527 </xsl:call-template>
528 <xsl:apply-templates select="literal"/>
529 <xsl:call-template name="output-wrap">
530 <xsl:with-param name="commands" select="text()[2]"/>
531 </xsl:call-template>
532 </xsl:when>
533 <xsl:otherwise>
534 <xsl:call-template name="output-wrap">
535 <xsl:with-param name="commands" select="string()"/>
536 </xsl:call-template>
537 </xsl:otherwise>
538 </xsl:choose>
539 <xsl:text>&#xA;</xsl:text>
540 </xsl:when>
541 <xsl:otherwise><!--pkgmngt = 'y' and wrap-install='n'-->
[7072e1f]542 <xsl:choose>
543 <xsl:when test="./literal">
544 <xsl:call-template name="outputpkgdest">
[560bef1]545 <xsl:with-param name="outputstring" select="text()[1]"/>
[7072e1f]546 </xsl:call-template>
547 <xsl:apply-templates select="literal"/>
548 <xsl:call-template name="outputpkgdest">
[560bef1]549 <xsl:with-param name="outputstring" select="text()[2]"/>
[7072e1f]550 </xsl:call-template>
551 </xsl:when>
552 <xsl:otherwise>
553 <xsl:call-template name="outputpkgdest">
554 <xsl:with-param name="outputstring" select="string()"/>
555 </xsl:call-template>
556 </xsl:otherwise>
557 </xsl:choose>
558 </xsl:otherwise>
559 </xsl:choose>
560 </xsl:when>
[57ef0c1]561 <!-- if package management, we should make an independant package for
562 tzdata. -->
563 <xsl:when test="contains(string(),'tzdata') and $pkgmngt='y'">
564 <xsl:text>
[945ccaa]565OLD_PKG_DEST="$PKG_DEST"
[57ef0c1]566OLD_PKGDIR=$PKGDIR
[56d8426]567PKG_DEST=$(dirname $OLD_PKG_DEST)/001-tzdata
[57ef0c1]568PKGDIR=$(dirname $PKGDIR)/tzdata-</xsl:text>
569 <xsl:copy-of select="substring-before(
570 substring-after(string(),'tzdata'),
571 '.tar')"/>
572 <xsl:text>
573</xsl:text>
[945ccaa]574 <xsl:choose>
575 <xsl:when test="$wrap-install='n'">
576 <xsl:copy-of select="substring-before(string(),'ZONEINFO=')"/>
577 <xsl:text>ZONEINFO=$PKG_DEST</xsl:text>
578 <xsl:copy-of select="substring-after(string(),'ZONEINFO=')"/>
579 <xsl:text>
[9bbb9c8]580PREV_SEC=${SECONDS}
[57ef0c1]581packInstall
[9bbb9c8]582SECONDS=${PREV_SEC}
[57ef0c1]583rm -rf $PKG_DEST
[945ccaa]584</xsl:text>
585 </xsl:when>
586 <xsl:otherwise><!-- wrap-install='y' -->
587 <xsl:copy-of select="substring-before(string(),'ZONEINFO=')"/>
588 <xsl:text>
589wrapInstall '
590ZONEINFO=</xsl:text>
591 <xsl:copy-of select="substring-after(string(),'ZONEINFO=')"/>
592 <xsl:text>'
[9bbb9c8]593PREV_SEC=${SECONDS}
[945ccaa]594packInstall
[9bbb9c8]595SECONDS=${PREV_SEC}
[945ccaa]596</xsl:text>
597 </xsl:otherwise>
598 </xsl:choose>
599 <xsl:text>
[57ef0c1]600PKG_DEST=$OLD_PKG_DEST
601unset OLD_PKG_DEST
602PKGDIR=$OLD_PKGDIR
603unset OLD_PKGDIR
604</xsl:text>
605 </xsl:when><!-- addition for tzdata + package management -->
[7072e1f]606 <!-- End addition for package management -->
[fd691b4]607 <!-- The rest of commands -->
[1f025ca]608 <xsl:otherwise>
609 <xsl:apply-templates/>
[fd691b4]610 <xsl:text>&#xA;</xsl:text>
[1f025ca]611 </xsl:otherwise>
612 </xsl:choose>
613 </xsl:template>
[7072e1f]614
[557fe91]615 <xsl:template match="replaceable">
[a41ce58]616 <xsl:choose>
[2a54650]617 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
[877cc6a]618 <xsl:value-of select="$timezone"/>
[2a54650]619 </xsl:when>
[a41ce58]620 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
[877cc6a]621 <xsl:value-of select="$page"/>
[a41ce58]622 </xsl:when>
[81a7fb8]623 <xsl:when test="contains(string(.),'&lt;ll&gt;_&lt;CC&gt;')">
624 <xsl:value-of select="$lang"/>
625 </xsl:when>
[945ccaa]626 <xsl:when test="contains(string(.),'Domain')">
627 <xsl:value-of select="$domain"/>
628 </xsl:when>
629 <xsl:when test="contains(string(.),'primary')">
630 <xsl:value-of select="$nameserver1"/>
631 </xsl:when>
632 <xsl:when test="contains(string(.),'secondary')">
633 <xsl:value-of select="$nameserver2"/>
634 </xsl:when>
635 <xsl:when test="contains(string(.),'192.168.1.1')">
636 <xsl:value-of select="$ip"/>
637 </xsl:when>
638 <xsl:when test="contains(string(.),'192.168.0.2')">
639 <xsl:value-of select="$ip"/>
640 </xsl:when>
641<!-- Only adapted to LFS-20170310 and later -->
642 <xsl:when test="contains(string(.),'HOSTNAME')">
643 <xsl:value-of select="$hostname"/>
644 </xsl:when>
645 <xsl:when test="contains(string(.),'FQDN')">
646 <xsl:value-of select="$hostname"/>
647 <xsl:text>.</xsl:text>
648 <xsl:value-of select="$domain"/>
649 </xsl:when>
650 <xsl:when test="contains(string(.),'alias')"/>
651 <xsl:when test="contains(string(.),'&lt;lfs&gt;')">
652 <xsl:value-of select="$hostname"/>
653 </xsl:when>
[a41ce58]654 <xsl:otherwise>
655 <xsl:text>**EDITME</xsl:text>
656 <xsl:apply-templates/>
657 <xsl:text>EDITME**</xsl:text>
658 </xsl:otherwise>
659 </xsl:choose>
[557fe91]660 </xsl:template>
[7072e1f]661
[945ccaa]662 <xsl:template match="literal">
663 <xsl:choose>
664 <xsl:when test="contains(string(),'ONBOOT')">
665 <xsl:call-template name="outputnet">
666 <xsl:with-param name="netstring" select="string()"/>
667 </xsl:call-template>
668 </xsl:when>
669 <xsl:when test="contains(string(),'[Match]')">
670 <xsl:call-template name="outputsysdnet">
671 <xsl:with-param name="netstring" select="string()"/>
672 </xsl:call-template>
673 </xsl:when>
674 <xsl:otherwise>
675 <xsl:apply-templates/>
676 </xsl:otherwise>
677 </xsl:choose>
678 </xsl:template>
679
680 <xsl:template name="outputnet">
681 <xsl:param name="netstring" select="''"/>
682 <!-- We suppose that book example has the following values:
683 - interface: eth0
684 - ip: 192.168.1.2
685 - gateway: 192.168.1.1
686 - prefix: 24
687 - broadcast: 192.168.1.255
688 Change below if book changes -->
689 <xsl:choose>
690 <xsl:when test="contains($netstring,'eth0')">
691 <xsl:call-template name="outputnet">
692 <xsl:with-param name="netstring"
693 select="substring-before($netstring,'eth0')"/>
694 </xsl:call-template>
695 <xsl:value-of select="$interface"/>
696 <xsl:call-template name="outputnet">
697 <xsl:with-param name="netstring"
698 select="substring-after($netstring,'eth0')"/>
699 </xsl:call-template>
700 </xsl:when>
701 <xsl:when test="contains($netstring,'192.168.1.1')">
702 <xsl:call-template name="outputnet">
703 <xsl:with-param name="netstring"
704 select="substring-before($netstring,'192.168.1.1')"/>
705 </xsl:call-template>
706 <xsl:value-of select="$gateway"/>
707 <xsl:call-template name="outputnet">
708 <xsl:with-param name="netstring"
709 select="substring-after($netstring,'192.168.1.1')"/>
710 </xsl:call-template>
711 </xsl:when>
712 <!-- must test this before the following, because 192.168.1.255 contains
713 192.168.1.2! -->
714 <xsl:when test="contains($netstring,'192.168.1.255')">
715 <xsl:call-template name="outputnet">
716 <xsl:with-param name="netstring"
717 select="substring-before($netstring,'192.168.1.255')"/>
718 </xsl:call-template>
719 <xsl:value-of select="$broadcast"/>
720 <xsl:call-template name="outputnet">
721 <xsl:with-param name="netstring"
722 select="substring-after($netstring,'192.168.1.255')"/>
723 </xsl:call-template>
724 </xsl:when>
725 <xsl:when test="contains($netstring,'192.168.1.2')">
726 <xsl:call-template name="outputnet">
727 <xsl:with-param name="netstring"
728 select="substring-before($netstring,'192.168.1.2')"/>
729 </xsl:call-template>
730 <xsl:value-of select="$ip"/>
731 <xsl:call-template name="outputnet">
732 <xsl:with-param name="netstring"
733 select="substring-after($netstring,'192.168.1.2')"/>
734 </xsl:call-template>
735 </xsl:when>
736 <xsl:when test="contains($netstring,'24')">
737 <xsl:call-template name="outputnet">
738 <xsl:with-param name="netstring"
739 select="substring-before($netstring,'24')"/>
740 </xsl:call-template>
741 <xsl:value-of select="$prefix"/>
742 <xsl:call-template name="outputnet">
743 <xsl:with-param name="netstring"
744 select="substring-after($netstring,'24')"/>
745 </xsl:call-template>
746 </xsl:when>
747 <xsl:otherwise>
748 <xsl:value-of select="$netstring"/>
749 </xsl:otherwise>
750 </xsl:choose>
751 </xsl:template>
752
753 <xsl:template name="outputsysdnet">
754 <xsl:param name="netstring" select="''"/>
755 <!-- We suppose that book example has the following values:
756 - interface: eth0
757 - ip: 192.168.0.2
758 - gateway: 192.168.0.1
759 - prefix: 24
760 - DNS: 192.168.0.1
761 - Domain: <Your Domain Name>
762 and gateway comes before DNS. Change below if book changes -->
763 <xsl:choose>
764 <xsl:when test="contains($netstring,'eth0')">
765 <xsl:call-template name="outputsysdnet">
766 <xsl:with-param name="netstring"
767 select="substring-before($netstring,'eth0')"/>
768 </xsl:call-template>
769 <xsl:value-of select="$interface"/>
770 <xsl:call-template name="outputsysdnet">
771 <xsl:with-param name="netstring"
772 select="substring-after($netstring,'eth0')"/>
773 </xsl:call-template>
774 </xsl:when>
775 <xsl:when test="contains($netstring,'192.168.0.1') and
776 contains($netstring,'Gateway')">
777 <xsl:call-template name="outputsysdnet">
778 <xsl:with-param name="netstring"
779 select="substring-before($netstring,'192.168.0.1')"/>
780 </xsl:call-template>
781 <xsl:value-of select="$gateway"/>
782 <xsl:call-template name="outputsysdnet">
783 <xsl:with-param name="netstring"
784 select="substring-after($netstring,'192.168.0.1')"/>
785 </xsl:call-template>
786 </xsl:when>
787 <xsl:when test="contains($netstring,'192.168.0.1') and
788 not(contains($netstring,'Gateway'))">
789 <xsl:call-template name="outputsysdnet">
790 <xsl:with-param name="netstring"
791 select="substring-before($netstring,'192.168.0.1')"/>
792 </xsl:call-template>
793 <xsl:value-of select="$nameserver1"/>
794 <xsl:text>
795DNS=</xsl:text>
796 <xsl:value-of select="$nameserver2"/>
797 <xsl:call-template name="outputsysdnet">
798 <xsl:with-param name="netstring"
799 select="substring-after($netstring,'192.168.0.1')"/>
800 </xsl:call-template>
801 </xsl:when>
802 <xsl:when test="contains($netstring,'192.168.0.2')">
803 <xsl:call-template name="outputsysdnet">
804 <xsl:with-param name="netstring"
805 select="substring-before($netstring,'192.168.0.2')"/>
806 </xsl:call-template>
807 <xsl:value-of select="$ip"/>
808 <xsl:call-template name="outputsysdnet">
809 <xsl:with-param name="netstring"
810 select="substring-after($netstring,'192.168.0.2')"/>
811 </xsl:call-template>
812 </xsl:when>
813 <xsl:when test="contains($netstring,'24')">
814 <xsl:call-template name="outputsysdnet">
815 <xsl:with-param name="netstring"
816 select="substring-before($netstring,'24')"/>
817 </xsl:call-template>
818 <xsl:value-of select="$prefix"/>
819 <xsl:call-template name="outputsysdnet">
820 <xsl:with-param name="netstring"
821 select="substring-after($netstring,'24')"/>
822 </xsl:call-template>
823 </xsl:when>
824 <xsl:when test="contains($netstring,'&lt;Your Domain Name&gt;')">
825 <xsl:call-template name="outputsysdnet">
826 <xsl:with-param name="netstring"
827 select="substring-before($netstring,'&lt;Your Domain Name&gt;')"/>
828 </xsl:call-template>
829 <xsl:value-of select="$domain"/>
830 <xsl:call-template name="outputsysdnet">
831 <xsl:with-param name="netstring"
832 select="substring-after($netstring,'&lt;Your Domain Name&gt;')"/>
833 </xsl:call-template>
834 </xsl:when>
835 <xsl:otherwise>
836 <xsl:value-of select="$netstring"/>
837 </xsl:otherwise>
838 </xsl:choose>
839 </xsl:template>
840
[7072e1f]841 <xsl:template name="outputpkgdest">
842 <xsl:param name="outputstring" select="foo"/>
843 <xsl:choose>
844 <xsl:when test="contains($outputstring,'make ')">
845 <xsl:choose>
846 <xsl:when test="not(starts-with($outputstring,'make'))">
847 <xsl:call-template name="outputpkgdest">
848 <xsl:with-param name="outputstring"
849 select="substring-before($outputstring,'make')"/>
850 </xsl:call-template>
851 <xsl:call-template name="outputpkgdest">
852 <xsl:with-param
853 name="outputstring"
854 select="substring-after($outputstring,
855 substring-before($outputstring,'make'))"/>
856 </xsl:call-template>
857 </xsl:when>
858 <xsl:otherwise>
859 <xsl:choose>
860<!-- special cases (no DESTDIR) here -->
861 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
862 <xsl:text>make install_root=$PKG_DEST -j1</xsl:text>
863 <xsl:value-of
864 select="substring-before(substring-after(string(),'make'),
865 'install')"/>
866 <xsl:text>install&#xA;</xsl:text>
867 </xsl:when>
868 <xsl:when test="ancestor::sect1[@id='ch-system-bzip2']">
869 <xsl:text>make PREFIX=$PKG_DEST/usr install&#xA;</xsl:text>
870 </xsl:when>
871 <xsl:when test="ancestor::sect1[@id='ch-system-sysklogd']">
872 <xsl:text>make BINDIR=$PKG_DEST/sbin prefix=$PKG_DEST install&#xA;</xsl:text>
873 </xsl:when>
874 <xsl:when test="ancestor::sect1[@id='ch-system-iproute2']">
[b1f4a8d]875 <xsl:text>make DESTDIR=$PKG_DEST DOCDIR=</xsl:text>
[7072e1f]876 <xsl:value-of
[b1f4a8d]877 select="substring-before(substring-after(string(),'DOCDIR='),
[7072e1f]878 'install')"/>
879 <xsl:text>install&#xA;</xsl:text>
880 </xsl:when>
881 <xsl:when test="ancestor::sect1[@id='ch-system-sysvinit']">
882 <xsl:text>make ROOT=$PKG_DEST</xsl:text>
883 <xsl:value-of
884 select="substring-before(substring-after(string(),'make'),
885 'install')"/>
886 <xsl:text>install&#xA;</xsl:text>
887 </xsl:when>
888 <xsl:when test="ancestor::sect1[@id='ch-bootable-kernel']">
889 <xsl:text>make INSTALL_MOD_PATH=$PKG_DEST</xsl:text>
890 <xsl:value-of
891 select="substring-before(substring-after(string(),'make'),
892 'install')"/>
893 <xsl:text>install&#xA;</xsl:text>
894 </xsl:when>
[560bef1]895 <xsl:when test="ancestor::sect1[@id='ch-system-attr']">
896 <xsl:text>DIST_ROOT=$PKG_DEST make</xsl:text>
897 <xsl:call-template name="outputpkgdest">
898 <xsl:with-param name="outputstring"
899 select="substring-after($outputstring,'make')"/>
900 </xsl:call-template>
901 </xsl:when>
[7072e1f]902 <xsl:otherwise>
[560bef1]903 <xsl:text>make DESTDIR=$PKG_DEST</xsl:text>
[e6e0c85]904 <xsl:call-template name="outputpkgdest">
[560bef1]905 <xsl:with-param
[7072e1f]906 name="outputstring"
907 select="substring-after($outputstring,'make')"/>
[560bef1]908 </xsl:call-template>
[7072e1f]909 </xsl:otherwise>
910 </xsl:choose>
911 </xsl:otherwise>
912 </xsl:choose>
913 </xsl:when>
914 <xsl:otherwise> <!-- no make in this string -->
915 <xsl:choose>
916 <xsl:when test="contains($outputstring,'&gt;/') and
917 not(contains(substring-before($outputstring,'&gt;/'),' /'))">
918 <xsl:value-of select="substring-before($outputstring,'&gt;/')"/>
919 <xsl:text>&gt;$PKG_DEST/</xsl:text>
920 <xsl:call-template name="outputpkgdest">
921 <xsl:with-param name="outputstring" select="substring-after($outputstring,'&gt;/')"/>
922 </xsl:call-template>
923 </xsl:when>
924 <xsl:when test="contains($outputstring,' /')">
925 <xsl:value-of select="substring-before($outputstring,' /')"/>
926 <xsl:text> $PKG_DEST/</xsl:text>
927 <xsl:call-template name="outputpkgdest">
928 <xsl:with-param name="outputstring" select="substring-after($outputstring,' /')"/>
929 </xsl:call-template>
930 </xsl:when>
931 <xsl:otherwise>
932 <xsl:value-of select="$outputstring"/>
933 <xsl:text>&#xA;</xsl:text>
934 </xsl:otherwise>
935 </xsl:choose>
936 </xsl:otherwise>
937 </xsl:choose>
938 </xsl:template>
[945ccaa]939
940 <xsl:variable name="APOS">'</xsl:variable>
941 <xsl:template name="output-wrap">
942 <xsl:param name="commands" select="''"/>
943 <xsl:choose>
944 <xsl:when test="contains($commands,string($APOS))">
945 <xsl:call-template name="output-wrap">
946 <xsl:with-param name="commands"
947 select="substring-before($commands,string($APOS))"/>
948 </xsl:call-template>
949 <xsl:text>'\''</xsl:text>
950 <xsl:call-template name="output-wrap">
951 <xsl:with-param name="commands"
952 select="substring-after($commands,string($APOS))"/>
953 </xsl:call-template>
954 </xsl:when>
955 <xsl:otherwise>
956 <xsl:value-of select="$commands"/>
957 </xsl:otherwise>
958 </xsl:choose>
959 </xsl:template>
960
[557fe91]961</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.