[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 |
|
---|
[e576789] | 28 | <!-- Build as user (y) or as root (n)? -->
|
---|
| 29 | <xsl:param name="sudo" select="'y'"/>
|
---|
| 30 |
|
---|
| 31 | <xsl:template match="/">
|
---|
| 32 | <xsl:apply-templates select="//sect1"/>
|
---|
| 33 | </xsl:template>
|
---|
| 34 |
|
---|
| 35 | <!--=================== Master chunks code ======================-->
|
---|
| 36 |
|
---|
| 37 | <xsl:template match="sect1">
|
---|
| 38 |
|
---|
[70d73d1] | 39 | <xsl:if test="@id != 'bootscripts' and @id != 'systemd-units'">
|
---|
[e576789] | 40 | <!-- The file names -->
|
---|
| 41 | <xsl:variable name="filename" select="@id"/>
|
---|
| 42 |
|
---|
| 43 | <!-- The build order -->
|
---|
| 44 | <xsl:variable name="position" select="position()"/>
|
---|
| 45 | <xsl:variable name="order">
|
---|
| 46 | <xsl:choose>
|
---|
| 47 | <xsl:when test="string-length($position) = 1">
|
---|
| 48 | <xsl:text>00</xsl:text>
|
---|
| 49 | <xsl:value-of select="$position"/>
|
---|
| 50 | </xsl:when>
|
---|
| 51 | <xsl:when test="string-length($position) = 2">
|
---|
| 52 | <xsl:text>0</xsl:text>
|
---|
| 53 | <xsl:value-of select="$position"/>
|
---|
| 54 | </xsl:when>
|
---|
| 55 | <xsl:otherwise>
|
---|
| 56 | <xsl:value-of select="$position"/>
|
---|
| 57 | </xsl:otherwise>
|
---|
| 58 | </xsl:choose>
|
---|
| 59 | </xsl:variable>
|
---|
| 60 |
|
---|
| 61 | <!-- Depuration code -->
|
---|
| 62 | <xsl:message>
|
---|
| 63 | <xsl:text>SCRIPT is </xsl:text>
|
---|
| 64 | <xsl:value-of select="concat($order,'-z-',$filename)"/>
|
---|
| 65 | <xsl:text>
 FTPDIR is </xsl:text>
|
---|
| 66 | <xsl:value-of select="$filename"/>
|
---|
| 67 | <xsl:text>

</xsl:text>
|
---|
| 68 | </xsl:message>
|
---|
| 69 |
|
---|
| 70 | <!-- Creating the scripts -->
|
---|
| 71 | <exsl:document href="{$order}-z-{$filename}" method="text">
|
---|
| 72 | <xsl:text>#!/bin/bash
set -e

</xsl:text>
|
---|
| 73 | <xsl:choose>
|
---|
| 74 | <!-- Package page -->
|
---|
[642722f] | 75 | <xsl:when test="sect2[@role='package']">
|
---|
[945ccaa] | 76 | <!-- We build in a subdirectory, whose name may be needed
|
---|
| 77 | if using package management (see envars.conf), so
|
---|
| 78 | "export" it -->
|
---|
| 79 | <xsl:text>export PKG_DIR=</xsl:text>
|
---|
[e576789] | 80 | <xsl:value-of select="$filename"/>
|
---|
[39dc04a] | 81 | <xsl:text>
|
---|
| 82 | SRC_DIR=${SRC_ARCHIVE}${SRC_SUBDIRS:+/${PKG_DIR}}
|
---|
| 83 | BUILD_DIR=${BUILD_ROOT}${BUILD_SUBDIRS:+/${PKG_DIR}}
|
---|
| 84 | mkdir -p $SRC_DIR
|
---|
| 85 | mkdir -p $BUILD_DIR
|
---|
| 86 |
|
---|
| 87 | </xsl:text>
|
---|
[e576789] | 88 | <!-- Download code and build commands -->
|
---|
| 89 | <xsl:apply-templates select="sect2"/>
|
---|
| 90 | <!-- Clean-up -->
|
---|
[39dc04a] | 91 | <xsl:text>cd $BUILD_DIR
|
---|
| 92 | [[ -n "$KEEP_FILES" ]] || </xsl:text>
|
---|
[e576789] | 93 | <!-- In some case, some files in the build tree are owned
|
---|
| 94 | by root -->
|
---|
[642722f] | 95 | <xsl:if test="$sudo='y'">
|
---|
| 96 | <xsl:text>sudo </xsl:text>
|
---|
[e576789] | 97 | </xsl:if>
|
---|
[642722f] | 98 | <xsl:text>rm -rf $UNPACKDIR unpacked

</xsl:text>
|
---|
[e576789] | 99 | </xsl:when>
|
---|
| 100 | <!-- Non-package page -->
|
---|
| 101 | <xsl:otherwise>
|
---|
| 102 | <xsl:apply-templates select=".//screen"/>
|
---|
| 103 | </xsl:otherwise>
|
---|
| 104 | </xsl:choose>
|
---|
| 105 | <xsl:text>exit</xsl:text>
|
---|
| 106 | </exsl:document>
|
---|
| 107 | </xsl:if>
|
---|
| 108 | </xsl:template>
|
---|
| 109 |
|
---|
| 110 | <!--======================= Sub-sections code =======================-->
|
---|
| 111 |
|
---|
| 112 | <xsl:template match="sect2">
|
---|
| 113 | <xsl:choose>
|
---|
| 114 | <xsl:when test="@role = 'package'">
|
---|
[39dc04a] | 115 | <xsl:text>cd $SRC_DIR
|
---|
| 116 | </xsl:text>
|
---|
[642722f] | 117 | <!-- Download information is in bridgehead tags -->
|
---|
[e576789] | 118 | <xsl:apply-templates select="bridgehead[@renderas='sect3']"/>
|
---|
| 119 | <xsl:text>
</xsl:text>
|
---|
| 120 | </xsl:when>
|
---|
[967b819] | 121 | <xsl:when test="@role = 'qt4-prefix' or @role = 'qt5-prefix'">
|
---|
| 122 | <xsl:apply-templates select=".//screen"/>
|
---|
| 123 | </xsl:when>
|
---|
[e576789] | 124 | <xsl:when test="@role = 'installation'">
|
---|
| 125 | <xsl:text>
|
---|
[39dc04a] | 126 | cd $BUILD_DIR
|
---|
[07f7eff] | 127 | find . -maxdepth 1 -mindepth 1 -type d | xargs </xsl:text>
|
---|
| 128 | <xsl:if test="$sudo='y'">
|
---|
| 129 | <xsl:text>sudo </xsl:text>
|
---|
| 130 | </xsl:if>
|
---|
| 131 | <xsl:text>rm -rf
|
---|
[67992a0] | 132 | case $PACKAGE in
|
---|
[e6967a1] | 133 | *.tar.gz|*.tar.bz2|*.tar.xz|*.tgz|*.tar.lzma)
|
---|
[39dc04a] | 134 | tar -xvf $SRC_DIR/$PACKAGE > unpacked
|
---|
[6eaae5e] | 135 | UNPACKDIR=`grep '[^./]\+' unpacked | head -n1 | sed 's@^\./@@;s@/.*@@'`
|
---|
| 136 | ;;
|
---|
| 137 | *.tar.lz)
|
---|
[39dc04a] | 138 | bsdtar -xvf $SRC_DIR/$PACKAGE 2> unpacked
|
---|
[6eaae5e] | 139 | UNPACKDIR=`head -n1 unpacked | cut -d" " -f2 | sed 's@^\./@@;s@/.*@@'`
|
---|
[67992a0] | 140 | ;;
|
---|
| 141 | *.zip)
|
---|
[39dc04a] | 142 | zipinfo -1 $SRC_DIR/$PACKAGE > unpacked
|
---|
[67992a0] | 143 | UNPACKDIR="$(sed 's@/.*@@' unpacked | uniq )"
|
---|
| 144 | if test $(wc -w <<< $UNPACKDIR) -eq 1; then
|
---|
[39dc04a] | 145 | unzip $SRC_DIR/$PACKAGE
|
---|
[67992a0] | 146 | else
|
---|
| 147 | UNPACKDIR=${PACKAGE%.zip}
|
---|
[39dc04a] | 148 | unzip -d $UNPACKDIR $SRC_DIR/$PACKAGE
|
---|
[67992a0] | 149 | fi
|
---|
| 150 | ;;
|
---|
| 151 | *)
|
---|
| 152 | UNPACKDIR=$PKG_DIR-build
|
---|
| 153 | mkdir $UNPACKDIR
|
---|
[9da16d9] | 154 | cp $SRC_DIR/$PACKAGE $UNPACKDIR
|
---|
| 155 | cp $(find . -mindepth 1 -maxdepth 1 -type l) $UNPACKDIR
|
---|
[67992a0] | 156 | ;;
|
---|
| 157 | esac
|
---|
[945ccaa] | 158 | export UNPACKDIR
|
---|
[67992a0] | 159 | cd $UNPACKDIR

