source: BLFS/xsl/scripts.xsl@ d2a7ec8

ablfs-more legacy trunk
Last change on this file since d2a7ec8 was dc7fd7b, checked in by Pierre Labastie <pierre@…>, 7 years ago

Add .la file removal to LFS and BLFS scripts

  • Property mode set to 100644
File size: 22.8 KB
RevLine 
[e576789]1<?xml version="1.0"?>
2
3<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:exsl="http://exslt.org/common"
5 extension-element-prefixes="exsl"
6 version="1.0">
7
[56178ba]8<!-- $Id$ -->
[e576789]9
10<!-- XSLT stylesheet to create shell scripts from "linear build" BLFS books. -->
11
[70d73d1]12<!-- Check whether the book is sysv or systemd -->
13 <xsl:variable name="rev">
14 <xsl:choose>
15 <xsl:when test="//bookinfo/title/phrase[@revision='systemd']">
16 systemd
17 </xsl:when>
18 <xsl:otherwise>
19 sysv
20 </xsl:otherwise>
21 </xsl:choose>
22 </xsl:variable>
23
[945ccaa]24 <!-- Wrap "root" commands inside a wrapper function, allowing
25 "porg style" package management -->
26 <xsl:param name="wrap-install" select="'n'"/>
27
[dc7fd7b]28 <!-- Remove libtool .la files -->
29 <xsl:param name="del-la-files" select="'y'"/>
30
[e576789]31 <!-- Build as user (y) or as root (n)? -->
32 <xsl:param name="sudo" select="'y'"/>
33
[dc7fd7b]34<!-- simple instructions for removing .la files. -->
35 <xsl:variable name="la-files-instr">
36
37for libdir in /lib /usr/lib $(find /opt -name lib); do
38 find $libdir -name \*.la ! -path \*ImageMagick\* -delete
39done
40
41</xsl:variable>
[e576789]42 <xsl:template match="/">
43 <xsl:apply-templates select="//sect1"/>
44 </xsl:template>
45
46<!--=================== Master chunks code ======================-->
47
48 <xsl:template match="sect1">
49
[70d73d1]50 <xsl:if test="@id != 'bootscripts' and @id != 'systemd-units'">
[e576789]51 <!-- The file names -->
52 <xsl:variable name="filename" select="@id"/>
53
54 <!-- The build order -->
55 <xsl:variable name="position" select="position()"/>
56 <xsl:variable name="order">
57 <xsl:choose>
58 <xsl:when test="string-length($position) = 1">
59 <xsl:text>00</xsl:text>
60 <xsl:value-of select="$position"/>
61 </xsl:when>
62 <xsl:when test="string-length($position) = 2">
63 <xsl:text>0</xsl:text>
64 <xsl:value-of select="$position"/>
65 </xsl:when>
66 <xsl:otherwise>
67 <xsl:value-of select="$position"/>
68 </xsl:otherwise>
69 </xsl:choose>
70 </xsl:variable>
71
72 <!-- Depuration code -->
73 <xsl:message>
74 <xsl:text>SCRIPT is </xsl:text>
75 <xsl:value-of select="concat($order,'-z-',$filename)"/>
76 <xsl:text>&#xA; FTPDIR is </xsl:text>
77 <xsl:value-of select="$filename"/>
78 <xsl:text>&#xA;&#xA;</xsl:text>
79 </xsl:message>
80
81 <!-- Creating the scripts -->
82 <exsl:document href="{$order}-z-{$filename}" method="text">
83 <xsl:text>#!/bin/bash&#xA;set -e&#xA;&#xA;</xsl:text>
84 <xsl:choose>
85 <!-- Package page -->
[642722f]86 <xsl:when test="sect2[@role='package']">
[945ccaa]87 <!-- We build in a subdirectory, whose name may be needed
88 if using package management (see envars.conf), so
89 "export" it -->
90 <xsl:text>export PKG_DIR=</xsl:text>
[e576789]91 <xsl:value-of select="$filename"/>
[39dc04a]92 <xsl:text>
93SRC_DIR=${SRC_ARCHIVE}${SRC_SUBDIRS:+/${PKG_DIR}}
94BUILD_DIR=${BUILD_ROOT}${BUILD_SUBDIRS:+/${PKG_DIR}}
95mkdir -p $SRC_DIR
96mkdir -p $BUILD_DIR
97
98</xsl:text>
[e576789]99 <!-- Download code and build commands -->
100 <xsl:apply-templates select="sect2"/>
101 <!-- Clean-up -->
[39dc04a]102 <xsl:text>cd $BUILD_DIR
103[[ -n "$KEEP_FILES" ]] || </xsl:text>
[e576789]104 <!-- In some case, some files in the build tree are owned
105 by root -->
[642722f]106 <xsl:if test="$sudo='y'">
107 <xsl:text>sudo </xsl:text>
[e576789]108 </xsl:if>
[642722f]109 <xsl:text>rm -rf $UNPACKDIR unpacked&#xA;&#xA;</xsl:text>
[e576789]110 </xsl:when>
111 <!-- Non-package page -->
112 <xsl:otherwise>
113 <xsl:apply-templates select=".//screen"/>
114 </xsl:otherwise>
115 </xsl:choose>
116 <xsl:text>exit</xsl:text>
117 </exsl:document>
118 </xsl:if>
119 </xsl:template>
120
121<!--======================= Sub-sections code =======================-->
122
123 <xsl:template match="sect2">
124 <xsl:choose>
125 <xsl:when test="@role = 'package'">
[39dc04a]126 <xsl:text>cd $SRC_DIR
127</xsl:text>
[642722f]128 <!-- Download information is in bridgehead tags -->
[e576789]129 <xsl:apply-templates select="bridgehead[@renderas='sect3']"/>
130 <xsl:text>&#xA;</xsl:text>
131 </xsl:when>
[967b819]132 <xsl:when test="@role = 'qt4-prefix' or @role = 'qt5-prefix'">
133 <xsl:apply-templates select=".//screen"/>
134 </xsl:when>
[e576789]135 <xsl:when test="@role = 'installation'">
136 <xsl:text>
[39dc04a]137cd $BUILD_DIR
[07f7eff]138find . -maxdepth 1 -mindepth 1 -type d | xargs </xsl:text>
139 <xsl:if test="$sudo='y'">
140 <xsl:text>sudo </xsl:text>
141 </xsl:if>
142 <xsl:text>rm -rf
[67992a0]143case $PACKAGE in
[e6967a1]144 *.tar.gz|*.tar.bz2|*.tar.xz|*.tgz|*.tar.lzma)
[39dc04a]145 tar -xvf $SRC_DIR/$PACKAGE &gt; unpacked
[6eaae5e]146 UNPACKDIR=`grep '[^./]\+' unpacked | head -n1 | sed 's@^\./@@;s@/.*@@'`
147 ;;
148 *.tar.lz)
[39dc04a]149 bsdtar -xvf $SRC_DIR/$PACKAGE 2&gt; unpacked
[6eaae5e]150 UNPACKDIR=`head -n1 unpacked | cut -d" " -f2 | sed 's@^\./@@;s@/.*@@'`
[67992a0]151 ;;
152 *.zip)
[39dc04a]153 zipinfo -1 $SRC_DIR/$PACKAGE &gt; unpacked
[67992a0]154 UNPACKDIR="$(sed 's@/.*@@' unpacked | uniq )"
155 if test $(wc -w &lt;&lt;&lt; $UNPACKDIR) -eq 1; then
[39dc04a]156 unzip $SRC_DIR/$PACKAGE
[67992a0]157 else
158 UNPACKDIR=${PACKAGE%.zip}
[39dc04a]159 unzip -d $UNPACKDIR $SRC_DIR/$PACKAGE
[67992a0]160 fi
161 ;;
162 *)
163 UNPACKDIR=$PKG_DIR-build
164 mkdir $UNPACKDIR
[9da16d9]165 cp $SRC_DIR/$PACKAGE $UNPACKDIR
166 cp $(find . -mindepth 1 -maxdepth 1 -type l) $UNPACKDIR
[67992a0]167 ;;
168esac
[945ccaa]169export UNPACKDIR
[67992a0]170cd $UNPACKDIR&#xA;
171</xsl:text>
[e576789]172 <xsl:apply-templates select=".//screen | .//para/command"/>
173 <xsl:if test="$sudo = 'y'">
174 <xsl:text>sudo /sbin/</xsl:text>
175 </xsl:if>
176 <xsl:text>ldconfig&#xA;&#xA;</xsl:text>
177 </xsl:when>
178 <xsl:when test="@role = 'configuration'">
179 <xsl:apply-templates select=".//screen" mode="config"/>
180 </xsl:when>
181 </xsl:choose>
182 </xsl:template>
183
184<!--==================== Download code =======================-->
185
[642722f]186 <!-- template for extracting the filename from an url in the form:
187 proto://internet.name/dir1/.../dirn/filename?condition.
188 Needed, because substring-after(...,'/') returns only the
189 substring after the first '/'. -->
[e576789]190 <xsl:template name="package_name">
191 <xsl:param name="url" select="foo"/>
192 <xsl:param name="sub-url" select="substring-after($url,'/')"/>
193 <xsl:choose>
194 <xsl:when test="contains($sub-url,'/')">
195 <xsl:call-template name="package_name">
196 <xsl:with-param name="url" select="$sub-url"/>
197 </xsl:call-template>
198 </xsl:when>
199 <xsl:otherwise>
200 <xsl:choose>
201 <xsl:when test="contains($sub-url,'?')">
202 <xsl:value-of select="substring-before($sub-url,'?')"/>
203 </xsl:when>
204 <xsl:otherwise>
205 <xsl:value-of select="$sub-url"/>
206 </xsl:otherwise>
207 </xsl:choose>
208 </xsl:otherwise>
209 </xsl:choose>
210 </xsl:template>
211
[642722f]212 <!-- Generates the code to download a package, an additional package or
213 a patch. -->
214 <xsl:template name="download-file">
215 <xsl:param name="httpurl" select="''"/>
216 <xsl:param name="ftpurl" select="''"/>
217 <xsl:param name="md5" select="''"/>
218 <xsl:param name="varname" select="''"/>
219 <xsl:variable name="package">
220 <xsl:call-template name="package_name">
221 <xsl:with-param name="url">
[e576789]222 <xsl:choose>
[642722f]223 <xsl:when test="string-length($httpurl) &gt; 10">
224 <xsl:value-of select="$httpurl"/>
[e576789]225 </xsl:when>
226 <xsl:otherwise>
[642722f]227 <xsl:value-of select="$ftpurl"/>
[e576789]228 </xsl:otherwise>
229 </xsl:choose>
[642722f]230 </xsl:with-param>
231 </xsl:call-template>
232 </xsl:variable>
233 <xsl:variable name="first_letter"
234 select="translate(substring($package,1,1),
235 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
236 'abcdefghijklmnopqrstuvwxyz')"/>
237 <xsl:text>&#xA;</xsl:text>
238 <xsl:value-of select="$varname"/>
239 <xsl:text>=</xsl:text>
240 <xsl:value-of select="$package"/>
241 <xsl:text>&#xA;if [[ ! -f $</xsl:text>
242 <xsl:value-of select="$varname"/>
[8dc4646]243 <xsl:text> ]] ; then
244 if [[ -f $SRC_ARCHIVE/$</xsl:text>
[642722f]245 <xsl:value-of select="$varname"/>
246 <xsl:text> ]] ; then&#xA;</xsl:text>
247 <xsl:text> cp $SRC_ARCHIVE/$</xsl:text>
248 <xsl:value-of select="$varname"/>
249 <xsl:text> $</xsl:text>
250 <xsl:value-of select="$varname"/>
[8dc4646]251 <xsl:text>
252 else&#xA;</xsl:text>
[342c862]253 <!-- Download from upstream http -->
[642722f]254 <xsl:if test="string-length($httpurl) &gt; 10">
[8dc4646]255 <xsl:text> wget -T 30 -t 5 </xsl:text>
[642722f]256 <xsl:value-of select="$httpurl"/>
[342c862]257 <xsl:text> ||&#xA;</xsl:text>
[642722f]258 </xsl:if>
[342c862]259 <!-- Download from upstream ftp -->
[642722f]260 <xsl:if test="string-length($ftpurl) &gt; 10">
[8dc4646]261 <xsl:text> wget -T 30 -t 5 </xsl:text>
[642722f]262 <xsl:value-of select="$ftpurl"/>
[342c862]263 <xsl:text> ||&#xA;</xsl:text>
[642722f]264 </xsl:if>
[342c862]265 <!-- The FTP_SERVER mirror as a last resort -->
[8dc4646]266 <xsl:text> wget -T 30 -t 5 ${FTP_SERVER}svn/</xsl:text>
[342c862]267 <xsl:value-of select="$first_letter"/>
268 <xsl:text>/$</xsl:text>
269 <xsl:value-of select="$varname"/>
[8dc4646]270 <xsl:text><!--
271 cp $</xsl:text>
[642722f]272 <xsl:value-of select="$varname"/>
[8dc4646]273 <xsl:text> $SRC_ARCHIVE-->
274 fi
[e576789]275fi
276</xsl:text>
[642722f]277 <xsl:if test="string-length($md5) &gt; 10">
278 <xsl:text>echo "</xsl:text>
279 <xsl:value-of select="$md5"/>
280 <xsl:text>&#x20;&#x20;$</xsl:text>
281 <xsl:value-of select="$varname"/>
282 <xsl:text>" | md5sum -c -
[39dc04a]283</xsl:text>
284 </xsl:if>
285<!-- link additional packages into $BUILD_DIR, because they are supposed to
286 be there-->
287 <xsl:if test="string($varname) != 'PACKAGE'">
[8dc4646]288 <xsl:text>[[ "$SRC_DIR" != "$BUILD_DIR" ]] &amp;&amp; ln -sf $SRC_DIR/$</xsl:text>
[39dc04a]289 <xsl:value-of select="$varname"/>
290 <xsl:text> $BUILD_DIR
[e576789]291</xsl:text>
[642722f]292 </xsl:if>
293 </xsl:template>
294
295 <!-- Extract the MD5 sum information -->
296 <xsl:template match="para" mode="md5">
297 <xsl:choose>
298 <xsl:when test="contains(substring-after(string(),'sum: '),'&#xA;')">
299 <xsl:value-of select="substring-before(substring-after(string(),'sum: '),'&#xA;')"/>
[e576789]300 </xsl:when>
[642722f]301 <xsl:otherwise>
302 <xsl:value-of select="substring-after(string(),'sum: ')"/>
303 </xsl:otherwise>
[e576789]304 </xsl:choose>
305 </xsl:template>
306
[642722f]307 <!-- We have several templates itemizedlist, depending on whether we
308 expect the package information, or additional package(s) or patch(es)
309 information. Select the appropriate mode here. -->
310 <xsl:template match="bridgehead">
[e576789]311 <xsl:choose>
[642722f]312 <!-- Special case for Openjdk -->
313 <xsl:when test="contains(string(),'Source Package Information')">
314 <xsl:apply-templates
315 select="following-sibling::itemizedlist[1]//simplelist">
316 <xsl:with-param name="varname" select="'PACKAGE'"/>
317 </xsl:apply-templates>
318 <xsl:apply-templates select="following-sibling::itemizedlist
319 [preceding-sibling::bridgehead[1]=current()
320 and position() &gt;1]//simplelist">
321 <xsl:with-param name="varname" select="'PACKAGE1'"/>
322 </xsl:apply-templates>
[e576789]323 </xsl:when>
[642722f]324 <!-- Package information -->
325 <xsl:when test="contains(string(),'Package Information')">
326 <xsl:apply-templates select="following-sibling::itemizedlist
327 [preceding-sibling::bridgehead[1]=current()]"
328 mode="package"/>
[e576789]329 </xsl:when>
[642722f]330 <!-- Additional package information -->
[ba57e61]331 <!-- special case for llvm -->
332 <xsl:when test="contains(string(),'Optional Download')">
333 <xsl:apply-templates select="following-sibling::itemizedlist"
334 mode="additional"/>
335 </xsl:when>
336 <!-- All other additional packages have "Additional" -->
[642722f]337 <xsl:when test="contains(string(),'Additional')">
338 <xsl:apply-templates select="following-sibling::itemizedlist"
339 mode="additional"/>
[e576789]340 </xsl:when>
[642722f]341 <!-- Do not do anything if the dev has created another type of
342 bridgehead. -->
343 <xsl:otherwise/>
[e576789]344 </xsl:choose>
345 </xsl:template>
346
[642722f]347 <!-- Call the download code template with appropriate parameters -->
348 <xsl:template match="itemizedlist" mode="package">
349 <xsl:call-template name="download-file">
350 <xsl:with-param name="httpurl">
351 <xsl:value-of select="./listitem[1]/para/ulink/@url"/>
352 </xsl:with-param>
353 <xsl:with-param name="ftpurl">
354 <xsl:value-of select="./listitem/para[contains(string(),'FTP')]/ulink/@url"/>
355 </xsl:with-param>
356 <xsl:with-param name="md5">
357 <xsl:apply-templates select="./listitem/para[contains(string(),'MD5')]"
358 mode="md5"/>
359 </xsl:with-param>
360 <xsl:with-param name="varname" select="'PACKAGE'"/>
361 </xsl:call-template>
[e576789]362 </xsl:template>
363
[642722f]364 <xsl:template match="itemizedlist" mode="additional">
365 <!-- The normal layout is "one listitem"<->"one url", but some devs
366 find amusing to have FTP and/or MD5sum listitems, or to
367 enclose the download information inside a simplelist tag... -->
368 <xsl:for-each select="listitem[.//ulink]">
369 <xsl:choose>
370 <!-- hopefully, there was a HTTP line before -->
371 <xsl:when test="contains(string(./para),'FTP')"/>
372 <xsl:when test=".//simplelist">
373 <xsl:apply-templates select=".//simplelist">
374 <xsl:with-param name="varname" select="'PACKAGE1'"/>
375 </xsl:apply-templates>
376 </xsl:when>
377 <xsl:otherwise>
378 <xsl:call-template name="download-file">
379 <xsl:with-param name="httpurl">
380 <xsl:value-of select="./para/ulink/@url"/>
381 </xsl:with-param>
382 <xsl:with-param name="ftpurl">
383 <xsl:value-of
384 select="following-sibling::listitem[1]/
385 para[contains(string(),'FTP')]/ulink/@url"/>
386 </xsl:with-param>
387 <xsl:with-param name="md5">
388 <xsl:apply-templates
389 select="following-sibling::listitem[position()&lt;3]/
390 para[contains(string(),'MD5')]"
391 mode="md5"/>
392 </xsl:with-param>
393 <xsl:with-param name="varname">
394 <xsl:choose>
395 <xsl:when test="contains(./para/ulink/@url,'.patch')">
396 <xsl:text>PATCH</xsl:text>
397 </xsl:when>
398 <xsl:otherwise>
399 <xsl:text>PACKAGE1</xsl:text>
400 </xsl:otherwise>
401 </xsl:choose>
402 </xsl:with-param>
403 </xsl:call-template>
404 </xsl:otherwise>
405 </xsl:choose>
406 </xsl:for-each>
[e576789]407 </xsl:template>
408
[642722f]409 <!-- the simplelist case. Hopefully, the layout is one member for
410 url, one for md5 and others for various information, that we do not
411 use -->
412 <xsl:template match="simplelist">
413 <xsl:param name="varname" select="'PACKAGE1'"/>
414 <xsl:call-template name="download-file">
415 <xsl:with-param name="httpurl" select=".//ulink/@url"/>
416 <xsl:with-param name="md5">
417 <xsl:value-of select="substring-after(member[contains(string(),'MD5')],'sum: ')"/>
418 </xsl:with-param>
419 <xsl:with-param name="varname" select="$varname"/>
420 </xsl:call-template>
421 </xsl:template>
[e576789]422<!--======================== Commands code ==========================-->
423
424 <xsl:template match="screen">
425 <xsl:if test="child::* = userinput and not(@role = 'nodump')">
426 <xsl:choose>
427 <xsl:when test="@role = 'root'">
[945ccaa]428 <xsl:if test="not(preceding-sibling::screen[1][@role='root'])">
429 <xsl:if test="$sudo = 'y'">
430 <xsl:text>sudo -E sh &lt;&lt; ROOT_EOF&#xA;</xsl:text>
431 </xsl:if>
432 <xsl:if test="$wrap-install = 'y' and
433 ancestor::sect2[@role='installation']">
434 <xsl:text>if [ -r "$PACK_INSTALL" ]; then
435 source $PACK_INSTALL
436 export -f wrapInstall
437 export -f packInstall
438fi
439wrapInstall '
440</xsl:text>
441 </xsl:if>
[e576789]442 </xsl:if>
443 <xsl:apply-templates mode="root"/>
[945ccaa]444 <xsl:if test="not(following-sibling::screen[1][@role='root'])">
[dc7fd7b]445 <xsl:if test="$del-la-files = 'y' and
446 ancestor::sect2[@role='installation']">
447 <xsl:call-template name="output-root">
448 <xsl:with-param name="out-string" select="$la-files-instr"/>
449 </xsl:call-template>
450 </xsl:if>
[945ccaa]451 <xsl:if test="$wrap-install = 'y' and
452 ancestor::sect2[@role='installation']">
453 <xsl:text>'&#xA;packInstall</xsl:text>
454 </xsl:if>
455 <xsl:if test="$sudo = 'y'">
456 <xsl:text>&#xA;ROOT_EOF</xsl:text>
457 </xsl:if>
[e576789]458 </xsl:if>
459 </xsl:when>
460 <xsl:otherwise>
461 <xsl:apply-templates select="userinput"/>
462 </xsl:otherwise>
463 </xsl:choose>
464 <xsl:text>&#xA;</xsl:text>
465 </xsl:if>
466 </xsl:template>
467
[70d73d1]468 <xsl:template name="set-bootpkg-dir">
469 <xsl:param name="bootpkg" select="'bootscripts'"/>
470 <xsl:param name="url" select="''"/>
[973c767]471 <xsl:text>BOOTPKG_DIR=blfs-</xsl:text>
[70d73d1]472 <xsl:copy-of select="$bootpkg"/>
473 <xsl:text>
[973c767]474BOOTSRC_DIR=${SRC_ARCHIVE}${SRC_SUBDIRS:+/${BOOTPKG_DIR}}
475BOOTBUILD_DIR=${BUILD_ROOT}${BUILD_SUBDIRS:+/${BOOTPKG_DIR}}
476mkdir -p $BOOTSRC_DIR
477mkdir -p $BOOTBUILD_DIR
478
479pushd $BOOTSRC_DIR
[e576789]480URL=</xsl:text>
[70d73d1]481 <xsl:value-of select="$url"/>
482 <xsl:text>
[e576789]483BOOTPACKG=$(basename $URL)
[bbcdeab]484if [[ ! -f $BOOTPACKG ]] ; then
[973c767]485 if [[ -f $SRC_ARCHIVE/$BOOTPACKG ]] ; then
[bbcdeab]486 cp $SRC_ARCHIVE/$BOOTPACKG $BOOTPACKG
487 else
488 wget -T 30 -t 5 $URL
489 fi
[973c767]490 rm -f $BOOTBUILD_DIR/unpacked
[bbcdeab]491fi
492
[973c767]493cd $BOOTBUILD_DIR
[e576789]494if [[ -e unpacked ]] ; then
[f079f8f]495 BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
496 if ! [[ -d $BOOTUNPACKDIR ]]; then
[973c767]497 tar -xvf $BOOTSRC_DIR/$BOOTPACKG > unpacked
[f079f8f]498 BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
[e576789]499 fi
500else
[973c767]501 tar -xvf $BOOTSRC_DIR/$BOOTPACKG > unpacked
[f079f8f]502 BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
[e576789]503fi
[f079f8f]504cd $BOOTUNPACKDIR
[e576789]505</xsl:text>
[70d73d1]506 </xsl:template>
507
508 <xsl:template match="screen" mode="config">
509 <xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts']">
510 <xsl:call-template name="set-bootpkg-dir">
511 <xsl:with-param name="bootpkg" select="'bootscripts'"/>
512 <xsl:with-param name="url"
513 select="id('bootscripts')//itemizedlist//ulink/@url"/>
514 </xsl:call-template>
515 </xsl:if>
516 <xsl:if test="preceding-sibling::para[1]/xref[@linkend='systemd-units']">
517 <xsl:call-template name="set-bootpkg-dir">
518 <xsl:with-param name="bootpkg" select="'systemd-units'"/>
519 <xsl:with-param name="url"
520 select="id('systemd-units')//itemizedlist//ulink/@url"/>
521 </xsl:call-template>
[e576789]522 </xsl:if>
523 <xsl:apply-templates select='.'/>
[70d73d1]524 <xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts' or
525 @linkend='systemd-units']">
[e576789]526 <xsl:text>
527popd</xsl:text>
528 </xsl:if>
529 <xsl:text>&#xA;</xsl:text>
530 </xsl:template>
531
532 <xsl:template match="para/command">
[a743e57]533 <xsl:variable name="ns" select="normalize-space(string())"/>
534 <xsl:if test="(contains($ns,'test') or
535 contains($ns,'check'))">
[e576789]536 <xsl:text>#</xsl:text>
[a743e57]537 <xsl:value-of select="substring-before($ns,'make ')"/>
[9c5ea2f]538 <xsl:text>make </xsl:text>
[a743e57]539 <xsl:if test="not(contains($ns,'-k'))">
[9c5ea2f]540 <xsl:text>-k </xsl:text>
541 </xsl:if>
[a743e57]542 <xsl:value-of select="substring-after($ns,'make ')"/>
[e576789]543 <xsl:text> || true&#xA;</xsl:text>
544 </xsl:if>
545 </xsl:template>
546
547 <xsl:template match="userinput">
548 <xsl:apply-templates/>
549 </xsl:template>
550
551 <xsl:template match="text()" mode="root">
552 <xsl:call-template name="output-root">
553 <xsl:with-param name="out-string" select="string()"/>
554 </xsl:call-template>
555 </xsl:template>
556
[945ccaa]557 <xsl:variable name="APOS">'</xsl:variable>
558
[e576789]559 <xsl:template name="output-root">
560 <xsl:param name="out-string" select="''"/>
561 <xsl:choose>
[9c5ea2f]562 <xsl:when test="contains($out-string,'make ')">
[e576789]563 <xsl:call-template name="output-root">
564 <xsl:with-param name="out-string"
[9c5ea2f]565 select="substring-before($out-string,'make ')"/>
[e576789]566 </xsl:call-template>
[9c5ea2f]567 <xsl:text>make -j1 </xsl:text>
[e576789]568 <xsl:call-template name="output-root">
569 <xsl:with-param name="out-string"
[9c5ea2f]570 select="substring-after($out-string,'make ')"/>
[e576789]571 </xsl:call-template>
572 </xsl:when>
573 <xsl:when test="contains($out-string,'$') and $sudo = 'y'">
574 <xsl:call-template name="output-root">
575 <xsl:with-param name="out-string"
576 select="substring-before($out-string,'$')"/>
577 </xsl:call-template>
578 <xsl:text>\$</xsl:text>
579 <xsl:call-template name="output-root">
580 <xsl:with-param name="out-string"
581 select="substring-after($out-string,'$')"/>
582 </xsl:call-template>
583 </xsl:when>
584 <xsl:when test="contains($out-string,'`') and $sudo = 'y'">
585 <xsl:call-template name="output-root">
586 <xsl:with-param name="out-string"
587 select="substring-before($out-string,'`')"/>
588 </xsl:call-template>
589 <xsl:text>\`</xsl:text>
590 <xsl:call-template name="output-root">
591 <xsl:with-param name="out-string"
592 select="substring-after($out-string,'`')"/>
593 </xsl:call-template>
594 </xsl:when>
595 <xsl:when test="contains($out-string,'\') and $sudo = 'y'">
596 <xsl:call-template name="output-root">
597 <xsl:with-param name="out-string"
598 select="substring-before($out-string,'\')"/>
599 </xsl:call-template>
600 <xsl:text>\\</xsl:text>
601 <xsl:call-template name="output-root">
602 <xsl:with-param name="out-string"
603 select="substring-after($out-string,'\')"/>
604 </xsl:call-template>
605 </xsl:when>
[945ccaa]606 <xsl:when test="contains($out-string,string($APOS))
607 and $wrap-install = 'y'
608 and ancestor::sect2[@role='installation']">
609 <xsl:call-template name="output-root">
610 <xsl:with-param name="out-string"
611 select="substring-before($out-string,string($APOS))"/>
612 </xsl:call-template>
613 <xsl:text>'\''</xsl:text>
614 <xsl:call-template name="output-root">
615 <xsl:with-param name="out-string"
616 select="substring-after($out-string,string($APOS))"/>
617 </xsl:call-template>
618 </xsl:when>
[e576789]619 <xsl:otherwise>
620 <xsl:value-of select="$out-string"/>
621 </xsl:otherwise>
622 </xsl:choose>
623 </xsl:template>
624
625 <xsl:template match="replaceable">
626 <xsl:text>**EDITME</xsl:text>
627 <xsl:apply-templates/>
628 <xsl:text>EDITME**</xsl:text>
629 </xsl:template>
630
631 <xsl:template match="replaceable" mode="root">
632 <xsl:text>**EDITME</xsl:text>
633 <xsl:apply-templates/>
634 <xsl:text>EDITME**</xsl:text>
635 </xsl:template>
636
637</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.