1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 |
|
---|
3 | <!-- $Id$ -->
|
---|
4 |
|
---|
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">
|
---|
10 |
|
---|
11 | <!-- Parameters -->
|
---|
12 |
|
---|
13 | <!-- use package management ?
|
---|
14 | n = no, original behavior
|
---|
15 | y = yes, add PKG_DEST to scripts in install commands of chapter06-08
|
---|
16 | -->
|
---|
17 | <xsl:param name="pkgmngt" select="n"/>
|
---|
18 |
|
---|
19 | <!-- Run test suites?
|
---|
20 | 0 = none
|
---|
21 | 1 = only chapter06 critical testsuites
|
---|
22 | 2 = all chapter06 testsuites
|
---|
23 | 3 = all chapter05 and chapter06 testsuites
|
---|
24 | -->
|
---|
25 | <xsl:param name="testsuite" select="1"/>
|
---|
26 |
|
---|
27 | <!-- Bomb on test suites failures?
|
---|
28 | n = no, I want to build the full system and review the logs
|
---|
29 | y = yes, bomb at the first test suite failure to can review the build dir
|
---|
30 | -->
|
---|
31 | <xsl:param name="bomb-testsuite" select="n"/>
|
---|
32 |
|
---|
33 | <!-- Install vim-lang package? OBSOLETE should always be 'n'-->
|
---|
34 | <xsl:param name="vim-lang" select="n"/>
|
---|
35 |
|
---|
36 | <!-- Time zone -->
|
---|
37 | <xsl:param name="timezone" select="GMT"/>
|
---|
38 |
|
---|
39 | <!-- Page size -->
|
---|
40 | <xsl:param name="page" select="letter"/>
|
---|
41 |
|
---|
42 | <!-- Locale settings -->
|
---|
43 | <xsl:param name="lang" select="C"/>
|
---|
44 |
|
---|
45 | <!-- Install the whole set of locales -->
|
---|
46 | <xsl:param name='full-locale' select='n'/>
|
---|
47 |
|
---|
48 | <!-- Hostname -->
|
---|
49 | <xsl:param name='hostname' select='"HOSTNAME"'/>
|
---|
50 |
|
---|
51 | <!-- Network parameters: interface, ip, gateway, prefix, broadcast, domain
|
---|
52 | and nameservers -->
|
---|
53 | <xsl:param name='interface' select='eth0'/>
|
---|
54 | <xsl:param name='ip' select='"10.0.2.9"'/>
|
---|
55 | <xsl:param name='gateway' select='"10.0.2.2"'/>
|
---|
56 | <xsl:param name='prefix' select='24'/>
|
---|
57 | <xsl:param name='broadcast' select='"10.0.2.255"'/>
|
---|
58 | <xsl:param name='domain' select='"lfs.org"'/>
|
---|
59 | <xsl:param name='nameserver1' select='"10.0.2.3"'/>
|
---|
60 | <xsl:param name='nameserver2' select='"8.8.8.8"'/>
|
---|
61 |
|
---|
62 | <!-- End parameters -->
|
---|
63 |
|
---|
64 | <xsl:template match="/">
|
---|
65 | <xsl:apply-templates select="//sect1"/>
|
---|
66 | </xsl:template>
|
---|
67 |
|
---|
68 | <xsl:template match="sect1">
|
---|
69 | <xsl:if test="(../@id='chapter-temporary-tools' or
|
---|
70 | ../@id='chapter-building-system' or
|
---|
71 | ../@id='chapter-bootscripts' or
|
---|
72 | ../@id='chapter-bootable') and
|
---|
73 | count(descendant::screen/userinput) > 0 and
|
---|
74 | count(descendant::screen/userinput) >
|
---|
75 | count(descendant::screen[@role='nodump']) and
|
---|
76 | count(descendant::screen/userinput) >
|
---|
77 | count(descendant::screen/userinput[starts-with(string(),'chroot')])">
|
---|
78 | <!-- The last condition is a hack to allow previous versions of the
|
---|
79 | book where the chroot commands did not have role="nodump".
|
---|
80 | It only works if the chroot command is the only one on the page -->
|
---|
81 | <!-- The dirs names -->
|
---|
82 | <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
|
---|
83 | <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
|
---|
84 | <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
|
---|
85 | <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
|
---|
86 | <!-- The file names -->
|
---|
87 | <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
|
---|
88 | <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
|
---|
89 | <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
|
---|
90 | <!-- The build order -->
|
---|
91 | <xsl:variable name="position" select="position()"/>
|
---|
92 | <xsl:variable name="order">
|
---|
93 | <xsl:choose>
|
---|
94 | <xsl:when test="string-length($position) = 1">
|
---|
95 | <xsl:text>00</xsl:text>
|
---|
96 | <xsl:value-of select="$position"/>
|
---|
97 | </xsl:when>
|
---|
98 | <xsl:when test="string-length($position) = 2">
|
---|
99 | <xsl:text>0</xsl:text>
|
---|
100 | <xsl:value-of select="$position"/>
|
---|
101 | </xsl:when>
|
---|
102 | <xsl:otherwise>
|
---|
103 | <xsl:value-of select="$position"/>
|
---|
104 | </xsl:otherwise>
|
---|
105 | </xsl:choose>
|
---|
106 | </xsl:variable>
|
---|
107 | <!-- Inclusion of package manager scriptlets -->
|
---|
108 | <xsl:if test="@id='ch-tools-stripping' and $pkgmngt='y'">
|
---|
109 | <xsl:apply-templates
|
---|
110 | select="document('packageManager.xml')//sect1[contains(@id,'ch-tools')]"
|
---|
111 | mode="pkgmngt">
|
---|
112 | <xsl:with-param name="order" select="$order"/>
|
---|
113 | <xsl:with-param name="dirname" select="$dirname"/>
|
---|
114 | </xsl:apply-templates>
|
---|
115 | </xsl:if>
|
---|
116 | <xsl:if test="@id='ch-system-strippingagain' and $pkgmngt='y'">
|
---|
117 | <xsl:apply-templates
|
---|
118 | select="document('packageManager.xml')//sect1[contains(@id,'ch-system')]"
|
---|
119 | mode="pkgmngt">
|
---|
120 | <xsl:with-param name="order" select="$order"/>
|
---|
121 | <xsl:with-param name="dirname" select="$dirname"/>
|
---|
122 | </xsl:apply-templates>
|
---|
123 | </xsl:if>
|
---|
124 | <!-- Creating dirs and files -->
|
---|
125 | <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
|
---|
126 | <xsl:choose>
|
---|
127 | <xsl:when test="@id='ch-system-creatingdirs' or
|
---|
128 | @id='ch-system-createfiles' or
|
---|
129 | @id='ch-system-strippingagain'">
|
---|
130 | <xsl:text>#!/tools/bin/bash
set +h
</xsl:text>
|
---|
131 | </xsl:when>
|
---|
132 | <xsl:otherwise>
|
---|
133 | <xsl:text>#!/bin/bash
set +h
</xsl:text>
|
---|
134 | </xsl:otherwise>
|
---|
135 | </xsl:choose>
|
---|
136 | <xsl:if test="not(@id='ch-tools-stripping') and
|
---|
137 | not(@id='ch-system-strippingagain')">
|
---|
138 | <xsl:text>set -e
</xsl:text>
|
---|
139 | </xsl:if>
|
---|
140 | <xsl:text>
</xsl:text>
|
---|
141 | <xsl:if test="sect2[@role='installation']">
|
---|
142 | <xsl:text>cd $PKGDIR
</xsl:text>
|
---|
143 | </xsl:if>
|
---|
144 | <xsl:apply-templates select="sect2|
|
---|
145 | screen[not(@role) or
|
---|
146 | @role!='nodump']/userinput"/>
|
---|
147 | <xsl:if test="@id='ch-system-creatingdirs' and $pkgmngt='y'">
|
---|
148 | <xsl:apply-templates
|
---|
149 | select="document('packageManager.xml')//sect1[
|
---|
150 | @id='ch-pkgmngt-creatingdirs'
|
---|
151 | ]//userinput"
|
---|
152 | mode="pkgmngt"/>
|
---|
153 | </xsl:if>
|
---|
154 | <xsl:if test="@id='ch-system-createfiles' and $pkgmngt='y'">
|
---|
155 | <xsl:apply-templates
|
---|
156 | select="document('packageManager.xml')//sect1[
|
---|
157 | @id='ch-pkgmngt-createfiles'
|
---|
158 | ]//userinput"
|
---|
159 | mode="pkgmngt"/>
|
---|
160 | </xsl:if>
|
---|
161 | <xsl:text>echo -e "\n\nTotalseconds: $SECONDS\n"
</xsl:text>
|
---|
162 | <xsl:text>exit
</xsl:text>
|
---|
163 | </exsl:document>
|
---|
164 | </xsl:if>
|
---|
165 | </xsl:template>
|
---|
166 |
|
---|
167 | <xsl:template match="sect2">
|
---|
168 | <xsl:apply-templates
|
---|
169 | select=".//screen[not(@role) or
|
---|
170 | @role != 'nodump']/userinput[
|
---|
171 | @remap = 'pre' or
|
---|
172 | @remap = 'configure' or
|
---|
173 | @remap = 'make' or
|
---|
174 | @remap = 'test' and
|
---|
175 | not(current()/../@id='ch-tools-dejagnu') and
|
---|
176 | not(current()/../@id='ch-system-systemd')]"/>
|
---|
177 | <xsl:if
|
---|
178 | test="ancestor::chapter[@id != 'chapter-temporary-tools'] and
|
---|
179 | $pkgmngt = 'y' and
|
---|
180 | descendant::screen[not(@role) or
|
---|
181 | @role != 'nodump']/userinput[
|
---|
182 | @remap='install']">
|
---|
183 | <xsl:text>mkdir -pv $PKG_DEST/{boot,etc,lib,bin,sbin}
|
---|
184 | mkdir -pv $PKG_DEST/usr/{lib,bin,sbin,include}
|
---|
185 | mkdir -pv $PKG_DEST/usr/share/{doc,info,man}
|
---|
186 | mkdir -pv $PKG_DEST/usr/share/man/man{1..8}
|
---|
187 | ln -sv share/{man,doc,info} $PKG_DEST/usr
|
---|
188 | case $(uname -m) in
|
---|
189 | x86_64) ln -sv lib $PKG_DEST/lib64 && ln -sv lib $PKG_DEST/usr/lib64 ;;
|
---|
190 | esac
|
---|
191 | </xsl:text>
|
---|
192 | </xsl:if>
|
---|
193 | <xsl:if test="../@id = 'ch-system-glibc' and
|
---|
194 | @role='installation' and
|
---|
195 | $pkgmngt = 'y'">
|
---|
196 | <xsl:text>mkdir -pv $PKG_DEST/usr/include/{rpc,rpcsvc}
|
---|
197 | </xsl:text>
|
---|
198 | </xsl:if>
|
---|
199 | <xsl:apply-templates
|
---|
200 | select=".//screen[not(@role) or
|
---|
201 | @role != 'nodump']/userinput[@remap = 'install']"/>
|
---|
202 | <xsl:if test="ancestor::chapter[@id != 'chapter-temporary-tools'] and
|
---|
203 | $pkgmngt = 'y' and
|
---|
204 | descendant::screen[not(@role) or
|
---|
205 | @role != 'nodump']/userinput[
|
---|
206 | @remap='install']">
|
---|
207 | <xsl:if test="../@id = 'ch-system-man-pages'">
|
---|
208 | <!-- these files are provided by the shadow package -->
|
---|
209 | <xsl:text>rm -fv $PKG_DEST/usr/share/man/{man3/getspnam.3,man5/passwd.5}
|
---|
210 | </xsl:text>
|
---|
211 | </xsl:if>
|
---|
212 | <!-- Attr man/man2 pages are already installed by man-pages. As of
|
---|
213 | March 2013, they are the same pages.
|
---|
214 | November 2015: now they are more accurate
|
---|
215 | in man-pages, and the man5 section is also in man-pages... -->
|
---|
216 | <xsl:if test="../@id = 'ch-system-attr'">
|
---|
217 | <xsl:text>rm -fv $PKG_DEST/usr/share/man/man2/*
|
---|
218 | rm -fv $PKG_DEST/usr/share/man/man5/*
|
---|
219 | </xsl:text>
|
---|
220 | </xsl:if>
|
---|
221 | <!-- nologin is installed by util-linux. remove it from shadow -->
|
---|
222 | <xsl:if test="../@id = 'ch-system-shadow'">
|
---|
223 | <xsl:text>rm -fv $PKG_DEST/usr/share/man/man8/nologin.8
|
---|
224 | rm -fv $PKG_DEST/sbin/nologin
|
---|
225 | </xsl:text>
|
---|
226 | </xsl:if>
|
---|
227 | <xsl:text>rm -fv $PKG_DEST/{,usr/}lib64
|
---|
228 | rm -fv $PKG_DEST/usr/{man,doc,info}
|
---|
229 | for dir in $PKG_DEST/usr/share/man/man{1..8}; do
|
---|
230 | [[ -z $(ls $dir) ]] && rmdir -v $dir
|
---|
231 | done
|
---|
232 | for dir in $PKG_DEST/usr/share/{doc,info,man}; do
|
---|
233 | [[ -z $(ls $dir) ]] && rmdir -v $dir
|
---|
234 | done
|
---|
235 | for dir in $PKG_DEST/usr/{lib,bin,sbin,include}; do
|
---|
236 | [[ -z $(ls $dir) ]] && rmdir -v $dir
|
---|
237 | done
|
---|
238 | for dir in $PKG_DEST/{boot,etc,lib,bin,sbin}; do
|
---|
239 | [[ -z $(ls $dir) ]] && rmdir -v $dir
|
---|
240 | done
|
---|
241 | packInstall
|
---|
242 | rm -rf $PKG_DEST
|
---|
243 | </xsl:text>
|
---|
244 | </xsl:if>
|
---|
245 | <xsl:if test="$testsuite='3' and
|
---|
246 | ../@id='ch-tools-glibc' and
|
---|
247 | @role='installation'">
|
---|
248 | <xsl:copy-of select="//userinput[@remap='locale-test']"/>
|
---|
249 | <xsl:text>
</xsl:text>
|
---|
250 | </xsl:if>
|
---|
251 | <xsl:if test="../@id='ch-system-glibc' and @role='installation'">
|
---|
252 | <xsl:choose>
|
---|
253 | <xsl:when test="$full-locale='y'">
|
---|
254 | <xsl:copy-of select="//userinput[@remap='locale-full']"/>
|
---|
255 | <xsl:text>
</xsl:text>
|
---|
256 | </xsl:when>
|
---|
257 | <xsl:otherwise>
|
---|
258 | <xsl:copy-of select="//userinput[@remap='locale-test']"/>
|
---|
259 | <xsl:text>
</xsl:text>
|
---|
260 | <xsl:if test="not(contains(string(//userinput[@remap='locale-test']),$lang)) and $lang!='C' and $lang!='POSIX'">
|
---|
261 | <xsl:text>if LOCALE=`grep "</xsl:text>
|
---|
262 | <xsl:value-of select="$lang"/>
|
---|
263 | <xsl:text>/" $PKGDIR/localedata/SUPPORTED`; then
|
---|
264 | CHARMAP=`echo $LOCALE | sed 's,[^/]*/\([^ ]*\) [\],\1,'`
|
---|
265 | INPUT=`echo $LOCALE | sed 's,[/.].*,,'`
|
---|
266 | LOCALE=`echo $LOCALE | sed 's,/.*,,'`
|
---|
267 | localedef -i $INPUT -f $CHARMAP $LOCALE
|
---|
268 | fi
|
---|
269 | </xsl:text>
|
---|
270 | </xsl:if>
|
---|
271 | </xsl:otherwise>
|
---|
272 | </xsl:choose>
|
---|
273 | </xsl:if>
|
---|
274 | <xsl:apply-templates
|
---|
275 | select=".//screen[
|
---|
276 | not(@role) or
|
---|
277 | @role != 'nodump'
|
---|
278 | ]/userinput[
|
---|
279 | not(@remap) or
|
---|
280 | @remap='adjust' or
|
---|
281 | @remap='test' and current()/../@id='ch-tools-dejagnu' or
|
---|
282 | @remap='test' and current()/../@id='ch-system-systemd'
|
---|
283 | ]"/>
|
---|
284 | </xsl:template>
|
---|
285 |
|
---|
286 | <xsl:template match="sect1" mode="pkgmngt">
|
---|
287 | <xsl:param name="dirname" select="chapter05"/>
|
---|
288 | <!-- The build order -->
|
---|
289 | <xsl:param name="order" select="062"/>
|
---|
290 | <!-- The file names -->
|
---|
291 | <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
|
---|
292 | <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
|
---|
293 | <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
|
---|
294 | <!-- Creating dirs and files -->
|
---|
295 | <xsl:if test="count(descendant::screen/userinput) > 0 and
|
---|
296 | count(descendant::screen/userinput) >
|
---|
297 | count(descendant::screen[@role='nodump'])">
|
---|
298 | <exsl:document href="{$dirname}/{$order}-{position()}-{$filename}"
|
---|
299 | method="text">
|
---|
300 | <xsl:text>#!/bin/bash
|
---|
301 | set +h
|
---|
302 | set -e
|
---|
303 |
|
---|
304 | cd $PKGDIR
|
---|
305 | </xsl:text>
|
---|
306 | <xsl:apply-templates
|
---|
307 | select=".//screen[not(@role) or
|
---|
308 | @role != 'nodump']/userinput[@remap != 'adjust']"
|
---|
309 | mode="pkgmngt"/>
|
---|
310 | <xsl:if test="$dirname = 'chapter06'">
|
---|
311 | <xsl:text>packInstall
|
---|
312 | rm -rf $PKG_DEST
|
---|
313 | </xsl:text>
|
---|
314 | </xsl:if>
|
---|
315 | <xsl:apply-templates
|
---|
316 | select=".//screen[not(@role) or
|
---|
317 | @role != 'nodump'
|
---|
318 | ]/userinput[not(@remap) or
|
---|
319 | @remap='adjust'
|
---|
320 | ]"
|
---|
321 | mode="pkgmngt"/>
|
---|
322 | <xsl:text>
|
---|
323 | echo -e "\n\nTotalseconds: $SECONDS\n"
|
---|
324 | exit
|
---|
325 | </xsl:text>
|
---|
326 | </exsl:document>
|
---|
327 | </xsl:if>
|
---|
328 | </xsl:template>
|
---|
329 |
|
---|
330 | <xsl:template match="userinput" mode="pkgmngt">
|
---|
331 | <xsl:apply-templates/>
|
---|
332 | <xsl:text>
</xsl:text>
|
---|
333 | </xsl:template>
|
---|
334 |
|
---|
335 | <xsl:template match="userinput">
|
---|
336 | <xsl:choose>
|
---|
337 | <!-- Copying the kernel config file -->
|
---|
338 | <xsl:when test="string() = 'make mrproper'">
|
---|
339 | <xsl:text>make mrproper
</xsl:text>
|
---|
340 | <xsl:if test="ancestor::sect1[@id='ch-bootable-kernel']">
|
---|
341 | <xsl:text>cp -v ../kernel-config .config
</xsl:text>
|
---|
342 | </xsl:if>
|
---|
343 | </xsl:when>
|
---|
344 | <!-- test instructions -->
|
---|
345 | <xsl:when test="@remap = 'test'">
|
---|
346 | <xsl:choose>
|
---|
347 | <xsl:when test="$testsuite = '0'"/>
|
---|
348 | <xsl:when test="$testsuite = '1' and
|
---|
349 | not(ancestor::sect1[@id='ch-system-gcc']) and
|
---|
350 | not(ancestor::sect1[@id='ch-system-glibc']) and
|
---|
351 | not(ancestor::sect1[@id='ch-system-gmp']) and
|
---|
352 | not(ancestor::sect1[@id='ch-system-mpfr']) and
|
---|
353 | not(ancestor::sect1[@id='ch-system-binutils'])"/>
|
---|
354 | <xsl:when test="$testsuite = '2' and
|
---|
355 | ancestor::chapter[@id='chapter-temporary-tools']"/>
|
---|
356 | <xsl:otherwise>
|
---|
357 | <xsl:choose>
|
---|
358 | <xsl:when test="$bomb-testsuite = 'n'">
|
---|
359 | <xsl:choose>
|
---|
360 | <!-- special case for glibc -->
|
---|
361 | <xsl:when test="contains(string(), 'glibc-check-log')">
|
---|
362 | <xsl:value-of
|
---|
363 | select="substring-before(string(),'2>&1')"/>
|
---|
364 | <xsl:text>>> $TEST_LOG 2>&1 || true
</xsl:text>
|
---|
365 | </xsl:when>
|
---|
366 | <!-- special case for procps-ng -->
|
---|
367 | <xsl:when test="contains(string(), 'pushd')">
|
---|
368 | <xsl:text>{ </xsl:text>
|
---|
369 | <xsl:apply-templates/>
|
---|
370 | <xsl:text>; } >> $TEST_LOG 2>&1 || true
</xsl:text>
|
---|
371 | </xsl:when>
|
---|
372 | <xsl:when test="contains(string(), 'make -k')">
|
---|
373 | <xsl:apply-templates/>
|
---|
374 | <xsl:text> >> $TEST_LOG 2>&1 || true
</xsl:text>
|
---|
375 | </xsl:when>
|
---|
376 | <xsl:when test="contains(string(), 'make')">
|
---|
377 | <xsl:value-of select="substring-before(string(),'make')"/>
|
---|
378 | <xsl:text>make -k</xsl:text>
|
---|
379 | <xsl:value-of select="substring-after(string(),'make')"/>
|
---|
380 | <xsl:text> >> $TEST_LOG 2>&1 || true
</xsl:text>
|
---|
381 | </xsl:when>
|
---|
382 | <xsl:otherwise>
|
---|
383 | <xsl:apply-templates/>
|
---|
384 | <xsl:if test="not(contains(string(), '>>'))">
|
---|
385 | <xsl:text> >> $TEST_LOG 2>&1</xsl:text>
|
---|
386 | </xsl:if>
|
---|
387 | <xsl:text>
</xsl:text>
|
---|
388 | </xsl:otherwise>
|
---|
389 | </xsl:choose>
|
---|
390 | </xsl:when>
|
---|
391 | <xsl:otherwise>
|
---|
392 | <!-- bomb-testsuite != 'n'-->
|
---|
393 | <xsl:choose>
|
---|
394 | <!-- special case for glibc -->
|
---|
395 | <xsl:when test="contains(string(), 'glibc-check-log')">
|
---|
396 | <xsl:value-of
|
---|
397 | select="substring-before(string(),'2>&1')"/>
|
---|
398 | <xsl:text>>> $TEST_LOG 2>&1 || true
</xsl:text>
|
---|
399 | </xsl:when>
|
---|
400 | <!-- special case for gmp -->
|
---|
401 | <xsl:when test="contains(string(), 'tee gmp-check-log')">
|
---|
402 | <xsl:text>(</xsl:text>
|
---|
403 | <xsl:apply-templates/>
|
---|
404 | <xsl:text>>> $TEST_LOG 2>&1 && exit $PIPESTATUS)
</xsl:text>
|
---|
405 | </xsl:when>
|
---|
406 | <!-- special case for procps-ng -->
|
---|
407 | <xsl:when test="contains(string(), 'pushd')">
|
---|
408 | <xsl:text>{ </xsl:text>
|
---|
409 | <xsl:apply-templates/>
|
---|
410 | <xsl:text>; } >> $TEST_LOG 2>&1
</xsl:text>
|
---|
411 | </xsl:when>
|
---|
412 | <xsl:when test="contains(string(), 'make -k')">
|
---|
413 | <xsl:apply-templates/>
|
---|
414 | <xsl:text> >> $TEST_LOG 2>&1 || true
</xsl:text>
|
---|
415 | </xsl:when>
|
---|
416 | <xsl:otherwise>
|
---|
417 | <xsl:apply-templates/>
|
---|
418 | <xsl:if test="not(contains(string(), '>>'))">
|
---|
419 | <xsl:text> >> $TEST_LOG 2>&1</xsl:text>
|
---|
420 | </xsl:if>
|
---|
421 | <xsl:text>
</xsl:text>
|
---|
422 | </xsl:otherwise>
|
---|
423 | </xsl:choose>
|
---|
424 | </xsl:otherwise>
|
---|
425 | </xsl:choose>
|
---|
426 | </xsl:otherwise>
|
---|
427 | </xsl:choose>
|
---|
428 | </xsl:when>
|
---|
429 | <!-- End of test instructions -->
|
---|
430 | <!-- Don't stop on strip run -->
|
---|
431 | <xsl:when test="contains(string(),'strip ')">
|
---|
432 | <xsl:apply-templates/>
|
---|
433 | <xsl:text> || true
</xsl:text>
|
---|
434 | </xsl:when>
|
---|
435 | <!-- Package management -->
|
---|
436 | <!-- Add $PKG_DEST to installation commands -->
|
---|
437 | <xsl:when test="@remap='install' and
|
---|
438 | not(ancestor::chapter[
|
---|
439 | @id='chapter-temporary-tools'
|
---|
440 | ])">
|
---|
441 | <xsl:choose>
|
---|
442 | <xsl:when test="$pkgmngt='n'">
|
---|
443 | <xsl:choose>
|
---|
444 | <xsl:when test="contains(string(),'firmware,udev')">
|
---|
445 | <xsl:text>if [[ ! -d /lib/udev/devices ]] ; then
</xsl:text>
|
---|
446 | <xsl:apply-templates/>
|
---|
447 | <xsl:text>
fi
</xsl:text>
|
---|
448 | </xsl:when>
|
---|
449 | <xsl:otherwise>
|
---|
450 | <xsl:apply-templates/>
|
---|
451 | <xsl:text>
</xsl:text>
|
---|
452 | </xsl:otherwise>
|
---|
453 | </xsl:choose>
|
---|
454 | </xsl:when>
|
---|
455 | <xsl:otherwise><!--pkgmngt = 'y'-->
|
---|
456 | <xsl:choose>
|
---|
457 | <xsl:when test="./literal">
|
---|
458 | <xsl:call-template name="outputpkgdest">
|
---|
459 | <xsl:with-param name="outputstring" select="text()[1]"/>
|
---|
460 | </xsl:call-template>
|
---|
461 | <xsl:apply-templates select="literal"/>
|
---|
462 | <xsl:call-template name="outputpkgdest">
|
---|
463 | <xsl:with-param name="outputstring" select="text()[2]"/>
|
---|
464 | </xsl:call-template>
|
---|
465 | </xsl:when>
|
---|
466 | <xsl:otherwise>
|
---|
467 | <xsl:call-template name="outputpkgdest">
|
---|
468 | <xsl:with-param name="outputstring" select="string()"/>
|
---|
469 | </xsl:call-template>
|
---|
470 | </xsl:otherwise>
|
---|
471 | </xsl:choose>
|
---|
472 | </xsl:otherwise>
|
---|
473 | </xsl:choose>
|
---|
474 | </xsl:when>
|
---|
475 | <!-- if package management, we should make an independant package for
|
---|
476 | tzdata. -->
|
---|
477 | <xsl:when test="contains(string(),'tzdata') and $pkgmngt='y'">
|
---|
478 | <xsl:text>
|
---|
479 | OLD_PKG_DEST=$PKG_DEST
|
---|
480 | OLD_PKGDIR=$PKGDIR
|
---|
481 | PKG_DEST=$(dirname $OLD_PKG_DEST)/001-tzdata
|
---|
482 | PKGDIR=$(dirname $PKGDIR)/tzdata-</xsl:text>
|
---|
483 | <xsl:copy-of select="substring-before(
|
---|
484 | substring-after(string(),'tzdata'),
|
---|
485 | '.tar')"/>
|
---|
486 | <xsl:text>
|
---|
487 | </xsl:text>
|
---|
488 | <xsl:copy-of select="substring-before(string(),'ZONEINFO=')"/>
|
---|
489 | <xsl:text>ZONEINFO=$PKG_DEST</xsl:text>
|
---|
490 | <xsl:copy-of select="substring-after(string(),'ZONEINFO=')"/>
|
---|
491 | <xsl:text>
|
---|
492 | packInstall
|
---|
493 | rm -rf $PKG_DEST
|
---|
494 | PKG_DEST=$OLD_PKG_DEST
|
---|
495 | unset OLD_PKG_DEST
|
---|
496 | PKGDIR=$OLD_PKGDIR
|
---|
497 | unset OLD_PKGDIR
|
---|
498 | </xsl:text>
|
---|
499 | </xsl:when><!-- addition for tzdata + package management -->
|
---|
500 | <!-- End addition for package management -->
|
---|
501 | <!-- The rest of commands -->
|
---|
502 | <xsl:otherwise>
|
---|
503 | <xsl:apply-templates/>
|
---|
504 | <xsl:text>
</xsl:text>
|
---|
505 | </xsl:otherwise>
|
---|
506 | </xsl:choose>
|
---|
507 | </xsl:template>
|
---|
508 |
|
---|
509 | <xsl:template match="replaceable">
|
---|
510 | <xsl:choose>
|
---|
511 | <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
|
---|
512 | <xsl:value-of select="$timezone"/>
|
---|
513 | </xsl:when>
|
---|
514 | <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
|
---|
515 | <xsl:value-of select="$page"/>
|
---|
516 | </xsl:when>
|
---|
517 | <xsl:when test="contains(string(.),'<ll>_<CC>')">
|
---|
518 | <xsl:value-of select="$lang"/>
|
---|
519 | </xsl:when>
|
---|
520 | <xsl:when test="contains(string(.),'Domain')">
|
---|
521 | <xsl:value-of select="$domain"/>
|
---|
522 | </xsl:when>
|
---|
523 | <xsl:when test="contains(string(.),'primary')">
|
---|
524 | <xsl:value-of select="$nameserver1"/>
|
---|
525 | </xsl:when>
|
---|
526 | <xsl:when test="contains(string(.),'secondary')">
|
---|
527 | <xsl:value-of select="$nameserver2"/>
|
---|
528 | </xsl:when>
|
---|
529 | <xsl:when test="contains(string(.),'192.168.1.1')">
|
---|
530 | <xsl:value-of select="$ip"/>
|
---|
531 | </xsl:when>
|
---|
532 | <xsl:when test="contains(string(.),'HOSTNAME')">
|
---|
533 | <xsl:value-of select="$hostname"/>
|
---|
534 | <xsl:text>.</xsl:text>
|
---|
535 | <xsl:value-of select="$domain"/>
|
---|
536 | </xsl:when>
|
---|
537 | <xsl:when test="contains(string(.),'alias')">
|
---|
538 | <xsl:value-of select="$hostname"/>
|
---|
539 | </xsl:when>
|
---|
540 | <xsl:when test="contains(string(.),'<lfs>')">
|
---|
541 | <xsl:value-of select="$hostname"/>
|
---|
542 | </xsl:when>
|
---|
543 | <xsl:otherwise>
|
---|
544 | <xsl:text>**EDITME</xsl:text>
|
---|
545 | <xsl:apply-templates/>
|
---|
546 | <xsl:text>EDITME**</xsl:text>
|
---|
547 | </xsl:otherwise>
|
---|
548 | </xsl:choose>
|
---|
549 | </xsl:template>
|
---|
550 |
|
---|
551 | <xsl:template match="literal">
|
---|
552 | <xsl:choose>
|
---|
553 | <xsl:when test="contains(string(),'ONBOOT')">
|
---|
554 | <xsl:call-template name="outputnet">
|
---|
555 | <xsl:with-param name="netstring" select="string()"/>
|
---|
556 | </xsl:call-template>
|
---|
557 | </xsl:when>
|
---|
558 | <xsl:otherwise>
|
---|
559 | <xsl:apply-templates/>
|
---|
560 | </xsl:otherwise>
|
---|
561 | </xsl:choose>
|
---|
562 | </xsl:template>
|
---|
563 |
|
---|
564 | <xsl:template name="outputnet">
|
---|
565 | <xsl:param name="netstring" select="''"/>
|
---|
566 | <!-- We suppose that book example has the following values:
|
---|
567 | - interface: eth0
|
---|
568 | - ip: 192.168.1.2
|
---|
569 | - gateway: 192.168.1.1
|
---|
570 | - prefix: 24
|
---|
571 | - broadcast: 192.168.1.255
|
---|
572 | Change below if book changes -->
|
---|
573 | <xsl:choose>
|
---|
574 | <xsl:when test="contains($netstring,'eth0')">
|
---|
575 | <xsl:call-template name="outputnet">
|
---|
576 | <xsl:with-param name="netstring"
|
---|
577 | select="substring-before($netstring,'eth0')"/>
|
---|
578 | </xsl:call-template>
|
---|
579 | <xsl:value-of select="$interface"/>
|
---|
580 | <xsl:call-template name="outputnet">
|
---|
581 | <xsl:with-param name="netstring"
|
---|
582 | select="substring-after($netstring,'eth0')"/>
|
---|
583 | </xsl:call-template>
|
---|
584 | </xsl:when>
|
---|
585 | <xsl:when test="contains($netstring,'192.168.1.1')">
|
---|
586 | <xsl:call-template name="outputnet">
|
---|
587 | <xsl:with-param name="netstring"
|
---|
588 | select="substring-before($netstring,'192.168.1.1')"/>
|
---|
589 | </xsl:call-template>
|
---|
590 | <xsl:value-of select="$gateway"/>
|
---|
591 | <xsl:call-template name="outputnet">
|
---|
592 | <xsl:with-param name="netstring"
|
---|
593 | select="substring-after($netstring,'192.168.1.1')"/>
|
---|
594 | </xsl:call-template>
|
---|
595 | </xsl:when>
|
---|
596 | <!-- must test this before the following, because 192.168.1.255 contains
|
---|
597 | 192.168.1.2! -->
|
---|
598 | <xsl:when test="contains($netstring,'192.168.1.255')">
|
---|
599 | <xsl:call-template name="outputnet">
|
---|
600 | <xsl:with-param name="netstring"
|
---|
601 | select="substring-before($netstring,'192.168.1.255')"/>
|
---|
602 | </xsl:call-template>
|
---|
603 | <xsl:value-of select="$broadcast"/>
|
---|
604 | <xsl:call-template name="outputnet">
|
---|
605 | <xsl:with-param name="netstring"
|
---|
606 | select="substring-after($netstring,'192.168.1.255')"/>
|
---|
607 | </xsl:call-template>
|
---|
608 | </xsl:when>
|
---|
609 | <xsl:when test="contains($netstring,'192.168.1.2')">
|
---|
610 | <xsl:call-template name="outputnet">
|
---|
611 | <xsl:with-param name="netstring"
|
---|
612 | select="substring-before($netstring,'192.168.1.2')"/>
|
---|
613 | </xsl:call-template>
|
---|
614 | <xsl:value-of select="$ip"/>
|
---|
615 | <xsl:call-template name="outputnet">
|
---|
616 | <xsl:with-param name="netstring"
|
---|
617 | select="substring-after($netstring,'192.168.1.2')"/>
|
---|
618 | </xsl:call-template>
|
---|
619 | </xsl:when>
|
---|
620 | <xsl:when test="contains($netstring,'24')">
|
---|
621 | <xsl:call-template name="outputnet">
|
---|
622 | <xsl:with-param name="netstring"
|
---|
623 | select="substring-before($netstring,'24')"/>
|
---|
624 | </xsl:call-template>
|
---|
625 | <xsl:value-of select="$prefix"/>
|
---|
626 | <xsl:call-template name="outputnet">
|
---|
627 | <xsl:with-param name="netstring"
|
---|
628 | select="substring-after($netstring,'24')"/>
|
---|
629 | </xsl:call-template>
|
---|
630 | </xsl:when>
|
---|
631 | <xsl:otherwise>
|
---|
632 | <xsl:value-of select="$netstring"/>
|
---|
633 | </xsl:otherwise>
|
---|
634 | </xsl:choose>
|
---|
635 | </xsl:template>
|
---|
636 |
|
---|
637 | <xsl:template name="outputpkgdest">
|
---|
638 | <xsl:param name="outputstring" select="foo"/>
|
---|
639 | <xsl:choose>
|
---|
640 | <xsl:when test="contains($outputstring,'make ')">
|
---|
641 | <xsl:choose>
|
---|
642 | <xsl:when test="not(starts-with($outputstring,'make'))">
|
---|
643 | <xsl:call-template name="outputpkgdest">
|
---|
644 | <xsl:with-param name="outputstring"
|
---|
645 | select="substring-before($outputstring,'make')"/>
|
---|
646 | </xsl:call-template>
|
---|
647 | <xsl:call-template name="outputpkgdest">
|
---|
648 | <xsl:with-param
|
---|
649 | name="outputstring"
|
---|
650 | select="substring-after($outputstring,
|
---|
651 | substring-before($outputstring,'make'))"/>
|
---|
652 | </xsl:call-template>
|
---|
653 | </xsl:when>
|
---|
654 | <xsl:otherwise>
|
---|
655 | <xsl:choose>
|
---|
656 | <!-- special cases (no DESTDIR) here -->
|
---|
657 | <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
|
---|
658 | <xsl:text>make install_root=$PKG_DEST -j1</xsl:text>
|
---|
659 | <xsl:value-of
|
---|
660 | select="substring-before(substring-after(string(),'make'),
|
---|
661 | 'install')"/>
|
---|
662 | <xsl:text>install
</xsl:text>
|
---|
663 | </xsl:when>
|
---|
664 | <xsl:when test="ancestor::sect1[@id='ch-system-bzip2']">
|
---|
665 | <xsl:text>make PREFIX=$PKG_DEST/usr install
</xsl:text>
|
---|
666 | </xsl:when>
|
---|
667 | <xsl:when test="ancestor::sect1[@id='ch-system-sysklogd']">
|
---|
668 | <xsl:text>make BINDIR=$PKG_DEST/sbin prefix=$PKG_DEST install
</xsl:text>
|
---|
669 | </xsl:when>
|
---|
670 | <xsl:when test="ancestor::sect1[@id='ch-system-iproute2']">
|
---|
671 | <xsl:text>make DESTDIR=$PKG_DEST DOCDIR=</xsl:text>
|
---|
672 | <xsl:value-of
|
---|
673 | select="substring-before(substring-after(string(),'DOCDIR='),
|
---|
674 | 'install')"/>
|
---|
675 | <xsl:text>install
</xsl:text>
|
---|
676 | </xsl:when>
|
---|
677 | <xsl:when test="ancestor::sect1[@id='ch-system-sysvinit']">
|
---|
678 | <xsl:text>make ROOT=$PKG_DEST</xsl:text>
|
---|
679 | <xsl:value-of
|
---|
680 | select="substring-before(substring-after(string(),'make'),
|
---|
681 | 'install')"/>
|
---|
682 | <xsl:text>install
</xsl:text>
|
---|
683 | </xsl:when>
|
---|
684 | <xsl:when test="ancestor::sect1[@id='ch-bootable-kernel']">
|
---|
685 | <xsl:text>make INSTALL_MOD_PATH=$PKG_DEST</xsl:text>
|
---|
686 | <xsl:value-of
|
---|
687 | select="substring-before(substring-after(string(),'make'),
|
---|
688 | 'install')"/>
|
---|
689 | <xsl:text>install
</xsl:text>
|
---|
690 | </xsl:when>
|
---|
691 | <xsl:when test="ancestor::sect1[@id='ch-system-attr']">
|
---|
692 | <xsl:text>DIST_ROOT=$PKG_DEST make</xsl:text>
|
---|
693 | <xsl:call-template name="outputpkgdest">
|
---|
694 | <xsl:with-param name="outputstring"
|
---|
695 | select="substring-after($outputstring,'make')"/>
|
---|
696 | </xsl:call-template>
|
---|
697 | </xsl:when>
|
---|
698 | <xsl:otherwise>
|
---|
699 | <xsl:text>make DESTDIR=$PKG_DEST</xsl:text>
|
---|
700 | <xsl:call-template name="outputpkgdest">
|
---|
701 | <xsl:with-param
|
---|
702 | name="outputstring"
|
---|
703 | select="substring-after($outputstring,'make')"/>
|
---|
704 | </xsl:call-template>
|
---|
705 | </xsl:otherwise>
|
---|
706 | </xsl:choose>
|
---|
707 | </xsl:otherwise>
|
---|
708 | </xsl:choose>
|
---|
709 | </xsl:when>
|
---|
710 | <xsl:otherwise> <!-- no make in this string -->
|
---|
711 | <xsl:choose>
|
---|
712 | <xsl:when test="contains($outputstring,'>/') and
|
---|
713 | not(contains(substring-before($outputstring,'>/'),' /'))">
|
---|
714 | <xsl:value-of select="substring-before($outputstring,'>/')"/>
|
---|
715 | <xsl:text>>$PKG_DEST/</xsl:text>
|
---|
716 | <xsl:call-template name="outputpkgdest">
|
---|
717 | <xsl:with-param name="outputstring" select="substring-after($outputstring,'>/')"/>
|
---|
718 | </xsl:call-template>
|
---|
719 | </xsl:when>
|
---|
720 | <xsl:when test="contains($outputstring,' /')">
|
---|
721 | <xsl:value-of select="substring-before($outputstring,' /')"/>
|
---|
722 | <xsl:text> $PKG_DEST/</xsl:text>
|
---|
723 | <xsl:call-template name="outputpkgdest">
|
---|
724 | <xsl:with-param name="outputstring" select="substring-after($outputstring,' /')"/>
|
---|
725 | </xsl:call-template>
|
---|
726 | </xsl:when>
|
---|
727 | <xsl:otherwise>
|
---|
728 | <xsl:value-of select="$outputstring"/>
|
---|
729 | <xsl:text>
</xsl:text>
|
---|
730 | </xsl:otherwise>
|
---|
731 | </xsl:choose>
|
---|
732 | </xsl:otherwise>
|
---|
733 | </xsl:choose>
|
---|
734 | </xsl:template>
|
---|
735 | </xsl:stylesheet>
|
---|