source: LFS/lfs.xsl@ fbbe081

ablfs-more legacy trunk
Last change on this file since fbbe081 was 88a8275, checked in by Pierre Labastie <pierre@…>, 4 years ago

lfs.xsl: mode=pkgmngt: use $pos and not position() when calling

start-script

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