[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
|
---|
| 148 | cp $PACKAGE $UNPACKDIR
|
---|
| 149 | ;;
|
---|
| 150 | esac
|
---|
| 151 | cd $UNPACKDIR

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

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