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