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

</xsl:text>
|
---|
| 64 | </xsl:message>
|
---|
| 65 |
|
---|
| 66 | <!-- Creating the scripts -->
|
---|
| 67 | <exsl:document href="{$order}-z-{$filename}" method="text">
|
---|
| 68 | <xsl:text>#!/bin/bash
set -e

</xsl:text>
|
---|
| 69 | <xsl:choose>
|
---|
| 70 | <!-- Package page -->
|
---|
[642722f] | 71 | <xsl:when test="sect2[@role='package']">
|
---|
| 72 | <!-- We build in a subdirectory -->
|
---|
| 73 | <xsl:text>PKG_DIR=</xsl:text>
|
---|
[e576789] | 74 | <xsl:value-of select="$filename"/>
|
---|
[39dc04a] | 75 | <xsl:text>
|
---|
| 76 | SRC_DIR=${SRC_ARCHIVE}${SRC_SUBDIRS:+/${PKG_DIR}}
|
---|
| 77 | BUILD_DIR=${BUILD_ROOT}${BUILD_SUBDIRS:+/${PKG_DIR}}
|
---|
| 78 | mkdir -p $SRC_DIR
|
---|
| 79 | mkdir -p $BUILD_DIR
|
---|
| 80 |
|
---|
| 81 | </xsl:text>
|
---|
[e576789] | 82 | <!-- Download code and build commands -->
|
---|
| 83 | <xsl:apply-templates select="sect2"/>
|
---|
| 84 | <!-- Clean-up -->
|
---|
[39dc04a] | 85 | <xsl:text>cd $BUILD_DIR
|
---|
| 86 | [[ -n "$KEEP_FILES" ]] || </xsl:text>
|
---|
[e576789] | 87 | <!-- In some case, some files in the build tree are owned
|
---|
| 88 | by root -->
|
---|
[642722f] | 89 | <xsl:if test="$sudo='y'">
|
---|
| 90 | <xsl:text>sudo </xsl:text>
|
---|
[e576789] | 91 | </xsl:if>
|
---|
[642722f] | 92 | <xsl:text>rm -rf $UNPACKDIR unpacked

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

|
---|
| 153 | </xsl:text>
|
---|
[e576789] | 154 | <xsl:apply-templates select=".//screen | .//para/command"/>
|
---|
| 155 | <xsl:if test="$sudo = 'y'">
|
---|
| 156 | <xsl:text>sudo /sbin/</xsl:text>
|
---|
| 157 | </xsl:if>
|
---|
| 158 | <xsl:text>ldconfig

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