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