source: LFS/lfs.xsl@ 2f8d952

ablfs-more legacy trunk
Last change on this file since 2f8d952 was 3ac3ae1, checked in by Pierre Labastie <pierre@…>, 4 years ago

Change numberings of scriptlets:

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