source: BLFS/xsl/scripts.xsl@ 1cb4c76

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

Don't generate porg and del .la instructions when doing userad or groupadd

  • Property mode set to 100644
File size: 23.2 KB
Line 
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
8<!-- $Id$ -->
9
10<!-- XSLT stylesheet to create shell scripts from "linear build" BLFS books. -->
11
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
24 <!-- Wrap "root" commands inside a wrapper function, allowing
25 "porg style" package management -->
26 <xsl:param name="wrap-install" select="'n'"/>
27
28 <!-- Remove libtool .la files -->
29 <xsl:param name="del-la-files" select="'y'"/>
30
31 <!-- Build as user (y) or as root (n)? -->
32 <xsl:param name="sudo" select="'y'"/>
33
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>
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
50 <xsl:if test="@id != 'bootscripts' and @id != 'systemd-units'">
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 -->
86 <xsl:when test="sect2[@role='package']">
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 JH_PKG_DIR=</xsl:text>
91 <xsl:value-of select="$filename"/>
92 <xsl:text>
93SRC_DIR=${JH_SRC_ARCHIVE}${JH_SRC_SUBDIRS:+/${JH_PKG_DIR}}
94BUILD_DIR=${JH_BUILD_ROOT}${JH_BUILD_SUBDIRS:+/${JH_PKG_DIR}}
95mkdir -p $SRC_DIR
96mkdir -p $BUILD_DIR
97
98</xsl:text>
99 <!-- Download code and build commands -->
100 <xsl:apply-templates select="sect2"/>
101 <!-- Clean-up -->
102 <xsl:text>cd $BUILD_DIR
103[[ -n "$JH_KEEP_FILES" ]] || </xsl:text>
104 <!-- In some case, some files in the build tree are owned
105 by root -->
106 <xsl:if test="$sudo='y'">
107 <xsl:text>sudo </xsl:text>
108 </xsl:if>
109 <xsl:text>rm -rf $JH_UNPACKDIR unpacked&#xA;&#xA;</xsl:text>
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'">
126 <xsl:text>cd $SRC_DIR
127</xsl:text>
128 <!-- Download information is in bridgehead tags -->
129 <xsl:apply-templates select="bridgehead[@renderas='sect3']"/>
130 <xsl:text>&#xA;</xsl:text>
131 </xsl:when>
132 <xsl:when test="@role = 'qt4-prefix' or @role = 'qt5-prefix'">
133 <xsl:apply-templates select=".//screen"/>
134 </xsl:when>
135 <xsl:when test="@role = 'installation'">
136 <xsl:text>
137cd $BUILD_DIR
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
143case $PACKAGE in
144 *.tar.gz|*.tar.bz2|*.tar.xz|*.tgz|*.tar.lzma)
145 tar -xvf $SRC_DIR/$PACKAGE &gt; unpacked
146 JH_UNPACKDIR=`grep '[^./]\+' unpacked | head -n1 | sed 's@^\./@@;s@/.*@@'`
147 ;;
148 *.tar.lz)
149 bsdtar -xvf $SRC_DIR/$PACKAGE 2&gt; unpacked
150 JH_UNPACKDIR=`head -n1 unpacked | cut -d" " -f2 | sed 's@^\./@@;s@/.*@@'`
151 ;;
152 *.zip)
153 zipinfo -1 $SRC_DIR/$PACKAGE &gt; unpacked
154 JH_UNPACKDIR="$(sed 's@/.*@@' unpacked | uniq )"
155 if test $(wc -w &lt;&lt;&lt; $JH_UNPACKDIR) -eq 1; then
156 unzip $SRC_DIR/$PACKAGE
157 else
158 JH_UNPACKDIR=${PACKAGE%.zip}
159 unzip -d $JH_UNPACKDIR $SRC_DIR/$PACKAGE
160 fi
161 ;;
162 *)
163 JH_UNPACKDIR=$JH_PKG_DIR-build
164 mkdir $JH_UNPACKDIR
165 cp $SRC_DIR/$PACKAGE $JH_UNPACKDIR
166 cp $(find . -mindepth 1 -maxdepth 1 -type l) $JH_UNPACKDIR
167 ;;
168esac
169export JH_UNPACKDIR
170cd $JH_UNPACKDIR&#xA;
171</xsl:text>
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
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 '/'. -->
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
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">
222 <xsl:choose>
223 <xsl:when test="string-length($httpurl) &gt; 10">
224 <xsl:value-of select="$httpurl"/>
225 </xsl:when>
226 <xsl:otherwise>
227 <xsl:value-of select="$ftpurl"/>
228 </xsl:otherwise>
229 </xsl:choose>
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"/>
243 <xsl:text> ]] ; then
244 if [[ -f $JH_SRC_ARCHIVE/$</xsl:text>
245 <xsl:value-of select="$varname"/>
246 <xsl:text> ]] ; then&#xA;</xsl:text>
247 <xsl:text> cp $JH_SRC_ARCHIVE/$</xsl:text>
248 <xsl:value-of select="$varname"/>
249 <xsl:text> $</xsl:text>
250 <xsl:value-of select="$varname"/>
251 <xsl:text>
252 else&#xA;</xsl:text>
253 <!-- Download from upstream http -->
254 <xsl:if test="string-length($httpurl) &gt; 10">
255 <xsl:text> wget -T 30 -t 5 </xsl:text>
256 <xsl:value-of select="$httpurl"/>
257 <xsl:text> ||&#xA;</xsl:text>
258 </xsl:if>
259 <!-- Download from upstream ftp -->
260 <xsl:if test="string-length($ftpurl) &gt; 10">
261 <xsl:text> wget -T 30 -t 5 </xsl:text>
262 <xsl:value-of select="$ftpurl"/>
263 <xsl:text> ||&#xA;</xsl:text>
264 </xsl:if>
265 <!-- The FTP_SERVER mirror as a last resort -->
266 <xsl:text> wget -T 30 -t 5 ${JH_FTP_SERVER}svn/</xsl:text>
267 <xsl:value-of select="$first_letter"/>
268 <xsl:text>/$</xsl:text>
269 <xsl:value-of select="$varname"/>
270 <xsl:text>
271 fi
272fi
273</xsl:text>
274 <xsl:if test="string-length($md5) &gt; 10">
275 <xsl:text>echo "</xsl:text>
276 <xsl:value-of select="$md5"/>
277 <xsl:text>&#x20;&#x20;$</xsl:text>
278 <xsl:value-of select="$varname"/>
279 <xsl:text>" | md5sum -c -
280</xsl:text>
281 </xsl:if>
282<!-- link additional packages into $BUILD_DIR, because they are supposed to
283 be there-->
284 <xsl:if test="string($varname) != 'PACKAGE'">
285 <xsl:text>[[ "$SRC_DIR" != "$BUILD_DIR" ]] &amp;&amp; ln -sf $SRC_DIR/$</xsl:text>
286 <xsl:value-of select="$varname"/>
287 <xsl:text> $BUILD_DIR
288</xsl:text>
289 </xsl:if>
290 </xsl:template>
291
292 <!-- Extract the MD5 sum information -->
293 <xsl:template match="para" mode="md5">
294 <xsl:choose>
295 <xsl:when test="contains(substring-after(string(),'sum: '),'&#xA;')">
296 <xsl:value-of select="substring-before(substring-after(string(),'sum: '),'&#xA;')"/>
297 </xsl:when>
298 <xsl:otherwise>
299 <xsl:value-of select="substring-after(string(),'sum: ')"/>
300 </xsl:otherwise>
301 </xsl:choose>
302 </xsl:template>
303
304 <!-- We have several templates itemizedlist, depending on whether we
305 expect the package information, or additional package(s) or patch(es)
306 information. Select the appropriate mode here. -->
307 <xsl:template match="bridgehead">
308 <xsl:choose>
309 <!-- Special case for Openjdk -->
310 <xsl:when test="contains(string(),'Source Package Information')">
311 <xsl:apply-templates
312 select="following-sibling::itemizedlist[1]//simplelist">
313 <xsl:with-param name="varname" select="'PACKAGE'"/>
314 </xsl:apply-templates>
315 <xsl:apply-templates select="following-sibling::itemizedlist
316 [preceding-sibling::bridgehead[1]=current()
317 and position() &gt;1]//simplelist">
318 <xsl:with-param name="varname" select="'PACKAGE1'"/>
319 </xsl:apply-templates>
320 </xsl:when>
321 <!-- Package information -->
322 <xsl:when test="contains(string(),'Package Information')">
323 <xsl:apply-templates select="following-sibling::itemizedlist
324 [preceding-sibling::bridgehead[1]=current()]"
325 mode="package"/>
326 </xsl:when>
327 <!-- Additional package information -->
328 <!-- special case for llvm -->
329 <xsl:when test="contains(string(),'Optional Download')">
330 <xsl:apply-templates select="following-sibling::itemizedlist"
331 mode="additional"/>
332 </xsl:when>
333 <!-- All other additional packages have "Additional" -->
334 <xsl:when test="contains(string(),'Additional')">
335 <xsl:apply-templates select="following-sibling::itemizedlist"
336 mode="additional"/>
337 </xsl:when>
338 <!-- Do not do anything if the dev has created another type of
339 bridgehead. -->
340 <xsl:otherwise/>
341 </xsl:choose>
342 </xsl:template>
343
344 <!-- Call the download code template with appropriate parameters -->
345 <xsl:template match="itemizedlist" mode="package">
346 <xsl:call-template name="download-file">
347 <xsl:with-param name="httpurl">
348 <xsl:value-of select="./listitem[1]/para/ulink/@url"/>
349 </xsl:with-param>
350 <xsl:with-param name="ftpurl">
351 <xsl:value-of select="./listitem/para[contains(string(),'FTP')]/ulink/@url"/>
352 </xsl:with-param>
353 <xsl:with-param name="md5">
354 <xsl:apply-templates select="./listitem/para[contains(string(),'MD5')]"
355 mode="md5"/>
356 </xsl:with-param>
357 <xsl:with-param name="varname" select="'PACKAGE'"/>
358 </xsl:call-template>
359 </xsl:template>
360
361 <xsl:template match="itemizedlist" mode="additional">
362 <!-- The normal layout is "one listitem"<->"one url", but some devs
363 find amusing to have FTP and/or MD5sum listitems, or to
364 enclose the download information inside a simplelist tag... -->
365 <xsl:for-each select="listitem[.//ulink]">
366 <xsl:choose>
367 <!-- hopefully, there was a HTTP line before -->
368 <xsl:when test="contains(string(./para),'FTP')"/>
369 <xsl:when test=".//simplelist">
370 <xsl:apply-templates select=".//simplelist">
371 <xsl:with-param name="varname" select="'PACKAGE1'"/>
372 </xsl:apply-templates>
373 </xsl:when>
374 <xsl:otherwise>
375 <xsl:call-template name="download-file">
376 <xsl:with-param name="httpurl">
377 <xsl:value-of select="./para/ulink/@url"/>
378 </xsl:with-param>
379 <xsl:with-param name="ftpurl">
380 <xsl:value-of
381 select="following-sibling::listitem[1]/
382 para[contains(string(),'FTP')]/ulink/@url"/>
383 </xsl:with-param>
384 <xsl:with-param name="md5">
385 <xsl:apply-templates
386 select="following-sibling::listitem[position()&lt;3]/
387 para[contains(string(),'MD5')]"
388 mode="md5"/>
389 </xsl:with-param>
390 <xsl:with-param name="varname">
391 <xsl:choose>
392 <xsl:when test="contains(./para/ulink/@url,'.patch')">
393 <xsl:text>PATCH</xsl:text>
394 </xsl:when>
395 <xsl:otherwise>
396 <xsl:text>PACKAGE1</xsl:text>
397 </xsl:otherwise>
398 </xsl:choose>
399 </xsl:with-param>
400 </xsl:call-template>
401 </xsl:otherwise>
402 </xsl:choose>
403 </xsl:for-each>
404 </xsl:template>
405
406 <!-- the simplelist case. Hopefully, the layout is one member for
407 url, one for md5 and others for various information, that we do not
408 use -->
409 <xsl:template match="simplelist">
410 <xsl:param name="varname" select="'PACKAGE1'"/>
411 <xsl:call-template name="download-file">
412 <xsl:with-param name="httpurl" select=".//ulink/@url"/>
413 <xsl:with-param name="md5">
414 <xsl:value-of select="substring-after(member[contains(string(),'MD5')],'sum: ')"/>
415 </xsl:with-param>
416 <xsl:with-param name="varname" select="$varname"/>
417 </xsl:call-template>
418 </xsl:template>
419<!--======================== Commands code ==========================-->
420
421 <xsl:template match="screen">
422 <xsl:if test="child::* = userinput and not(@role = 'nodump')">
423 <xsl:choose>
424 <xsl:when test="@role = 'root'">
425 <xsl:if test="not(preceding-sibling::screen[1][@role='root'])">
426 <xsl:if test="$sudo = 'y'">
427 <xsl:text>sudo -E sh &lt;&lt; ROOT_EOF&#xA;</xsl:text>
428 </xsl:if>
429 <xsl:if test="$wrap-install = 'y' and
430 ancestor::sect2[@role='installation'] and
431 not(contains(string(),'useradd')) and
432 not(contains(string(),'groupadd'))">
433 <xsl:text>if [ -r "$JH_PACK_INSTALL" ]; then
434 source $JH_PACK_INSTALL
435 export -f wrapInstall
436 export -f packInstall
437fi
438wrapInstall '
439</xsl:text>
440 </xsl:if>
441 </xsl:if>
442 <xsl:apply-templates mode="root"/>
443 <xsl:if test="not(following-sibling::screen[1][@role='root'])">
444 <xsl:if test="$del-la-files = 'y' and
445 ancestor::sect2[@role='installation'] and
446 not(contains(string(),'useradd')) and
447 not(contains(string(),'groupadd'))">
448 <xsl:call-template name="output-root">
449 <xsl:with-param name="out-string" select="$la-files-instr"/>
450 </xsl:call-template>
451 </xsl:if>
452 <xsl:if test="$wrap-install = 'y' and
453 ancestor::sect2[@role='installation'] and
454 not(contains(string(),'useradd')) and
455 not(contains(string(),'groupadd'))">
456 <xsl:text>'&#xA;packInstall</xsl:text>
457 </xsl:if>
458 <xsl:if test="$sudo = 'y'">
459 <xsl:text>&#xA;ROOT_EOF</xsl:text>
460 </xsl:if>
461 </xsl:if>
462 </xsl:when>
463 <xsl:otherwise>
464 <xsl:apply-templates select="userinput"/>
465 </xsl:otherwise>
466 </xsl:choose>
467 <xsl:text>&#xA;</xsl:text>
468 </xsl:if>
469 </xsl:template>
470
471 <xsl:template name="set-bootpkg-dir">
472 <xsl:param name="bootpkg" select="'bootscripts'"/>
473 <xsl:param name="url" select="''"/>
474 <xsl:text>BOOTPKG_DIR=blfs-</xsl:text>
475 <xsl:copy-of select="$bootpkg"/>
476 <xsl:text>
477BOOTSRC_DIR=${JH_SRC_ARCHIVE}${JH_SRC_SUBDIRS:+/${BOOTPKG_DIR}}
478BOOTBUILD_DIR=${JH_BUILD_ROOT}${JH_BUILD_SUBDIRS:+/${BOOTPKG_DIR}}
479mkdir -p $BOOTSRC_DIR
480mkdir -p $BOOTBUILD_DIR
481
482pushd $BOOTSRC_DIR
483URL=</xsl:text>
484 <xsl:value-of select="$url"/>
485 <xsl:text>
486BOOTPACKG=$(basename $URL)
487if [[ ! -f $BOOTPACKG ]] ; then
488 if [[ -f $JH_SRC_ARCHIVE/$BOOTPACKG ]] ; then
489 cp $JH_SRC_ARCHIVE/$BOOTPACKG $BOOTPACKG
490 else
491 wget -T 30 -t 5 $URL
492 fi
493 rm -f $BOOTBUILD_DIR/unpacked
494fi
495
496cd $BOOTBUILD_DIR
497if [[ -e unpacked ]] ; then
498 BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
499 if ! [[ -d $BOOTUNPACKDIR ]]; then
500 tar -xvf $BOOTSRC_DIR/$BOOTPACKG > unpacked
501 BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
502 fi
503else
504 tar -xvf $BOOTSRC_DIR/$BOOTPACKG > unpacked
505 BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
506fi
507cd $BOOTUNPACKDIR
508</xsl:text>
509 </xsl:template>
510
511 <xsl:template match="screen" mode="config">
512 <xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts']">
513 <xsl:call-template name="set-bootpkg-dir">
514 <xsl:with-param name="bootpkg" select="'bootscripts'"/>
515 <xsl:with-param name="url"
516 select="id('bootscripts')//itemizedlist//ulink/@url"/>
517 </xsl:call-template>
518 </xsl:if>
519 <xsl:if test="preceding-sibling::para[1]/xref[@linkend='systemd-units']">
520 <xsl:call-template name="set-bootpkg-dir">
521 <xsl:with-param name="bootpkg" select="'systemd-units'"/>
522 <xsl:with-param name="url"
523 select="id('systemd-units')//itemizedlist//ulink/@url"/>
524 </xsl:call-template>
525 </xsl:if>
526 <xsl:apply-templates select='.'/>
527 <xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts' or
528 @linkend='systemd-units']">
529 <xsl:text>
530popd</xsl:text>
531 </xsl:if>
532 <xsl:text>&#xA;</xsl:text>
533 </xsl:template>
534
535 <xsl:template match="para/command">
536 <xsl:variable name="ns" select="normalize-space(string())"/>
537 <xsl:if test="(contains($ns,'test') or
538 contains($ns,'check'))">
539 <xsl:text>#</xsl:text>
540 <xsl:value-of select="substring-before($ns,'make ')"/>
541 <xsl:text>make </xsl:text>
542 <xsl:if test="not(contains($ns,'-k'))">
543 <xsl:text>-k </xsl:text>
544 </xsl:if>
545 <xsl:value-of select="substring-after($ns,'make ')"/>
546 <xsl:text> || true&#xA;</xsl:text>
547 </xsl:if>
548 </xsl:template>
549
550 <xsl:template match="userinput">
551 <xsl:apply-templates/>
552 </xsl:template>
553
554 <xsl:template match="text()" mode="root">
555 <xsl:call-template name="output-root">
556 <xsl:with-param name="out-string" select="string()"/>
557 </xsl:call-template>
558 </xsl:template>
559
560 <xsl:variable name="APOS">'</xsl:variable>
561
562 <xsl:template name="output-root">
563 <xsl:param name="out-string" select="''"/>
564 <xsl:choose>
565 <xsl:when test="contains($out-string,'make ')">
566 <xsl:call-template name="output-root">
567 <xsl:with-param name="out-string"
568 select="substring-before($out-string,'make ')"/>
569 </xsl:call-template>
570 <xsl:text>make -j1 </xsl:text>
571 <xsl:call-template name="output-root">
572 <xsl:with-param name="out-string"
573 select="substring-after($out-string,'make ')"/>
574 </xsl:call-template>
575 </xsl:when>
576 <xsl:when test="contains($out-string,'$') and $sudo = 'y'">
577 <xsl:call-template name="output-root">
578 <xsl:with-param name="out-string"
579 select="substring-before($out-string,'$')"/>
580 </xsl:call-template>
581 <xsl:text>\$</xsl:text>
582 <xsl:call-template name="output-root">
583 <xsl:with-param name="out-string"
584 select="substring-after($out-string,'$')"/>
585 </xsl:call-template>
586 </xsl:when>
587 <xsl:when test="contains($out-string,'`') and $sudo = 'y'">
588 <xsl:call-template name="output-root">
589 <xsl:with-param name="out-string"
590 select="substring-before($out-string,'`')"/>
591 </xsl:call-template>
592 <xsl:text>\`</xsl:text>
593 <xsl:call-template name="output-root">
594 <xsl:with-param name="out-string"
595 select="substring-after($out-string,'`')"/>
596 </xsl:call-template>
597 </xsl:when>
598 <xsl:when test="contains($out-string,'\') and $sudo = 'y'">
599 <xsl:call-template name="output-root">
600 <xsl:with-param name="out-string"
601 select="substring-before($out-string,'\')"/>
602 </xsl:call-template>
603 <xsl:text>\\</xsl:text>
604 <xsl:call-template name="output-root">
605 <xsl:with-param name="out-string"
606 select="substring-after($out-string,'\')"/>
607 </xsl:call-template>
608 </xsl:when>
609 <xsl:when test="contains($out-string,string($APOS))
610 and $wrap-install = 'y'
611 and ancestor::sect2[@role='installation']">
612 <xsl:call-template name="output-root">
613 <xsl:with-param name="out-string"
614 select="substring-before($out-string,string($APOS))"/>
615 </xsl:call-template>
616 <xsl:text>'\''</xsl:text>
617 <xsl:call-template name="output-root">
618 <xsl:with-param name="out-string"
619 select="substring-after($out-string,string($APOS))"/>
620 </xsl:call-template>
621 </xsl:when>
622 <xsl:otherwise>
623 <xsl:value-of select="$out-string"/>
624 </xsl:otherwise>
625 </xsl:choose>
626 </xsl:template>
627
628 <xsl:template match="replaceable">
629 <xsl:text>**EDITME</xsl:text>
630 <xsl:apply-templates/>
631 <xsl:text>EDITME**</xsl:text>
632 </xsl:template>
633
634 <xsl:template match="replaceable" mode="root">
635 <xsl:text>**EDITME</xsl:text>
636 <xsl:apply-templates/>
637 <xsl:text>EDITME**</xsl:text>
638 </xsl:template>
639
640</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.