|
---|
| 160 | </xsl:text>
|
---|
[e576789] | 161 | <xsl:apply-templates select=".//screen | .//para/command"/>
|
---|
| 162 | <xsl:if test="$sudo = 'y'">
|
---|
| 163 | <xsl:text>sudo /sbin/</xsl:text>
|
---|
| 164 | </xsl:if>
|
---|
| 165 | <xsl:text>ldconfig

</xsl:text>
|
---|
| 166 | </xsl:when>
|
---|
| 167 | <xsl:when test="@role = 'configuration'">
|
---|
| 168 | <xsl:apply-templates select=".//screen" mode="config"/>
|
---|
| 169 | </xsl:when>
|
---|
| 170 | </xsl:choose>
|
---|
| 171 | </xsl:template>
|
---|
| 172 |
|
---|
| 173 | <!--==================== Download code =======================-->
|
---|
| 174 |
|
---|
[642722f] | 175 | <!-- template for extracting the filename from an url in the form:
|
---|
| 176 | proto://internet.name/dir1/.../dirn/filename?condition.
|
---|
| 177 | Needed, because substring-after(...,'/') returns only the
|
---|
| 178 | substring after the first '/'. -->
|
---|
[e576789] | 179 | <xsl:template name="package_name">
|
---|
| 180 | <xsl:param name="url" select="foo"/>
|
---|
| 181 | <xsl:param name="sub-url" select="substring-after($url,'/')"/>
|
---|
| 182 | <xsl:choose>
|
---|
| 183 | <xsl:when test="contains($sub-url,'/')">
|
---|
| 184 | <xsl:call-template name="package_name">
|
---|
| 185 | <xsl:with-param name="url" select="$sub-url"/>
|
---|
| 186 | </xsl:call-template>
|
---|
| 187 | </xsl:when>
|
---|
| 188 | <xsl:otherwise>
|
---|
| 189 | <xsl:choose>
|
---|
| 190 | <xsl:when test="contains($sub-url,'?')">
|
---|
| 191 | <xsl:value-of select="substring-before($sub-url,'?')"/>
|
---|
| 192 | </xsl:when>
|
---|
| 193 | <xsl:otherwise>
|
---|
| 194 | <xsl:value-of select="$sub-url"/>
|
---|
| 195 | </xsl:otherwise>
|
---|
| 196 | </xsl:choose>
|
---|
| 197 | </xsl:otherwise>
|
---|
| 198 | </xsl:choose>
|
---|
| 199 | </xsl:template>
|
---|
| 200 |
|
---|
[642722f] | 201 | <!-- Generates the code to download a package, an additional package or
|
---|
| 202 | a patch. -->
|
---|
| 203 | <xsl:template name="download-file">
|
---|
| 204 | <xsl:param name="httpurl" select="''"/>
|
---|
| 205 | <xsl:param name="ftpurl" select="''"/>
|
---|
| 206 | <xsl:param name="md5" select="''"/>
|
---|
| 207 | <xsl:param name="varname" select="''"/>
|
---|
| 208 | <xsl:variable name="package">
|
---|
| 209 | <xsl:call-template name="package_name">
|
---|
| 210 | <xsl:with-param name="url">
|
---|
[e576789] | 211 | <xsl:choose>
|
---|
[642722f] | 212 | <xsl:when test="string-length($httpurl) > 10">
|
---|
| 213 | <xsl:value-of select="$httpurl"/>
|
---|
[e576789] | 214 | </xsl:when>
|
---|
| 215 | <xsl:otherwise>
|
---|
[642722f] | 216 | <xsl:value-of select="$ftpurl"/>
|
---|
[e576789] | 217 | </xsl:otherwise>
|
---|
| 218 | </xsl:choose>
|
---|
[642722f] | 219 | </xsl:with-param>
|
---|
| 220 | </xsl:call-template>
|
---|
| 221 | </xsl:variable>
|
---|
| 222 | <xsl:variable name="first_letter"
|
---|
| 223 | select="translate(substring($package,1,1),
|
---|
| 224 | 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
---|
| 225 | 'abcdefghijklmnopqrstuvwxyz')"/>
|
---|
| 226 | <xsl:text>
</xsl:text>
|
---|
| 227 | <xsl:value-of select="$varname"/>
|
---|
| 228 | <xsl:text>=</xsl:text>
|
---|
| 229 | <xsl:value-of select="$package"/>
|
---|
| 230 | <xsl:text>
if [[ ! -f $</xsl:text>
|
---|
| 231 | <xsl:value-of select="$varname"/>
|
---|
[8dc4646] | 232 | <xsl:text> ]] ; then
|
---|
| 233 | if [[ -f $SRC_ARCHIVE/$</xsl:text>
|
---|
[642722f] | 234 | <xsl:value-of select="$varname"/>
|
---|
| 235 | <xsl:text> ]] ; then
</xsl:text>
|
---|
| 236 | <xsl:text> cp $SRC_ARCHIVE/$</xsl:text>
|
---|
| 237 | <xsl:value-of select="$varname"/>
|
---|
| 238 | <xsl:text> $</xsl:text>
|
---|
| 239 | <xsl:value-of select="$varname"/>
|
---|
[8dc4646] | 240 | <xsl:text>
|
---|
| 241 | else
</xsl:text>
|
---|
[342c862] | 242 | <!-- Download from upstream http -->
|
---|
[642722f] | 243 | <xsl:if test="string-length($httpurl) > 10">
|
---|
[8dc4646] | 244 | <xsl:text> wget -T 30 -t 5 </xsl:text>
|
---|
[642722f] | 245 | <xsl:value-of select="$httpurl"/>
|
---|
[342c862] | 246 | <xsl:text> ||
</xsl:text>
|
---|
[642722f] | 247 | </xsl:if>
|
---|
[342c862] | 248 | <!-- Download from upstream ftp -->
|
---|
[642722f] | 249 | <xsl:if test="string-length($ftpurl) > 10">
|
---|
[8dc4646] | 250 | <xsl:text> wget -T 30 -t 5 </xsl:text>
|
---|
[642722f] | 251 | <xsl:value-of select="$ftpurl"/>
|
---|
[342c862] | 252 | <xsl:text> ||
</xsl:text>
|
---|
[642722f] | 253 | </xsl:if>
|
---|
[342c862] | 254 | <!-- The FTP_SERVER mirror as a last resort -->
|
---|
[8dc4646] | 255 | <xsl:text> wget -T 30 -t 5 ${FTP_SERVER}svn/</xsl:text>
|
---|
[342c862] | 256 | <xsl:value-of select="$first_letter"/>
|
---|
| 257 | <xsl:text>/$</xsl:text>
|
---|
| 258 | <xsl:value-of select="$varname"/>
|
---|
[8dc4646] | 259 | <xsl:text><!--
|
---|
| 260 | cp $</xsl:text>
|
---|
[642722f] | 261 | <xsl:value-of select="$varname"/>
|
---|
[8dc4646] | 262 | <xsl:text> $SRC_ARCHIVE-->
|
---|
| 263 | fi
|
---|
[e576789] | 264 | fi
|
---|
| 265 | </xsl:text>
|
---|
[642722f] | 266 | <xsl:if test="string-length($md5) > 10">
|
---|
| 267 | <xsl:text>echo "</xsl:text>
|
---|
| 268 | <xsl:value-of select="$md5"/>
|
---|
| 269 | <xsl:text>  $</xsl:text>
|
---|
| 270 | <xsl:value-of select="$varname"/>
|
---|
| 271 | <xsl:text>" | md5sum -c -
|
---|
[39dc04a] | 272 | </xsl:text>
|
---|
| 273 | </xsl:if>
|
---|
| 274 | <!-- link additional packages into $BUILD_DIR, because they are supposed to
|
---|
| 275 | be there-->
|
---|
| 276 | <xsl:if test="string($varname) != 'PACKAGE'">
|
---|
[8dc4646] | 277 | <xsl:text>[[ "$SRC_DIR" != "$BUILD_DIR" ]] && ln -sf $SRC_DIR/$</xsl:text>
|
---|
[39dc04a] | 278 | <xsl:value-of select="$varname"/>
|
---|
| 279 | <xsl:text> $BUILD_DIR
|
---|
[e576789] | 280 | </xsl:text>
|
---|
[642722f] | 281 | </xsl:if>
|
---|
| 282 | </xsl:template>
|
---|
| 283 |
|
---|
| 284 | <!-- Extract the MD5 sum information -->
|
---|
| 285 | <xsl:template match="para" mode="md5">
|
---|
| 286 | <xsl:choose>
|
---|
| 287 | <xsl:when test="contains(substring-after(string(),'sum: '),'
')">
|
---|
| 288 | <xsl:value-of select="substring-before(substring-after(string(),'sum: '),'
')"/>
|
---|
[e576789] | 289 | </xsl:when>
|
---|
[642722f] | 290 | <xsl:otherwise>
|
---|
| 291 | <xsl:value-of select="substring-after(string(),'sum: ')"/>
|
---|
| 292 | </xsl:otherwise>
|
---|
[e576789] | 293 | </xsl:choose>
|
---|
| 294 | </xsl:template>
|
---|
| 295 |
|
---|
[642722f] | 296 | <!-- We have several templates itemizedlist, depending on whether we
|
---|
| 297 | expect the package information, or additional package(s) or patch(es)
|
---|
| 298 | information. Select the appropriate mode here. -->
|
---|
| 299 | <xsl:template match="bridgehead">
|
---|
[e576789] | 300 | <xsl:choose>
|
---|
[642722f] | 301 | <!-- Special case for Openjdk -->
|
---|
| 302 | <xsl:when test="contains(string(),'Source Package Information')">
|
---|
| 303 | <xsl:apply-templates
|
---|
| 304 | select="following-sibling::itemizedlist[1]//simplelist">
|
---|
| 305 | <xsl:with-param name="varname" select="'PACKAGE'"/>
|
---|
| 306 | </xsl:apply-templates>
|
---|
| 307 | <xsl:apply-templates select="following-sibling::itemizedlist
|
---|
| 308 | [preceding-sibling::bridgehead[1]=current()
|
---|
| 309 | and position() >1]//simplelist">
|
---|
| 310 | <xsl:with-param name="varname" select="'PACKAGE1'"/>
|
---|
| 311 | </xsl:apply-templates>
|
---|
[e576789] | 312 | </xsl:when>
|
---|
[642722f] | 313 | <!-- Package information -->
|
---|
| 314 | <xsl:when test="contains(string(),'Package Information')">
|
---|
| 315 | <xsl:apply-templates select="following-sibling::itemizedlist
|
---|
| 316 | [preceding-sibling::bridgehead[1]=current()]"
|
---|
| 317 | mode="package"/>
|
---|
[e576789] | 318 | </xsl:when>
|
---|
[642722f] | 319 | <!-- Additional package information -->
|
---|
[ba57e61] | 320 | <!-- special case for llvm -->
|
---|
| 321 | <xsl:when test="contains(string(),'Optional Download')">
|
---|
| 322 | <xsl:apply-templates select="following-sibling::itemizedlist"
|
---|
| 323 | mode="additional"/>
|
---|
| 324 | </xsl:when>
|
---|
| 325 | <!-- All other additional packages have "Additional" -->
|
---|
[642722f] | 326 | <xsl:when test="contains(string(),'Additional')">
|
---|
| 327 | <xsl:apply-templates select="following-sibling::itemizedlist"
|
---|
| 328 | mode="additional"/>
|
---|
[e576789] | 329 | </xsl:when>
|
---|
[642722f] | 330 | <!-- Do not do anything if the dev has created another type of
|
---|
| 331 | bridgehead. -->
|
---|
| 332 | <xsl:otherwise/>
|
---|
[e576789] | 333 | </xsl:choose>
|
---|
| 334 | </xsl:template>
|
---|
| 335 |
|
---|
[642722f] | 336 | <!-- Call the download code template with appropriate parameters -->
|
---|
| 337 | <xsl:template match="itemizedlist" mode="package">
|
---|
| 338 | <xsl:call-template name="download-file">
|
---|
| 339 | <xsl:with-param name="httpurl">
|
---|
| 340 | <xsl:value-of select="./listitem[1]/para/ulink/@url"/>
|
---|
| 341 | </xsl:with-param>
|
---|
| 342 | <xsl:with-param name="ftpurl">
|
---|
| 343 | <xsl:value-of select="./listitem/para[contains(string(),'FTP')]/ulink/@url"/>
|
---|
| 344 | </xsl:with-param>
|
---|
| 345 | <xsl:with-param name="md5">
|
---|
| 346 | <xsl:apply-templates select="./listitem/para[contains(string(),'MD5')]"
|
---|
| 347 | mode="md5"/>
|
---|
| 348 | </xsl:with-param>
|
---|
| 349 | <xsl:with-param name="varname" select="'PACKAGE'"/>
|
---|
| 350 | </xsl:call-template>
|
---|
[e576789] | 351 | </xsl:template>
|
---|
| 352 |
|
---|
[642722f] | 353 | <xsl:template match="itemizedlist" mode="additional">
|
---|
| 354 | <!-- The normal layout is "one listitem"<->"one url", but some devs
|
---|
| 355 | find amusing to have FTP and/or MD5sum listitems, or to
|
---|
| 356 | enclose the download information inside a simplelist tag... -->
|
---|
| 357 | <xsl:for-each select="listitem[.//ulink]">
|
---|
| 358 | <xsl:choose>
|
---|
| 359 | <!-- hopefully, there was a HTTP line before -->
|
---|
| 360 | <xsl:when test="contains(string(./para),'FTP')"/>
|
---|
| 361 | <xsl:when test=".//simplelist">
|
---|
| 362 | <xsl:apply-templates select=".//simplelist">
|
---|
| 363 | <xsl:with-param name="varname" select="'PACKAGE1'"/>
|
---|
| 364 | </xsl:apply-templates>
|
---|
| 365 | </xsl:when>
|
---|
| 366 | <xsl:otherwise>
|
---|
| 367 | <xsl:call-template name="download-file">
|
---|
| 368 | <xsl:with-param name="httpurl">
|
---|
| 369 | <xsl:value-of select="./para/ulink/@url"/>
|
---|
| 370 | </xsl:with-param>
|
---|
| 371 | <xsl:with-param name="ftpurl">
|
---|
| 372 | <xsl:value-of
|
---|
| 373 | select="following-sibling::listitem[1]/
|
---|
| 374 | para[contains(string(),'FTP')]/ulink/@url"/>
|
---|
| 375 | </xsl:with-param>
|
---|
| 376 | <xsl:with-param name="md5">
|
---|
| 377 | <xsl:apply-templates
|
---|
| 378 | select="following-sibling::listitem[position()<3]/
|
---|
| 379 | para[contains(string(),'MD5')]"
|
---|
| 380 | mode="md5"/>
|
---|
| 381 | </xsl:with-param>
|
---|
| 382 | <xsl:with-param name="varname">
|
---|
| 383 | <xsl:choose>
|
---|
| 384 | <xsl:when test="contains(./para/ulink/@url,'.patch')">
|
---|
| 385 | <xsl:text>PATCH</xsl:text>
|
---|
| 386 | </xsl:when>
|
---|
| 387 | <xsl:otherwise>
|
---|
| 388 | <xsl:text>PACKAGE1</xsl:text>
|
---|
| 389 | </xsl:otherwise>
|
---|
| 390 | </xsl:choose>
|
---|
| 391 | </xsl:with-param>
|
---|
| 392 | </xsl:call-template>
|
---|
| 393 | </xsl:otherwise>
|
---|
| 394 | </xsl:choose>
|
---|
| 395 | </xsl:for-each>
|
---|
[e576789] | 396 | </xsl:template>
|
---|
| 397 |
|
---|
[642722f] | 398 | <!-- the simplelist case. Hopefully, the layout is one member for
|
---|
| 399 | url, one for md5 and others for various information, that we do not
|
---|
| 400 | use -->
|
---|
| 401 | <xsl:template match="simplelist">
|
---|
| 402 | <xsl:param name="varname" select="'PACKAGE1'"/>
|
---|
| 403 | <xsl:call-template name="download-file">
|
---|
| 404 | <xsl:with-param name="httpurl" select=".//ulink/@url"/>
|
---|
| 405 | <xsl:with-param name="md5">
|
---|
| 406 | <xsl:value-of select="substring-after(member[contains(string(),'MD5')],'sum: ')"/>
|
---|
| 407 | </xsl:with-param>
|
---|
| 408 | <xsl:with-param name="varname" select="$varname"/>
|
---|
| 409 | </xsl:call-template>
|
---|
| 410 | </xsl:template>
|
---|
[e576789] | 411 | <!--======================== Commands code ==========================-->
|
---|
| 412 |
|
---|
| 413 | <xsl:template match="screen">
|
---|
| 414 | <xsl:if test="child::* = userinput and not(@role = 'nodump')">
|
---|
| 415 | <xsl:choose>
|
---|
| 416 | <xsl:when test="@role = 'root'">
|
---|
[945ccaa] | 417 | <xsl:if test="not(preceding-sibling::screen[1][@role='root'])">
|
---|
| 418 | <xsl:if test="$sudo = 'y'">
|
---|
| 419 | <xsl:text>sudo -E sh << ROOT_EOF
</xsl:text>
|
---|
| 420 | </xsl:if>
|
---|
| 421 | <xsl:if test="$wrap-install = 'y' and
|
---|
| 422 | ancestor::sect2[@role='installation']">
|
---|
| 423 | <xsl:text>if [ -r "$PACK_INSTALL" ]; then
|
---|
| 424 | source $PACK_INSTALL
|
---|
| 425 | export -f wrapInstall
|
---|
| 426 | export -f packInstall
|
---|
| 427 | fi
|
---|
| 428 | wrapInstall '
|
---|
| 429 | </xsl:text>
|
---|
| 430 | </xsl:if>
|
---|
[e576789] | 431 | </xsl:if>
|
---|
| 432 | <xsl:apply-templates mode="root"/>
|
---|
[945ccaa] | 433 | <xsl:if test="not(following-sibling::screen[1][@role='root'])">
|
---|
| 434 | <xsl:if test="$wrap-install = 'y' and
|
---|
| 435 | ancestor::sect2[@role='installation']">
|
---|
| 436 | <xsl:text>'
packInstall</xsl:text>
|
---|
| 437 | </xsl:if>
|
---|
| 438 | <xsl:if test="$sudo = 'y'">
|
---|
| 439 | <xsl:text>
ROOT_EOF</xsl:text>
|
---|
| 440 | </xsl:if>
|
---|
[e576789] | 441 | </xsl:if>
|
---|
| 442 | </xsl:when>
|
---|
| 443 | <xsl:otherwise>
|
---|
| 444 | <xsl:apply-templates select="userinput"/>
|
---|
| 445 | </xsl:otherwise>
|
---|
| 446 | </xsl:choose>
|
---|
| 447 | <xsl:text>
</xsl:text>
|
---|
| 448 | </xsl:if>
|
---|
| 449 | </xsl:template>
|
---|
| 450 |
|
---|
[70d73d1] | 451 | <xsl:template name="set-bootpkg-dir">
|
---|
| 452 | <xsl:param name="bootpkg" select="'bootscripts'"/>
|
---|
| 453 | <xsl:param name="url" select="''"/>
|
---|
[973c767] | 454 | <xsl:text>BOOTPKG_DIR=blfs-</xsl:text>
|
---|
[70d73d1] | 455 | <xsl:copy-of select="$bootpkg"/>
|
---|
| 456 | <xsl:text>
|
---|
[973c767] | 457 | BOOTSRC_DIR=${SRC_ARCHIVE}${SRC_SUBDIRS:+/${BOOTPKG_DIR}}
|
---|
| 458 | BOOTBUILD_DIR=${BUILD_ROOT}${BUILD_SUBDIRS:+/${BOOTPKG_DIR}}
|
---|
| 459 | mkdir -p $BOOTSRC_DIR
|
---|
| 460 | mkdir -p $BOOTBUILD_DIR
|
---|
| 461 |
|
---|
| 462 | pushd $BOOTSRC_DIR
|
---|
[e576789] | 463 | URL=</xsl:text>
|
---|
[70d73d1] | 464 | <xsl:value-of select="$url"/>
|
---|
| 465 | <xsl:text>
|
---|
[e576789] | 466 | BOOTPACKG=$(basename $URL)
|
---|
[bbcdeab] | 467 | if [[ ! -f $BOOTPACKG ]] ; then
|
---|
[973c767] | 468 | if [[ -f $SRC_ARCHIVE/$BOOTPACKG ]] ; then
|
---|
[bbcdeab] | 469 | cp $SRC_ARCHIVE/$BOOTPACKG $BOOTPACKG
|
---|
| 470 | else
|
---|
| 471 | wget -T 30 -t 5 $URL
|
---|
| 472 | fi
|
---|
[973c767] | 473 | rm -f $BOOTBUILD_DIR/unpacked
|
---|
[bbcdeab] | 474 | fi
|
---|
| 475 |
|
---|
[973c767] | 476 | cd $BOOTBUILD_DIR
|
---|
[e576789] | 477 | if [[ -e unpacked ]] ; then
|
---|
[f079f8f] | 478 | BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
|
---|
| 479 | if ! [[ -d $BOOTUNPACKDIR ]]; then
|
---|
[973c767] | 480 | tar -xvf $BOOTSRC_DIR/$BOOTPACKG > unpacked
|
---|
[f079f8f] | 481 | BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
|
---|
[e576789] | 482 | fi
|
---|
| 483 | else
|
---|
[973c767] | 484 | tar -xvf $BOOTSRC_DIR/$BOOTPACKG > unpacked
|
---|
[f079f8f] | 485 | BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
|
---|
[e576789] | 486 | fi
|
---|
[f079f8f] | 487 | cd $BOOTUNPACKDIR
|
---|
[e576789] | 488 | </xsl:text>
|
---|
[70d73d1] | 489 | </xsl:template>
|
---|
| 490 |
|
---|
| 491 | <xsl:template match="screen" mode="config">
|
---|
| 492 | <xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts']">
|
---|
| 493 | <xsl:call-template name="set-bootpkg-dir">
|
---|
| 494 | <xsl:with-param name="bootpkg" select="'bootscripts'"/>
|
---|
| 495 | <xsl:with-param name="url"
|
---|
| 496 | select="id('bootscripts')//itemizedlist//ulink/@url"/>
|
---|
| 497 | </xsl:call-template>
|
---|
| 498 | </xsl:if>
|
---|
| 499 | <xsl:if test="preceding-sibling::para[1]/xref[@linkend='systemd-units']">
|
---|
| 500 | <xsl:call-template name="set-bootpkg-dir">
|
---|
| 501 | <xsl:with-param name="bootpkg" select="'systemd-units'"/>
|
---|
| 502 | <xsl:with-param name="url"
|
---|
| 503 | select="id('systemd-units')//itemizedlist//ulink/@url"/>
|
---|
| 504 | </xsl:call-template>
|
---|
[e576789] | 505 | </xsl:if>
|
---|
| 506 | <xsl:apply-templates select='.'/>
|
---|
[70d73d1] | 507 | <xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts' or
|
---|
| 508 | @linkend='systemd-units']">
|
---|
[e576789] | 509 | <xsl:text>
|
---|
| 510 | popd</xsl:text>
|
---|
| 511 | </xsl:if>
|
---|
| 512 | <xsl:text>
</xsl:text>
|
---|
| 513 | </xsl:template>
|
---|
| 514 |
|
---|
| 515 | <xsl:template match="para/command">
|
---|
[a743e57] | 516 | <xsl:variable name="ns" select="normalize-space(string())"/>
|
---|
| 517 | <xsl:if test="(contains($ns,'test') or
|
---|
| 518 | contains($ns,'check'))">
|
---|
[e576789] | 519 | <xsl:text>#</xsl:text>
|
---|
[a743e57] | 520 | <xsl:value-of select="substring-before($ns,'make ')"/>
|
---|
[9c5ea2f] | 521 | <xsl:text>make </xsl:text>
|
---|
[a743e57] | 522 | <xsl:if test="not(contains($ns,'-k'))">
|
---|
[9c5ea2f] | 523 | <xsl:text>-k </xsl:text>
|
---|
| 524 | </xsl:if>
|
---|
[a743e57] | 525 | <xsl:value-of select="substring-after($ns,'make ')"/>
|
---|
[e576789] | 526 | <xsl:text> || true
</xsl:text>
|
---|
| 527 | </xsl:if>
|
---|
| 528 | </xsl:template>
|
---|
| 529 |
|
---|
| 530 | <xsl:template match="userinput">
|
---|
| 531 | <xsl:apply-templates/>
|
---|
| 532 | </xsl:template>
|
---|
| 533 |
|
---|
| 534 | <xsl:template match="text()" mode="root">
|
---|
| 535 | <xsl:call-template name="output-root">
|
---|
| 536 | <xsl:with-param name="out-string" select="string()"/>
|
---|
| 537 | </xsl:call-template>
|
---|
| 538 | </xsl:template>
|
---|
| 539 |
|
---|
[945ccaa] | 540 | <xsl:variable name="APOS">'</xsl:variable>
|
---|
| 541 |
|
---|
[e576789] | 542 | <xsl:template name="output-root">
|
---|
| 543 | <xsl:param name="out-string" select="''"/>
|
---|
| 544 | <xsl:choose>
|
---|
[9c5ea2f] | 545 | <xsl:when test="contains($out-string,'make ')">
|
---|
[e576789] | 546 | <xsl:call-template name="output-root">
|
---|
| 547 | <xsl:with-param name="out-string"
|
---|
[9c5ea2f] | 548 | select="substring-before($out-string,'make ')"/>
|
---|
[e576789] | 549 | </xsl:call-template>
|
---|
[9c5ea2f] | 550 | <xsl:text>make -j1 </xsl:text>
|
---|
[e576789] | 551 | <xsl:call-template name="output-root">
|
---|
| 552 | <xsl:with-param name="out-string"
|
---|
[9c5ea2f] | 553 | select="substring-after($out-string,'make ')"/>
|
---|
[e576789] | 554 | </xsl:call-template>
|
---|
| 555 | </xsl:when>
|
---|
| 556 | <xsl:when test="contains($out-string,'$') and $sudo = 'y'">
|
---|
| 557 | <xsl:call-template name="output-root">
|
---|
| 558 | <xsl:with-param name="out-string"
|
---|
| 559 | select="substring-before($out-string,'$')"/>
|
---|
| 560 | </xsl:call-template>
|
---|
| 561 | <xsl:text>\$</xsl:text>
|
---|
| 562 | <xsl:call-template name="output-root">
|
---|
| 563 | <xsl:with-param name="out-string"
|
---|
| 564 | select="substring-after($out-string,'$')"/>
|
---|
| 565 | </xsl:call-template>
|
---|
| 566 | </xsl:when>
|
---|
| 567 | <xsl:when test="contains($out-string,'`') and $sudo = 'y'">
|
---|
| 568 | <xsl:call-template name="output-root">
|
---|
| 569 | <xsl:with-param name="out-string"
|
---|
| 570 | select="substring-before($out-string,'`')"/>
|
---|
| 571 | </xsl:call-template>
|
---|
| 572 | <xsl:text>\`</xsl:text>
|
---|
| 573 | <xsl:call-template name="output-root">
|
---|
| 574 | <xsl:with-param name="out-string"
|
---|
| 575 | select="substring-after($out-string,'`')"/>
|
---|
| 576 | </xsl:call-template>
|
---|
| 577 | </xsl:when>
|
---|
| 578 | <xsl:when test="contains($out-string,'\') and $sudo = 'y'">
|
---|
| 579 | <xsl:call-template name="output-root">
|
---|
| 580 | <xsl:with-param name="out-string"
|
---|
| 581 | select="substring-before($out-string,'\')"/>
|
---|
| 582 | </xsl:call-template>
|
---|
| 583 | <xsl:text>\\</xsl:text>
|
---|
| 584 | <xsl:call-template name="output-root">
|
---|
| 585 | <xsl:with-param name="out-string"
|
---|
| 586 | select="substring-after($out-string,'\')"/>
|
---|
| 587 | </xsl:call-template>
|
---|
| 588 | </xsl:when>
|
---|
[945ccaa] | 589 | <xsl:when test="contains($out-string,string($APOS))
|
---|
| 590 | and $wrap-install = 'y'
|
---|
| 591 | and ancestor::sect2[@role='installation']">
|
---|
| 592 | <xsl:call-template name="output-root">
|
---|
| 593 | <xsl:with-param name="out-string"
|
---|
| 594 | select="substring-before($out-string,string($APOS))"/>
|
---|
| 595 | </xsl:call-template>
|
---|
| 596 | <xsl:text>'\''</xsl:text>
|
---|
| 597 | <xsl:call-template name="output-root">
|
---|
| 598 | <xsl:with-param name="out-string"
|
---|
| 599 | select="substring-after($out-string,string($APOS))"/>
|
---|
| 600 | </xsl:call-template>
|
---|
| 601 | </xsl:when>
|
---|
[e576789] | 602 | <xsl:otherwise>
|
---|
| 603 | <xsl:value-of select="$out-string"/>
|
---|
| 604 | </xsl:otherwise>
|
---|
| 605 | </xsl:choose>
|
---|
| 606 | </xsl:template>
|
---|
| 607 |
|
---|
| 608 | <xsl:template match="replaceable">
|
---|
| 609 | <xsl:text>**EDITME</xsl:text>
|
---|
| 610 | <xsl:apply-templates/>
|
---|
| 611 | <xsl:text>EDITME**</xsl:text>
|
---|
| 612 | </xsl:template>
|
---|
| 613 |
|
---|
| 614 | <xsl:template match="replaceable" mode="root">
|
---|
| 615 | <xsl:text>**EDITME</xsl:text>
|
---|
| 616 | <xsl:apply-templates/>
|
---|
| 617 | <xsl:text>EDITME**</xsl:text>
|
---|
| 618 | </xsl:template>
|
---|
| 619 |
|
---|
| 620 | </xsl:stylesheet>
|
---|