source: LFS/lfs.xsl@ 95c46b9

new_features
Last change on this file since 95c46b9 was 580d773, checked in by Pierre Labastie <pierre@…>, 8 years ago

Merge trunk r3940,41

  • Property mode set to 100644
File size: 38.6 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
[77fa8ba]11<!-- Parameters -->
12
[580d773]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 -->
[df42c7c]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
[77fa8ba]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 -->
[df42c7c]42 <xsl:param name="bomb-testsuite" select="'n'"/>
[28f4756]43
[7072e1f]44 <!-- Install vim-lang package? OBSOLETE should always be 'n'-->
[df42c7c]45 <xsl:param name="vim-lang" select="'n'"/>
[7072e1f]46
[877cc6a]47 <!-- Time zone -->
[df42c7c]48 <xsl:param name="timezone" select="'GMT'"/>
[7072e1f]49
[877cc6a]50 <!-- Page size -->
[df42c7c]51 <xsl:param name="page" select="'letter'"/>
[7072e1f]52
[877cc6a]53 <!-- Locale settings -->
[df42c7c]54 <xsl:param name="lang" select="'C'"/>
[b339c94]55
56 <!-- Install the whole set of locales -->
[df42c7c]57 <xsl:param name='full-locale' select='"n"'/>
[7072e1f]58
[77fa8ba]59 <!-- Hostname -->
60 <xsl:param name='hostname' select='"HOSTNAME"'/>
61
62 <!-- Network parameters: interface, ip, gateway, prefix, broadcast, domain
63 and nameservers -->
[df42c7c]64 <xsl:param name='interface' select="'eth0'"/>
[77fa8ba]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="/">
[580d773]76 <xsl:apply-templates select="//sect1[not(@revision) or
77 @revision=$revision]"/>
[557fe91]78 </xsl:template>
[7072e1f]79
[557fe91]80 <xsl:template match="sect1">
[580d773]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
[580d773]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>
[580d773]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
[580d773]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']">
[df42c7c]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>
[df42c7c]219 </xsl:otherwise>
220 </xsl:choose>
[f0a31de]221 </xsl:if>
222 <xsl:if test="../@id = 'ch-system-glibc' and
[90f304c]223 @role='installation' and
[df42c7c]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
[580d773]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']">
[df42c7c]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 -->
[df42c7c]243 <xsl:text>rm -fv /usr/share/man/{man3/getspnam.3,man5/passwd.5}
[560bef1]244</xsl:text>
[df42c7c]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... -->
[df42c7c]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>'
262packInstall
263</xsl:text>
264 </xsl:when>
265 <xsl:otherwise>
266 <xsl:if test="../@id = 'ch-system-man-pages'">
267<!-- these files are provided by the shadow package -->
268 <xsl:text>rm -fv $PKG_DEST/usr/share/man/{man3/getspnam.3,man5/passwd.5}
269</xsl:text>
270 </xsl:if>
271<!-- Attr man/man2 pages are already installed by man-pages. As of
272 March 2013, they are the same pages.
273 November 2015: now they are more accurate
274 in man-pages, and the man5 section is also in man-pages... -->
275 <xsl:if test="../@id = 'ch-system-attr'">
276 <xsl:text>rm -fv $PKG_DEST/usr/share/man/man2/*
[00313dd]277rm -fv $PKG_DEST/usr/share/man/man5/*
[a983256]278</xsl:text>
[df42c7c]279 </xsl:if>
[a983256]280<!-- nologin is installed by util-linux. remove it from shadow -->
[df42c7c]281 <xsl:if test="../@id = 'ch-system-shadow'">
282 <xsl:text>rm -fv $PKG_DEST/usr/share/man/man8/nologin.8
[a983256]283rm -fv $PKG_DEST/sbin/nologin
[7072e1f]284</xsl:text>
[df42c7c]285 </xsl:if>
286 <xsl:text>rm -fv $PKG_DEST/{,usr/}lib64
[7072e1f]287rm -fv $PKG_DEST/usr/{man,doc,info}
288for dir in $PKG_DEST/usr/share/man/man{1..8}; do
289 [[ -z $(ls $dir) ]] &amp;&amp; rmdir -v $dir
290done
291for dir in $PKG_DEST/usr/share/{doc,info,man}; do
292 [[ -z $(ls $dir) ]] &amp;&amp; rmdir -v $dir
293done
294for dir in $PKG_DEST/usr/{lib,bin,sbin,include}; do
295 [[ -z $(ls $dir) ]] &amp;&amp; rmdir -v $dir
296done
297for dir in $PKG_DEST/{boot,etc,lib,bin,sbin}; do
298 [[ -z $(ls $dir) ]] &amp;&amp; rmdir -v $dir
299done
300packInstall
301rm -rf $PKG_DEST
302</xsl:text>
[df42c7c]303 </xsl:otherwise>
304 </xsl:choose>
[f0a31de]305 </xsl:if>
306 <xsl:if test="$testsuite='3' and
307 ../@id='ch-tools-glibc' and
308 @role='installation'">
309 <xsl:copy-of select="//userinput[@remap='locale-test']"/>
310 <xsl:text>&#xA;</xsl:text>
311 </xsl:if>
312 <xsl:if test="../@id='ch-system-glibc' and @role='installation'">
313 <xsl:choose>
314 <xsl:when test="$full-locale='y'">
315 <xsl:copy-of select="//userinput[@remap='locale-full']"/>
316 <xsl:text>&#xA;</xsl:text>
317 </xsl:when>
318 <xsl:otherwise>
319 <xsl:copy-of select="//userinput[@remap='locale-test']"/>
320 <xsl:text>&#xA;</xsl:text>
321 <xsl:if test="not(contains(string(//userinput[@remap='locale-test']),$lang)) and $lang!='C' and $lang!='POSIX'">
322 <xsl:text>if LOCALE=`grep "</xsl:text>
323 <xsl:value-of select="$lang"/>
324 <xsl:text>/" $PKGDIR/localedata/SUPPORTED`; then
[b339c94]325 CHARMAP=`echo $LOCALE | sed 's,[^/]*/\([^ ]*\) [\],\1,'`
326 INPUT=`echo $LOCALE | sed 's,[/.].*,,'`
327 LOCALE=`echo $LOCALE | sed 's,/.*,,'`
328 localedef -i $INPUT -f $CHARMAP $LOCALE
329fi
330</xsl:text>
[f0a31de]331 </xsl:if>
332 </xsl:otherwise>
333 </xsl:choose>
[c4cf6de]334 </xsl:if>
[f0a31de]335 <xsl:apply-templates
336 select=".//screen[
[580d773]337 (not(@role) or
338 @role != 'nodump') and
339 (not(@revision) or
340 @revision=$revision)
[f0a31de]341 ]/userinput[
[f2e80ac]342 not(@remap) or
343 @remap='adjust' or
344 @remap='test' and current()/../@id='ch-tools-dejagnu' or
345 @remap='test' and current()/../@id='ch-system-systemd'
[f0a31de]346 ]"/>
[557fe91]347 </xsl:template>
348
[f0a31de]349 <xsl:template match="sect1" mode="pkgmngt">
[7072e1f]350 <xsl:param name="dirname" select="chapter05"/>
351 <!-- The build order -->
[575bcf3]352 <xsl:param name="order" select="062"/>
[7072e1f]353<!-- The file names -->
354 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
355 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
356 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
357 <!-- Creating dirs and files -->
[8099885]358 <xsl:if test="count(descendant::screen/userinput) &gt; 0 and
359 count(descendant::screen/userinput) &gt;
360 count(descendant::screen[@role='nodump'])">
361 <exsl:document href="{$dirname}/{$order}-{position()}-{$filename}"
362 method="text">
363 <xsl:text>#!/bin/bash
[7072e1f]364set +h
365set -e
366
367cd $PKGDIR
368</xsl:text>
[8099885]369 <xsl:apply-templates
370 select=".//screen[not(@role) or
371 @role != 'nodump']/userinput[@remap != 'adjust']"
[7072e1f]372 mode="pkgmngt"/>
[8099885]373 <xsl:if test="$dirname = 'chapter06'">
374 <xsl:text>packInstall
[df42c7c]375rm -rf "$PKG_DEST"
[7072e1f]376</xsl:text>
[8099885]377 </xsl:if>
378 <xsl:apply-templates
379 select=".//screen[not(@role) or
380 @role != 'nodump'
381 ]/userinput[not(@remap) or
382 @remap='adjust'
[7072e1f]383 ]"
384 mode="pkgmngt"/>
[8099885]385 <xsl:text>
[7072e1f]386echo -e "\n\nTotalseconds: $SECONDS\n"
387exit
388</xsl:text>
[8099885]389 </exsl:document>
390 </xsl:if>
[557fe91]391 </xsl:template>
392
[7072e1f]393 <xsl:template match="userinput" mode="pkgmngt">
394 <xsl:apply-templates/>
395 <xsl:text>&#xA;</xsl:text>
396 </xsl:template>
397
398 <xsl:template match="userinput">
[3eb60fa]399 <xsl:choose>
[fd691b4]400 <!-- Copying the kernel config file -->
401 <xsl:when test="string() = 'make mrproper'">
402 <xsl:text>make mrproper&#xA;</xsl:text>
[7072e1f]403 <xsl:if test="ancestor::sect1[@id='ch-bootable-kernel']">
[bcfb3bf]404 <xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
405 </xsl:if>
[92568bf]406 </xsl:when>
[7072e1f]407<!-- test instructions -->
408 <xsl:when test="@remap = 'test'">
[4afcedb]409 <xsl:choose>
410 <xsl:when test="$testsuite = '0'"/>
411 <xsl:when test="$testsuite = '1' and
412 not(ancestor::sect1[@id='ch-system-gcc']) and
413 not(ancestor::sect1[@id='ch-system-glibc']) and
[7072e1f]414 not(ancestor::sect1[@id='ch-system-gmp']) and
415 not(ancestor::sect1[@id='ch-system-mpfr']) and
[4afcedb]416 not(ancestor::sect1[@id='ch-system-binutils'])"/>
417 <xsl:when test="$testsuite = '2' and
418 ancestor::chapter[@id='chapter-temporary-tools']"/>
419 <xsl:otherwise>
420 <xsl:choose>
421 <xsl:when test="$bomb-testsuite = 'n'">
[7072e1f]422 <xsl:choose>
423 <!-- special case for glibc -->
424 <xsl:when test="contains(string(), 'glibc-check-log')">
425 <xsl:value-of
426 select="substring-before(string(),'2&gt;&amp;1')"/>
427 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
428 </xsl:when>
[e40a68e]429 <!-- special case for procps-ng -->
430 <xsl:when test="contains(string(), 'pushd')">
431 <xsl:text>{ </xsl:text>
432 <xsl:apply-templates/>
433 <xsl:text>; } &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
434 </xsl:when>
[7072e1f]435 <xsl:when test="contains(string(), 'make -k')">
436 <xsl:apply-templates/>
437 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
438 </xsl:when>
439 <xsl:when test="contains(string(), 'make')">
440 <xsl:value-of select="substring-before(string(),'make')"/>
441 <xsl:text>make -k</xsl:text>
442 <xsl:value-of select="substring-after(string(),'make')"/>
443 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
444 </xsl:when>
445 <xsl:otherwise>
446 <xsl:apply-templates/>
447 <xsl:if test="not(contains(string(), '&gt;&gt;'))">
448 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
449 </xsl:if>
450 <xsl:text>&#xA;</xsl:text>
451 </xsl:otherwise>
452 </xsl:choose>
[4afcedb]453 </xsl:when>
454 <xsl:otherwise>
[7072e1f]455 <!-- bomb-testsuite != 'n'-->
456 <xsl:choose>
457 <!-- special case for glibc -->
458 <xsl:when test="contains(string(), 'glibc-check-log')">
459 <xsl:value-of
460 select="substring-before(string(),'2&gt;&amp;1')"/>
[2c9a16b]461 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
[7072e1f]462 </xsl:when>
[e40a68e]463 <!-- special case for gmp -->
[f663589]464 <xsl:when test="contains(string(), 'tee gmp-check-log')">
465 <xsl:text>(</xsl:text>
466 <xsl:apply-templates/>
467 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 &amp;&amp; exit $PIPESTATUS)&#xA;</xsl:text>
468 </xsl:when>
[e40a68e]469 <!-- special case for procps-ng -->
470 <xsl:when test="contains(string(), 'pushd')">
471 <xsl:text>{ </xsl:text>
472 <xsl:apply-templates/>
473 <xsl:text>; } &gt;&gt; $TEST_LOG 2&gt;&amp;1&#xA;</xsl:text>
474 </xsl:when>
[2c9a16b]475 <xsl:when test="contains(string(), 'make -k')">
476 <xsl:apply-templates/>
477 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
478 </xsl:when>
[7072e1f]479 <xsl:otherwise>
480 <xsl:apply-templates/>
481 <xsl:if test="not(contains(string(), '&gt;&gt;'))">
482 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
483 </xsl:if>
484 <xsl:text>&#xA;</xsl:text>
485 </xsl:otherwise>
486 </xsl:choose>
[4afcedb]487 </xsl:otherwise>
488 </xsl:choose>
489 </xsl:otherwise>
490 </xsl:choose>
491 </xsl:when>
[7072e1f]492<!-- End of test instructions -->
[fd691b4]493 <!-- Don't stop on strip run -->
494 <xsl:when test="contains(string(),'strip ')">
[3eb60fa]495 <xsl:apply-templates/>
[fd691b4]496 <xsl:text> || true&#xA;</xsl:text>
[1f025ca]497 </xsl:when>
[7072e1f]498<!-- Package management -->
499<!-- Add $PKG_DEST to installation commands -->
500 <xsl:when test="@remap='install' and
501 not(ancestor::chapter[
502 @id='chapter-temporary-tools'
503 ])">
504 <xsl:choose>
505 <xsl:when test="$pkgmngt='n'">
506 <xsl:choose>
507 <xsl:when test="contains(string(),'firmware,udev')">
508 <xsl:text>if [[ ! -d /lib/udev/devices ]] ; then&#xA;</xsl:text>
509 <xsl:apply-templates/>
510 <xsl:text>&#xA;fi&#xA;</xsl:text>
511 </xsl:when>
512 <xsl:otherwise>
513 <xsl:apply-templates/>
514 <xsl:text>&#xA;</xsl:text>
515 </xsl:otherwise>
516 </xsl:choose>
517 </xsl:when>
[df42c7c]518 <xsl:when test="$wrap-install='y'">
519 <xsl:choose>
520 <xsl:when test="./literal">
521 <xsl:call-template name="output-wrap">
522 <xsl:with-param name="commands" select="text()[1]"/>
523 </xsl:call-template>
524 <xsl:apply-templates select="literal"/>
525 <xsl:call-template name="output-wrap">
526 <xsl:with-param name="commands" select="text()[2]"/>
527 </xsl:call-template>
528 </xsl:when>
529 <xsl:otherwise>
530 <xsl:call-template name="output-wrap">
531 <xsl:with-param name="commands" select="string()"/>
532 </xsl:call-template>
533 </xsl:otherwise>
534 </xsl:choose>
535 <xsl:text>&#xA;</xsl:text>
536 </xsl:when>
537 <xsl:otherwise><!--pkgmngt = 'y' and wrap-install='n'-->
[7072e1f]538 <xsl:choose>
539 <xsl:when test="./literal">
540 <xsl:call-template name="outputpkgdest">
[560bef1]541 <xsl:with-param name="outputstring" select="text()[1]"/>
[7072e1f]542 </xsl:call-template>
543 <xsl:apply-templates select="literal"/>
544 <xsl:call-template name="outputpkgdest">
[560bef1]545 <xsl:with-param name="outputstring" select="text()[2]"/>
[7072e1f]546 </xsl:call-template>
547 </xsl:when>
548 <xsl:otherwise>
549 <xsl:call-template name="outputpkgdest">
550 <xsl:with-param name="outputstring" select="string()"/>
551 </xsl:call-template>
552 </xsl:otherwise>
553 </xsl:choose>
554 </xsl:otherwise>
555 </xsl:choose>
556 </xsl:when>
[57ef0c1]557 <!-- if package management, we should make an independant package for
558 tzdata. -->
559 <xsl:when test="contains(string(),'tzdata') and $pkgmngt='y'">
560 <xsl:text>
[df42c7c]561OLD_PKG_DEST="$PKG_DEST"
[57ef0c1]562OLD_PKGDIR=$PKGDIR
[56d8426]563PKG_DEST=$(dirname $OLD_PKG_DEST)/001-tzdata
[57ef0c1]564PKGDIR=$(dirname $PKGDIR)/tzdata-</xsl:text>
565 <xsl:copy-of select="substring-before(
566 substring-after(string(),'tzdata'),
567 '.tar')"/>
568 <xsl:text>
569</xsl:text>
[df42c7c]570 <xsl:choose>
571 <xsl:when test="$wrap-install='n'">
572 <xsl:copy-of select="substring-before(string(),'ZONEINFO=')"/>
573 <xsl:text>ZONEINFO=$PKG_DEST</xsl:text>
574 <xsl:copy-of select="substring-after(string(),'ZONEINFO=')"/>
575 <xsl:text>
[57ef0c1]576packInstall
577rm -rf $PKG_DEST
[df42c7c]578</xsl:text>
579 </xsl:when>
580 <xsl:otherwise><!-- wrap-install='y' -->
581 <xsl:copy-of select="substring-before(string(),'ZONEINFO=')"/>
582 <xsl:text>
583wrapInstall '
584ZONEINFO=</xsl:text>
585 <xsl:copy-of select="substring-after(string(),'ZONEINFO=')"/>
586 <xsl:text>'
587packInstall
588</xsl:text>
589 </xsl:otherwise>
590 </xsl:choose>
591 <xsl:text>
[57ef0c1]592PKG_DEST=$OLD_PKG_DEST
593unset OLD_PKG_DEST
594PKGDIR=$OLD_PKGDIR
595unset OLD_PKGDIR
596</xsl:text>
597 </xsl:when><!-- addition for tzdata + package management -->
[7072e1f]598 <!-- End addition for package management -->
[fd691b4]599 <!-- The rest of commands -->
[1f025ca]600 <xsl:otherwise>
601 <xsl:apply-templates/>
[fd691b4]602 <xsl:text>&#xA;</xsl:text>
[1f025ca]603 </xsl:otherwise>
604 </xsl:choose>
605 </xsl:template>
[7072e1f]606
[557fe91]607 <xsl:template match="replaceable">
[a41ce58]608 <xsl:choose>
[2a54650]609 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
[877cc6a]610 <xsl:value-of select="$timezone"/>
[2a54650]611 </xsl:when>
[a41ce58]612 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
[877cc6a]613 <xsl:value-of select="$page"/>
[a41ce58]614 </xsl:when>
[81a7fb8]615 <xsl:when test="contains(string(.),'&lt;ll&gt;_&lt;CC&gt;')">
616 <xsl:value-of select="$lang"/>
617 </xsl:when>
[77fa8ba]618 <xsl:when test="contains(string(.),'Domain')">
619 <xsl:value-of select="$domain"/>
620 </xsl:when>
621 <xsl:when test="contains(string(.),'primary')">
622 <xsl:value-of select="$nameserver1"/>
623 </xsl:when>
624 <xsl:when test="contains(string(.),'secondary')">
625 <xsl:value-of select="$nameserver2"/>
626 </xsl:when>
627 <xsl:when test="contains(string(.),'192.168.1.1')">
628 <xsl:value-of select="$ip"/>
629 </xsl:when>
[e43d0d0]630 <xsl:when test="contains(string(.),'192.168.0.2')">
631 <xsl:value-of select="$ip"/>
632 </xsl:when>
633<!-- Only adapted to LFS-20170310 and later -->
[77fa8ba]634 <xsl:when test="contains(string(.),'HOSTNAME')">
635 <xsl:value-of select="$hostname"/>
636 </xsl:when>
[e43d0d0]637 <xsl:when test="contains(string(.),'FQDN')">
[77fa8ba]638 <xsl:value-of select="$hostname"/>
[e43d0d0]639 <xsl:text>.</xsl:text>
640 <xsl:value-of select="$domain"/>
[77fa8ba]641 </xsl:when>
[e43d0d0]642 <xsl:when test="contains(string(.),'alias')"/>
[77fa8ba]643 <xsl:when test="contains(string(.),'&lt;lfs&gt;')">
644 <xsl:value-of select="$hostname"/>
645 </xsl:when>
[a41ce58]646 <xsl:otherwise>
647 <xsl:text>**EDITME</xsl:text>
648 <xsl:apply-templates/>
649 <xsl:text>EDITME**</xsl:text>
650 </xsl:otherwise>
651 </xsl:choose>
[557fe91]652 </xsl:template>
[7072e1f]653
[77fa8ba]654 <xsl:template match="literal">
655 <xsl:choose>
656 <xsl:when test="contains(string(),'ONBOOT')">
657 <xsl:call-template name="outputnet">
658 <xsl:with-param name="netstring" select="string()"/>
659 </xsl:call-template>
660 </xsl:when>
[d8ddcfb]661 <xsl:when test="contains(string(),'[Match]')">
662 <xsl:call-template name="outputsysdnet">
663 <xsl:with-param name="netstring" select="string()"/>
664 </xsl:call-template>
665 </xsl:when>
[77fa8ba]666 <xsl:otherwise>
667 <xsl:apply-templates/>
668 </xsl:otherwise>
669 </xsl:choose>
670 </xsl:template>
671
672 <xsl:template name="outputnet">
673 <xsl:param name="netstring" select="''"/>
674 <!-- We suppose that book example has the following values:
675 - interface: eth0
[33ff403]676 - ip: 192.168.1.2
677 - gateway: 192.168.1.1
[77fa8ba]678 - prefix: 24
679 - broadcast: 192.168.1.255
680 Change below if book changes -->
681 <xsl:choose>
682 <xsl:when test="contains($netstring,'eth0')">
683 <xsl:call-template name="outputnet">
684 <xsl:with-param name="netstring"
685 select="substring-before($netstring,'eth0')"/>
686 </xsl:call-template>
687 <xsl:value-of select="$interface"/>
688 <xsl:call-template name="outputnet">
689 <xsl:with-param name="netstring"
690 select="substring-after($netstring,'eth0')"/>
691 </xsl:call-template>
692 </xsl:when>
693 <xsl:when test="contains($netstring,'192.168.1.1')">
694 <xsl:call-template name="outputnet">
695 <xsl:with-param name="netstring"
696 select="substring-before($netstring,'192.168.1.1')"/>
697 </xsl:call-template>
[33ff403]698 <xsl:value-of select="$gateway"/>
[77fa8ba]699 <xsl:call-template name="outputnet">
700 <xsl:with-param name="netstring"
701 select="substring-after($netstring,'192.168.1.1')"/>
702 </xsl:call-template>
703 </xsl:when>
704 <!-- must test this before the following, because 192.168.1.255 contains
705 192.168.1.2! -->
706 <xsl:when test="contains($netstring,'192.168.1.255')">
707 <xsl:call-template name="outputnet">
708 <xsl:with-param name="netstring"
709 select="substring-before($netstring,'192.168.1.255')"/>
710 </xsl:call-template>
711 <xsl:value-of select="$broadcast"/>
712 <xsl:call-template name="outputnet">
713 <xsl:with-param name="netstring"
714 select="substring-after($netstring,'192.168.1.255')"/>
715 </xsl:call-template>
716 </xsl:when>
717 <xsl:when test="contains($netstring,'192.168.1.2')">
718 <xsl:call-template name="outputnet">
719 <xsl:with-param name="netstring"
720 select="substring-before($netstring,'192.168.1.2')"/>
721 </xsl:call-template>
[33ff403]722 <xsl:value-of select="$ip"/>
[77fa8ba]723 <xsl:call-template name="outputnet">
724 <xsl:with-param name="netstring"
725 select="substring-after($netstring,'192.168.1.2')"/>
726 </xsl:call-template>
727 </xsl:when>
728 <xsl:when test="contains($netstring,'24')">
729 <xsl:call-template name="outputnet">
730 <xsl:with-param name="netstring"
731 select="substring-before($netstring,'24')"/>
732 </xsl:call-template>
733 <xsl:value-of select="$prefix"/>
734 <xsl:call-template name="outputnet">
735 <xsl:with-param name="netstring"
736 select="substring-after($netstring,'24')"/>
737 </xsl:call-template>
738 </xsl:when>
739 <xsl:otherwise>
740 <xsl:value-of select="$netstring"/>
741 </xsl:otherwise>
742 </xsl:choose>
743 </xsl:template>
744
[d8ddcfb]745 <xsl:template name="outputsysdnet">
746 <xsl:param name="netstring" select="''"/>
747 <!-- We suppose that book example has the following values:
748 - interface: eth0
749 - ip: 192.168.0.2
750 - gateway: 192.168.0.1
751 - prefix: 24
752 - DNS: 192.168.0.1
753 - Domain: <Your Domain Name>
754 and gateway comes before DNS. Change below if book changes -->
755 <xsl:choose>
756 <xsl:when test="contains($netstring,'eth0')">
757 <xsl:call-template name="outputsysdnet">
758 <xsl:with-param name="netstring"
759 select="substring-before($netstring,'eth0')"/>
760 </xsl:call-template>
761 <xsl:value-of select="$interface"/>
762 <xsl:call-template name="outputsysdnet">
763 <xsl:with-param name="netstring"
764 select="substring-after($netstring,'eth0')"/>
765 </xsl:call-template>
766 </xsl:when>
767 <xsl:when test="contains($netstring,'192.168.0.1') and
768 contains($netstring,'Gateway')">
769 <xsl:call-template name="outputsysdnet">
770 <xsl:with-param name="netstring"
771 select="substring-before($netstring,'192.168.0.1')"/>
772 </xsl:call-template>
773 <xsl:value-of select="$gateway"/>
774 <xsl:call-template name="outputsysdnet">
775 <xsl:with-param name="netstring"
776 select="substring-after($netstring,'192.168.0.1')"/>
777 </xsl:call-template>
778 </xsl:when>
779 <xsl:when test="contains($netstring,'192.168.0.1') and
780 not(contains($netstring,'Gateway'))">
781 <xsl:call-template name="outputsysdnet">
782 <xsl:with-param name="netstring"
783 select="substring-before($netstring,'192.168.0.1')"/>
784 </xsl:call-template>
785 <xsl:value-of select="$nameserver1"/>
786 <xsl:text>
787DNS=</xsl:text>
788 <xsl:value-of select="$nameserver2"/>
789 <xsl:call-template name="outputsysdnet">
790 <xsl:with-param name="netstring"
791 select="substring-after($netstring,'192.168.0.1')"/>
792 </xsl:call-template>
793 </xsl:when>
794 <xsl:when test="contains($netstring,'192.168.0.2')">
795 <xsl:call-template name="outputsysdnet">
796 <xsl:with-param name="netstring"
797 select="substring-before($netstring,'192.168.0.2')"/>
798 </xsl:call-template>
799 <xsl:value-of select="$ip"/>
800 <xsl:call-template name="outputsysdnet">
801 <xsl:with-param name="netstring"
802 select="substring-after($netstring,'192.168.0.2')"/>
803 </xsl:call-template>
804 </xsl:when>
805 <xsl:when test="contains($netstring,'24')">
806 <xsl:call-template name="outputsysdnet">
807 <xsl:with-param name="netstring"
808 select="substring-before($netstring,'24')"/>
809 </xsl:call-template>
810 <xsl:value-of select="$prefix"/>
811 <xsl:call-template name="outputsysdnet">
812 <xsl:with-param name="netstring"
813 select="substring-after($netstring,'24')"/>
814 </xsl:call-template>
815 </xsl:when>
816 <xsl:when test="contains($netstring,'&lt;Your Domain Name&gt;')">
817 <xsl:call-template name="outputsysdnet">
818 <xsl:with-param name="netstring"
819 select="substring-before($netstring,'&lt;Your Domain Name&gt;')"/>
820 </xsl:call-template>
821 <xsl:value-of select="$domain"/>
822 <xsl:call-template name="outputsysdnet">
823 <xsl:with-param name="netstring"
824 select="substring-after($netstring,'&lt;Your Domain Name&gt;')"/>
825 </xsl:call-template>
826 </xsl:when>
827 <xsl:otherwise>
828 <xsl:value-of select="$netstring"/>
829 </xsl:otherwise>
830 </xsl:choose>
831 </xsl:template>
832
[7072e1f]833 <xsl:template name="outputpkgdest">
834 <xsl:param name="outputstring" select="foo"/>
835 <xsl:choose>
836 <xsl:when test="contains($outputstring,'make ')">
837 <xsl:choose>
838 <xsl:when test="not(starts-with($outputstring,'make'))">
839 <xsl:call-template name="outputpkgdest">
840 <xsl:with-param name="outputstring"
841 select="substring-before($outputstring,'make')"/>
842 </xsl:call-template>
843 <xsl:call-template name="outputpkgdest">
844 <xsl:with-param
845 name="outputstring"
846 select="substring-after($outputstring,
847 substring-before($outputstring,'make'))"/>
848 </xsl:call-template>
849 </xsl:when>
850 <xsl:otherwise>
851 <xsl:choose>
852<!-- special cases (no DESTDIR) here -->
853 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
854 <xsl:text>make install_root=$PKG_DEST -j1</xsl:text>
855 <xsl:value-of
856 select="substring-before(substring-after(string(),'make'),
857 'install')"/>
858 <xsl:text>install&#xA;</xsl:text>
859 </xsl:when>
860 <xsl:when test="ancestor::sect1[@id='ch-system-bzip2']">
861 <xsl:text>make PREFIX=$PKG_DEST/usr install&#xA;</xsl:text>
862 </xsl:when>
863 <xsl:when test="ancestor::sect1[@id='ch-system-sysklogd']">
864 <xsl:text>make BINDIR=$PKG_DEST/sbin prefix=$PKG_DEST install&#xA;</xsl:text>
865 </xsl:when>
866 <xsl:when test="ancestor::sect1[@id='ch-system-iproute2']">
[b1f4a8d]867 <xsl:text>make DESTDIR=$PKG_DEST DOCDIR=</xsl:text>
[7072e1f]868 <xsl:value-of
[b1f4a8d]869 select="substring-before(substring-after(string(),'DOCDIR='),
[7072e1f]870 'install')"/>
871 <xsl:text>install&#xA;</xsl:text>
872 </xsl:when>
873 <xsl:when test="ancestor::sect1[@id='ch-system-sysvinit']">
874 <xsl:text>make ROOT=$PKG_DEST</xsl:text>
875 <xsl:value-of
876 select="substring-before(substring-after(string(),'make'),
877 'install')"/>
878 <xsl:text>install&#xA;</xsl:text>
879 </xsl:when>
880 <xsl:when test="ancestor::sect1[@id='ch-bootable-kernel']">
881 <xsl:text>make INSTALL_MOD_PATH=$PKG_DEST</xsl:text>
882 <xsl:value-of
883 select="substring-before(substring-after(string(),'make'),
884 'install')"/>
885 <xsl:text>install&#xA;</xsl:text>
886 </xsl:when>
[560bef1]887 <xsl:when test="ancestor::sect1[@id='ch-system-attr']">
888 <xsl:text>DIST_ROOT=$PKG_DEST make</xsl:text>
889 <xsl:call-template name="outputpkgdest">
890 <xsl:with-param name="outputstring"
891 select="substring-after($outputstring,'make')"/>
892 </xsl:call-template>
893 </xsl:when>
[7072e1f]894 <xsl:otherwise>
[560bef1]895 <xsl:text>make DESTDIR=$PKG_DEST</xsl:text>
[e6e0c85]896 <xsl:call-template name="outputpkgdest">
[560bef1]897 <xsl:with-param
[7072e1f]898 name="outputstring"
899 select="substring-after($outputstring,'make')"/>
[560bef1]900 </xsl:call-template>
[7072e1f]901 </xsl:otherwise>
902 </xsl:choose>
903 </xsl:otherwise>
904 </xsl:choose>
905 </xsl:when>
906 <xsl:otherwise> <!-- no make in this string -->
907 <xsl:choose>
908 <xsl:when test="contains($outputstring,'&gt;/') and
909 not(contains(substring-before($outputstring,'&gt;/'),' /'))">
910 <xsl:value-of select="substring-before($outputstring,'&gt;/')"/>
911 <xsl:text>&gt;$PKG_DEST/</xsl:text>
912 <xsl:call-template name="outputpkgdest">
913 <xsl:with-param name="outputstring" select="substring-after($outputstring,'&gt;/')"/>
914 </xsl:call-template>
915 </xsl:when>
916 <xsl:when test="contains($outputstring,' /')">
917 <xsl:value-of select="substring-before($outputstring,' /')"/>
918 <xsl:text> $PKG_DEST/</xsl:text>
919 <xsl:call-template name="outputpkgdest">
920 <xsl:with-param name="outputstring" select="substring-after($outputstring,' /')"/>
921 </xsl:call-template>
922 </xsl:when>
923 <xsl:otherwise>
924 <xsl:value-of select="$outputstring"/>
925 <xsl:text>&#xA;</xsl:text>
926 </xsl:otherwise>
927 </xsl:choose>
928 </xsl:otherwise>
929 </xsl:choose>
930 </xsl:template>
[df42c7c]931
932 <xsl:variable name="APOS">'</xsl:variable>
933 <xsl:template name="output-wrap">
934 <xsl:param name="commands" select="''"/>
935 <xsl:choose>
936 <xsl:when test="contains($commands,string($APOS))">
937 <xsl:call-template name="output-wrap">
938 <xsl:with-param name="commands"
939 select="substring-before($commands,string($APOS))"/>
940 </xsl:call-template>
941 <xsl:text>'\''</xsl:text>
942 <xsl:call-template name="output-wrap">
943 <xsl:with-param name="commands"
944 select="substring-after($commands,string($APOS))"/>
945 </xsl:call-template>
946 </xsl:when>
947 <xsl:otherwise>
948 <xsl:value-of select="$commands"/>
949 </xsl:otherwise>
950 </xsl:choose>
951 </xsl:template>
952
[557fe91]953</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.