[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 |
|
---|
[c048987] | 12 | <!-- parameters and global variables -->
|
---|
| 13 | <!-- Check whether the book is sysv or systemd -->
|
---|
[70d73d1] | 14 | <xsl:variable name="rev">
|
---|
| 15 | <xsl:choose>
|
---|
| 16 | <xsl:when test="//bookinfo/title/phrase[@revision='systemd']">
|
---|
| 17 | systemd
|
---|
| 18 | </xsl:when>
|
---|
| 19 | <xsl:otherwise>
|
---|
| 20 | sysv
|
---|
| 21 | </xsl:otherwise>
|
---|
| 22 | </xsl:choose>
|
---|
| 23 | </xsl:variable>
|
---|
| 24 |
|
---|
[945ccaa] | 25 | <!-- Wrap "root" commands inside a wrapper function, allowing
|
---|
| 26 | "porg style" package management -->
|
---|
| 27 | <xsl:param name="wrap-install" select="'n'"/>
|
---|
| 28 |
|
---|
[67c3df4] | 29 | <!-- list of packages needing stats -->
|
---|
| 30 | <xsl:param name="list-stat" select="''"/>
|
---|
| 31 |
|
---|
[dc7fd7b] | 32 | <!-- Remove libtool .la files -->
|
---|
| 33 | <xsl:param name="del-la-files" select="'y'"/>
|
---|
| 34 |
|
---|
[e576789] | 35 | <!-- Build as user (y) or as root (n)? -->
|
---|
| 36 | <xsl:param name="sudo" select="'y'"/>
|
---|
| 37 |
|
---|
[dc7fd7b] | 38 | <!-- simple instructions for removing .la files. -->
|
---|
[619b313] | 39 | <!-- We'll use the rule that any text output begins with a linefeed if needed
|
---|
| 40 | so that we do not need to output one at the end-->
|
---|
[dc7fd7b] | 41 | <xsl:variable name="la-files-instr">
|
---|
| 42 |
|
---|
| 43 | for libdir in /lib /usr/lib $(find /opt -name lib); do
|
---|
[2969cdf] | 44 | find $libdir -name \*.la \
|
---|
| 45 | ! -path \*ImageMagick\* \
|
---|
| 46 | -delete
|
---|
[619b313] | 47 | done</xsl:variable>
|
---|
[67c3df4] | 48 |
|
---|
[c048987] | 49 | <xsl:variable name="list-stat-norm"
|
---|
| 50 | select="concat(' ', normalize-space($list-stat),' ')"/>
|
---|
| 51 |
|
---|
| 52 | <!-- To be able to use the single quote in tests -->
|
---|
| 53 | <xsl:variable name="APOS">'</xsl:variable>
|
---|
| 54 |
|
---|
| 55 | <!-- end parameters and global variables -->
|
---|
| 56 |
|
---|
[7933ed7] | 57 | <!-- include the template for processing screen children of
|
---|
| 58 | role="install" sect2 -->
|
---|
| 59 | <xsl:include href="process-install.xsl"/>
|
---|
[c048987] | 60 |
|
---|
[96d7e44] | 61 | <!-- include the template for replaceable tags -->
|
---|
| 62 | <xsl:include href="process-replaceable.xsl"/>
|
---|
| 63 |
|
---|
[c048987] | 64 | <!--=================== Begin processing ========================-->
|
---|
[67c3df4] | 65 |
|
---|
[e576789] | 66 | <xsl:template match="/">
|
---|
[c048987] | 67 | <xsl:apply-templates select="//sect1[@id != 'bootscripts' and
|
---|
| 68 | @id != 'systemd-units']"/>
|
---|
[e576789] | 69 | </xsl:template>
|
---|
| 70 |
|
---|
| 71 | <!--=================== Master chunks code ======================-->
|
---|
| 72 |
|
---|
| 73 | <xsl:template match="sect1">
|
---|
| 74 |
|
---|
[619b313] | 75 | <!-- Are stat requested for this page? -->
|
---|
| 76 | <xsl:variable name="want-stats"
|
---|
| 77 | select="contains($list-stat-norm,
|
---|
| 78 | concat(' ',@id,' '))"/>
|
---|
| 79 |
|
---|
[c048987] | 80 | <!-- The file names -->
|
---|
| 81 | <xsl:variable name="filename" select="@id"/>
|
---|
[e576789] | 82 |
|
---|
[c048987] | 83 | <!-- The build order -->
|
---|
| 84 | <xsl:variable name="position" select="position()"/>
|
---|
| 85 | <xsl:variable name="order">
|
---|
| 86 | <xsl:choose>
|
---|
| 87 | <xsl:when test="string-length($position) = 1">
|
---|
| 88 | <xsl:text>00</xsl:text>
|
---|
| 89 | <xsl:value-of select="$position"/>
|
---|
| 90 | </xsl:when>
|
---|
| 91 | <xsl:when test="string-length($position) = 2">
|
---|
| 92 | <xsl:text>0</xsl:text>
|
---|
| 93 | <xsl:value-of select="$position"/>
|
---|
| 94 | </xsl:when>
|
---|
| 95 | <xsl:otherwise>
|
---|
| 96 | <xsl:value-of select="$position"/>
|
---|
| 97 | </xsl:otherwise>
|
---|
| 98 | </xsl:choose>
|
---|
| 99 | </xsl:variable>
|
---|
[e576789] | 100 |
|
---|
| 101 | <!-- Depuration code -->
|
---|
[c048987] | 102 | <xsl:message>
|
---|
| 103 | <xsl:text>SCRIPT is </xsl:text>
|
---|
| 104 | <xsl:value-of select="concat($order,'-z-',$filename)"/>
|
---|
| 105 | <xsl:text>
 FTPDIR is </xsl:text>
|
---|
| 106 | <xsl:value-of select="$filename"/>
|
---|
| 107 | <xsl:text>

</xsl:text>
|
---|
| 108 | </xsl:message>
|
---|
| 109 |
|
---|
| 110 | <!-- Creating the scripts -->
|
---|
| 111 | <exsl:document href="{$order}-z-{$filename}" method="text">
|
---|
| 112 | <xsl:text>#!/bin/bash
|
---|
[eabfc59] | 113 | set -e
|
---|
| 114 | unset MAKELEVEL
|
---|
| 115 | </xsl:text>
|
---|
[8fc6a47] | 116 | <!-- Unsetting MAKELEVEL is needed for some packages which assume that
|
---|
| 117 | their top level Makefile is at level zero -->
|
---|
[c048987] | 118 | <xsl:choose>
|
---|
| 119 | <!-- Package page -->
|
---|
| 120 | <xsl:when test="sect2[@role='package']">
|
---|
| 121 | <!-- We build in a subdirectory, whose name may be needed
|
---|
| 122 | if using package management (see envars.conf), so
|
---|
| 123 | "export" it -->
|
---|
[619b313] | 124 | <xsl:text>
|
---|
| 125 | export JH_PKG_DIR=</xsl:text>
|
---|
[c048987] | 126 | <xsl:value-of select="$filename"/>
|
---|
| 127 | <xsl:text>
|
---|
[1fa0dee] | 128 | SRC_DIR=${JH_SRC_ARCHIVE}${JH_SRC_SUBDIRS:+/${JH_PKG_DIR}}
|
---|
| 129 | BUILD_DIR=${JH_BUILD_ROOT}${JH_BUILD_SUBDIRS:+/${JH_PKG_DIR}}
|
---|
[39dc04a] | 130 | mkdir -p $SRC_DIR
|
---|
| 131 | mkdir -p $BUILD_DIR
|
---|
| 132 | </xsl:text>
|
---|
[67c3df4] | 133 |
|
---|
| 134 | <!-- If stats are requested, include some definitions and intitializations -->
|
---|
[619b313] | 135 | <xsl:if test="$want-stats">
|
---|
| 136 | <xsl:text>
|
---|
| 137 | INFOLOG=$(pwd)/info-${JH_PKG_DIR}
|
---|
[9e0c4b6] | 138 | TESTLOG=$(pwd)/test-${JH_PKG_DIR}
|
---|
[67c3df4] | 139 | unset MAKEFLAGS
|
---|
| 140 | #MAKEFLAGS=-j4
|
---|
| 141 | echo MAKEFLAGS: $MAKEFLAGS > $INFOLOG
|
---|
[c048987] | 142 | : > $TESTLOG
|
---|
[67c3df4] | 143 | PKG_DEST=${BUILD_DIR}/dest
|
---|
| 144 | rm -rf $PKG_DEST
|
---|
| 145 | </xsl:text>
|
---|
[c048987] | 146 | </xsl:if>
|
---|
| 147 | <!-- Download code and build commands -->
|
---|
[619b313] | 148 | <xsl:apply-templates select="sect2">
|
---|
| 149 | <xsl:with-param name="want-stats" select="$want-stats"/>
|
---|
| 150 | </xsl:apply-templates>
|
---|
[c048987] | 151 | <!-- Clean-up -->
|
---|
[619b313] | 152 | <xsl:text>
|
---|
| 153 |
|
---|
| 154 | cd $BUILD_DIR
|
---|
[1fa0dee] | 155 | [[ -n "$JH_KEEP_FILES" ]] || </xsl:text>
|
---|
[c048987] | 156 | <!-- In some case, some files in the build tree are owned
|
---|
| 157 | by root -->
|
---|
| 158 | <xsl:if test="$sudo='y'">
|
---|
| 159 | <xsl:text>sudo </xsl:text>
|
---|
| 160 | </xsl:if>
|
---|
[619b313] | 161 | <xsl:text>rm -rf $JH_UNPACKDIR unpacked
|
---|
| 162 | </xsl:text>
|
---|
[c048987] | 163 | </xsl:when>
|
---|
| 164 | <!-- Non-package page -->
|
---|
| 165 | <xsl:otherwise>
|
---|
| 166 | <xsl:apply-templates select=".//screen" mode="not-pack"/>
|
---|
| 167 | </xsl:otherwise>
|
---|
| 168 | </xsl:choose>
|
---|
[619b313] | 169 | <xsl:text>
|
---|
| 170 | exit
|
---|
| 171 | </xsl:text><!-- include a \n at the end of document-->
|
---|
[c048987] | 172 | </exsl:document>
|
---|
[e576789] | 173 | </xsl:template>
|
---|
| 174 |
|
---|
| 175 | <!--======================= Sub-sections code =======================-->
|
---|
| 176 |
|
---|
| 177 | <xsl:template match="sect2">
|
---|
[619b313] | 178 | <xsl:param name="want-stats" select="false"/>
|
---|
[e576789] | 179 | <xsl:choose>
|
---|
[c048987] | 180 |
|
---|
[e576789] | 181 | <xsl:when test="@role = 'package'">
|
---|
[619b313] | 182 | <xsl:text>
|
---|
| 183 | cd $SRC_DIR</xsl:text>
|
---|
[642722f] | 184 | <!-- Download information is in bridgehead tags -->
|
---|
[e576789] | 185 | <xsl:apply-templates select="bridgehead[@renderas='sect3']"/>
|
---|
[c048987] | 186 | </xsl:when><!-- @role="package" -->
|
---|
| 187 |
|
---|
[967b819] | 188 | <xsl:when test="@role = 'qt4-prefix' or @role = 'qt5-prefix'">
|
---|
[625cb14] | 189 | <xsl:apply-templates select=".//screen[./userinput]"/>
|
---|
[967b819] | 190 | </xsl:when>
|
---|
[c048987] | 191 |
|
---|
[0a0b609] | 192 | <xsl:when test="@role = 'installation' and
|
---|
| 193 | not(preceding-sibling::sect2[@role = 'installation'])">
|
---|
[e576789] | 194 | <xsl:text>
|
---|
[39dc04a] | 195 | cd $BUILD_DIR
|
---|
[07f7eff] | 196 | find . -maxdepth 1 -mindepth 1 -type d | xargs </xsl:text>
|
---|
| 197 | <xsl:if test="$sudo='y'">
|
---|
| 198 | <xsl:text>sudo </xsl:text>
|
---|
| 199 | </xsl:if>
|
---|
| 200 | <xsl:text>rm -rf
|
---|
[67c3df4] | 201 | </xsl:text>
|
---|
[619b313] | 202 | <!-- If stats are requested, insert the start size -->
|
---|
| 203 | <xsl:if test="$want-stats">
|
---|
| 204 | <xsl:text>
|
---|
| 205 | echo Start Size: $(sudo du -skx --exclude home /) >> $INFOLOG
|
---|
[67c3df4] | 206 | </xsl:text>
|
---|
| 207 | </xsl:if>
|
---|
| 208 |
|
---|
[619b313] | 209 | <xsl:text>
|
---|
| 210 | case $PACKAGE in
|
---|
[e6967a1] | 211 | *.tar.gz|*.tar.bz2|*.tar.xz|*.tgz|*.tar.lzma)
|
---|
[39dc04a] | 212 | tar -xvf $SRC_DIR/$PACKAGE > unpacked
|
---|
[1fa0dee] | 213 | JH_UNPACKDIR=`grep '[^./]\+' unpacked | head -n1 | sed 's@^\./@@;s@/.*@@'`
|
---|
[6eaae5e] | 214 | ;;
|
---|
| 215 | *.tar.lz)
|
---|
[39dc04a] | 216 | bsdtar -xvf $SRC_DIR/$PACKAGE 2> unpacked
|
---|
[1fa0dee] | 217 | JH_UNPACKDIR=`head -n1 unpacked | cut -d" " -f2 | sed 's@^\./@@;s@/.*@@'`
|
---|
[67992a0] | 218 | ;;
|
---|
| 219 | *.zip)
|
---|
[39dc04a] | 220 | zipinfo -1 $SRC_DIR/$PACKAGE > unpacked
|
---|
[1fa0dee] | 221 | JH_UNPACKDIR="$(sed 's@/.*@@' unpacked | uniq )"
|
---|
| 222 | if test $(wc -w <<< $JH_UNPACKDIR) -eq 1; then
|
---|
[39dc04a] | 223 | unzip $SRC_DIR/$PACKAGE
|
---|
[67992a0] | 224 | else
|
---|
[1fa0dee] | 225 | JH_UNPACKDIR=${PACKAGE%.zip}
|
---|
| 226 | unzip -d $JH_UNPACKDIR $SRC_DIR/$PACKAGE
|
---|
[67992a0] | 227 | fi
|
---|
| 228 | ;;
|
---|
| 229 | *)
|
---|
[1fa0dee] | 230 | JH_UNPACKDIR=$JH_PKG_DIR-build
|
---|
| 231 | mkdir $JH_UNPACKDIR
|
---|
| 232 | cp $SRC_DIR/$PACKAGE $JH_UNPACKDIR
|
---|
[619b313] | 233 | ADDITIONAL="$(find . -mindepth 1 -maxdepth 1 -type l)"
|
---|
| 234 | if [ -n "$ADDITIONAL" ]; then
|
---|
| 235 | cp $ADDITIONAL $JH_UNPACKDIR
|
---|
| 236 | fi
|
---|
[67992a0] | 237 | ;;
|
---|
| 238 | esac
|
---|
[1fa0dee] | 239 | export JH_UNPACKDIR
|
---|
[619b313] | 240 | cd $JH_UNPACKDIR
|
---|
[67992a0] | 241 | </xsl:text>
|
---|
[619b313] | 242 | <!-- If stats are requested, insert the start time -->
|
---|
| 243 | <xsl:if test="$want-stats">
|
---|
| 244 | <xsl:text>
|
---|
| 245 | echo Start Time: ${SECONDS} >> $INFOLOG
|
---|
[67c3df4] | 246 | </xsl:text>
|
---|
| 247 | </xsl:if>
|
---|
| 248 |
|
---|
[7933ed7] | 249 | <xsl:call-template name="process-install">
|
---|
| 250 | <xsl:with-param
|
---|
| 251 | name="instruction-tree"
|
---|
[625cb14] | 252 | select=".//screen[not(@role = 'nodump') and ./userinput] |
|
---|
[c048987] | 253 | .//para/command[contains(text(),'check') or
|
---|
[7933ed7] | 254 | contains(text(),'test')]"/>
|
---|
[619b313] | 255 | <xsl:with-param name="want-stats" select="$want-stats"/>
|
---|
[7933ed7] | 256 | <xsl:with-param name="root-seen" select="boolean(0)"/>
|
---|
| 257 | <xsl:with-param name="install-seen" select="boolean(0)"/>
|
---|
| 258 | <xsl:with-param name="test-seen" select="boolean(0)"/>
|
---|
| 259 | <xsl:with-param name="doc-seen" select="boolean(0)"/>
|
---|
| 260 | </xsl:call-template>
|
---|
[619b313] | 261 | <xsl:text>
|
---|
| 262 | </xsl:text>
|
---|
[e576789] | 263 | <xsl:if test="$sudo = 'y'">
|
---|
| 264 | <xsl:text>sudo /sbin/</xsl:text>
|
---|
| 265 | </xsl:if>
|
---|
[619b313] | 266 | <xsl:text>ldconfig</xsl:text>
|
---|
[c048987] | 267 | </xsl:when><!-- @role="installation" -->
|
---|
| 268 |
|
---|
[e576789] | 269 | <xsl:when test="@role = 'configuration'">
|
---|
[619b313] | 270 | <xsl:text>
</xsl:text>
|
---|
[625cb14] | 271 | <xsl:apply-templates mode="config"
|
---|
| 272 | select=".//screen[not(@role = 'nodump') and ./userinput]"/>
|
---|
[c048987] | 273 | </xsl:when><!-- @role="configuration" -->
|
---|
| 274 |
|
---|
[e576789] | 275 | </xsl:choose>
|
---|
| 276 | </xsl:template>
|
---|
| 277 |
|
---|
| 278 | <!--==================== Download code =======================-->
|
---|
| 279 |
|
---|
[642722f] | 280 | <!-- template for extracting the filename from an url in the form:
|
---|
| 281 | proto://internet.name/dir1/.../dirn/filename?condition.
|
---|
| 282 | Needed, because substring-after(...,'/') returns only the
|
---|
| 283 | substring after the first '/'. -->
|
---|
[e576789] | 284 | <xsl:template name="package_name">
|
---|
| 285 | <xsl:param name="url" select="foo"/>
|
---|
| 286 | <xsl:param name="sub-url" select="substring-after($url,'/')"/>
|
---|
| 287 | <xsl:choose>
|
---|
| 288 | <xsl:when test="contains($sub-url,'/')">
|
---|
| 289 | <xsl:call-template name="package_name">
|
---|
| 290 | <xsl:with-param name="url" select="$sub-url"/>
|
---|
| 291 | </xsl:call-template>
|
---|
| 292 | </xsl:when>
|
---|
| 293 | <xsl:otherwise>
|
---|
| 294 | <xsl:choose>
|
---|
| 295 | <xsl:when test="contains($sub-url,'?')">
|
---|
| 296 | <xsl:value-of select="substring-before($sub-url,'?')"/>
|
---|
| 297 | </xsl:when>
|
---|
| 298 | <xsl:otherwise>
|
---|
| 299 | <xsl:value-of select="$sub-url"/>
|
---|
| 300 | </xsl:otherwise>
|
---|
| 301 | </xsl:choose>
|
---|
| 302 | </xsl:otherwise>
|
---|
| 303 | </xsl:choose>
|
---|
| 304 | </xsl:template>
|
---|
| 305 |
|
---|
[642722f] | 306 | <!-- Generates the code to download a package, an additional package or
|
---|
| 307 | a patch. -->
|
---|
| 308 | <xsl:template name="download-file">
|
---|
| 309 | <xsl:param name="httpurl" select="''"/>
|
---|
| 310 | <xsl:param name="ftpurl" select="''"/>
|
---|
| 311 | <xsl:param name="md5" select="''"/>
|
---|
| 312 | <xsl:param name="varname" select="''"/>
|
---|
| 313 | <xsl:variable name="package">
|
---|
| 314 | <xsl:call-template name="package_name">
|
---|
| 315 | <xsl:with-param name="url">
|
---|
[e576789] | 316 | <xsl:choose>
|
---|
[642722f] | 317 | <xsl:when test="string-length($httpurl) > 10">
|
---|
| 318 | <xsl:value-of select="$httpurl"/>
|
---|
[e576789] | 319 | </xsl:when>
|
---|
| 320 | <xsl:otherwise>
|
---|
[642722f] | 321 | <xsl:value-of select="$ftpurl"/>
|
---|
[e576789] | 322 | </xsl:otherwise>
|
---|
| 323 | </xsl:choose>
|
---|
[642722f] | 324 | </xsl:with-param>
|
---|
| 325 | </xsl:call-template>
|
---|
| 326 | </xsl:variable>
|
---|
| 327 | <xsl:variable name="first_letter"
|
---|
| 328 | select="translate(substring($package,1,1),
|
---|
| 329 | 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
---|
| 330 | 'abcdefghijklmnopqrstuvwxyz')"/>
|
---|
| 331 | <xsl:text>
</xsl:text>
|
---|
| 332 | <xsl:value-of select="$varname"/>
|
---|
| 333 | <xsl:text>=</xsl:text>
|
---|
| 334 | <xsl:value-of select="$package"/>
|
---|
| 335 | <xsl:text>
if [[ ! -f $</xsl:text>
|
---|
| 336 | <xsl:value-of select="$varname"/>
|
---|
[8dc4646] | 337 | <xsl:text> ]] ; then
|
---|
[1fa0dee] | 338 | if [[ -f $JH_SRC_ARCHIVE/$</xsl:text>
|
---|
[642722f] | 339 | <xsl:value-of select="$varname"/>
|
---|
| 340 | <xsl:text> ]] ; then
</xsl:text>
|
---|
[1fa0dee] | 341 | <xsl:text> cp $JH_SRC_ARCHIVE/$</xsl:text>
|
---|
[642722f] | 342 | <xsl:value-of select="$varname"/>
|
---|
| 343 | <xsl:text> $</xsl:text>
|
---|
| 344 | <xsl:value-of select="$varname"/>
|
---|
[8dc4646] | 345 | <xsl:text>
|
---|
| 346 | else
</xsl:text>
|
---|
[342c862] | 347 | <!-- Download from upstream http -->
|
---|
[642722f] | 348 | <xsl:if test="string-length($httpurl) > 10">
|
---|
[8dc4646] | 349 | <xsl:text> wget -T 30 -t 5 </xsl:text>
|
---|
[642722f] | 350 | <xsl:value-of select="$httpurl"/>
|
---|
[342c862] | 351 | <xsl:text> ||
</xsl:text>
|
---|
[642722f] | 352 | </xsl:if>
|
---|
[342c862] | 353 | <!-- Download from upstream ftp -->
|
---|
[642722f] | 354 | <xsl:if test="string-length($ftpurl) > 10">
|
---|
[8dc4646] | 355 | <xsl:text> wget -T 30 -t 5 </xsl:text>
|
---|
[642722f] | 356 | <xsl:value-of select="$ftpurl"/>
|
---|
[342c862] | 357 | <xsl:text> ||
</xsl:text>
|
---|
[642722f] | 358 | </xsl:if>
|
---|
[342c862] | 359 | <!-- The FTP_SERVER mirror as a last resort -->
|
---|
[1fa0dee] | 360 | <xsl:text> wget -T 30 -t 5 ${JH_FTP_SERVER}svn/</xsl:text>
|
---|
[342c862] | 361 | <xsl:value-of select="$first_letter"/>
|
---|
| 362 | <xsl:text>/$</xsl:text>
|
---|
| 363 | <xsl:value-of select="$varname"/>
|
---|
[1fa0dee] | 364 | <xsl:text>
|
---|
[8dc4646] | 365 | fi
|
---|
[619b313] | 366 | fi</xsl:text>
|
---|
[642722f] | 367 | <xsl:if test="string-length($md5) > 10">
|
---|
[619b313] | 368 | <xsl:text>
|
---|
| 369 | echo "</xsl:text>
|
---|
[642722f] | 370 | <xsl:value-of select="$md5"/>
|
---|
| 371 | <xsl:text>  $</xsl:text>
|
---|
| 372 | <xsl:value-of select="$varname"/>
|
---|
[619b313] | 373 | <xsl:text>" | md5sum -c -</xsl:text>
|
---|
[39dc04a] | 374 | </xsl:if>
|
---|
| 375 | <!-- link additional packages into $BUILD_DIR, because they are supposed to
|
---|
| 376 | be there-->
|
---|
| 377 | <xsl:if test="string($varname) != 'PACKAGE'">
|
---|
[619b313] | 378 | <xsl:text>
|
---|
| 379 | [[ "$SRC_DIR" != "$BUILD_DIR" ]] && ln -sf $SRC_DIR/$</xsl:text>
|
---|
[39dc04a] | 380 | <xsl:value-of select="$varname"/>
|
---|
[619b313] | 381 | <xsl:text> $BUILD_DIR</xsl:text>
|
---|
[642722f] | 382 | </xsl:if>
|
---|
[619b313] | 383 | <xsl:text>
</xsl:text>
|
---|
[642722f] | 384 | </xsl:template>
|
---|
| 385 |
|
---|
| 386 | <!-- Extract the MD5 sum information -->
|
---|
| 387 | <xsl:template match="para" mode="md5">
|
---|
| 388 | <xsl:choose>
|
---|
| 389 | <xsl:when test="contains(substring-after(string(),'sum: '),'
')">
|
---|
| 390 | <xsl:value-of select="substring-before(substring-after(string(),'sum: '),'
')"/>
|
---|
[e576789] | 391 | </xsl:when>
|
---|
[642722f] | 392 | <xsl:otherwise>
|
---|
| 393 | <xsl:value-of select="substring-after(string(),'sum: ')"/>
|
---|
| 394 | </xsl:otherwise>
|
---|
[e576789] | 395 | </xsl:choose>
|
---|
| 396 | </xsl:template>
|
---|
| 397 |
|
---|
[642722f] | 398 | <!-- We have several templates itemizedlist, depending on whether we
|
---|
| 399 | expect the package information, or additional package(s) or patch(es)
|
---|
| 400 | information. Select the appropriate mode here. -->
|
---|
| 401 | <xsl:template match="bridgehead">
|
---|
[e576789] | 402 | <xsl:choose>
|
---|
[642722f] | 403 | <!-- Special case for Openjdk -->
|
---|
| 404 | <xsl:when test="contains(string(),'Source Package Information')">
|
---|
| 405 | <xsl:apply-templates
|
---|
| 406 | select="following-sibling::itemizedlist[1]//simplelist">
|
---|
| 407 | <xsl:with-param name="varname" select="'PACKAGE'"/>
|
---|
| 408 | </xsl:apply-templates>
|
---|
| 409 | <xsl:apply-templates select="following-sibling::itemizedlist
|
---|
| 410 | [preceding-sibling::bridgehead[1]=current()
|
---|
| 411 | and position() >1]//simplelist">
|
---|
| 412 | <xsl:with-param name="varname" select="'PACKAGE1'"/>
|
---|
| 413 | </xsl:apply-templates>
|
---|
[e576789] | 414 | </xsl:when>
|
---|
[642722f] | 415 | <!-- Package information -->
|
---|
| 416 | <xsl:when test="contains(string(),'Package Information')">
|
---|
| 417 | <xsl:apply-templates select="following-sibling::itemizedlist
|
---|
| 418 | [preceding-sibling::bridgehead[1]=current()]"
|
---|
| 419 | mode="package"/>
|
---|
[e576789] | 420 | </xsl:when>
|
---|
[642722f] | 421 | <!-- Additional package information -->
|
---|
[ba57e61] | 422 | <!-- special case for llvm -->
|
---|
| 423 | <xsl:when test="contains(string(),'Optional Download')">
|
---|
| 424 | <xsl:apply-templates select="following-sibling::itemizedlist"
|
---|
| 425 | mode="additional"/>
|
---|
| 426 | </xsl:when>
|
---|
| 427 | <!-- All other additional packages have "Additional" -->
|
---|
[642722f] | 428 | <xsl:when test="contains(string(),'Additional')">
|
---|
| 429 | <xsl:apply-templates select="following-sibling::itemizedlist"
|
---|
| 430 | mode="additional"/>
|
---|
[e576789] | 431 | </xsl:when>
|
---|
[642722f] | 432 | <!-- Do not do anything if the dev has created another type of
|
---|
| 433 | bridgehead. -->
|
---|
| 434 | <xsl:otherwise/>
|
---|
[e576789] | 435 | </xsl:choose>
|
---|
| 436 | </xsl:template>
|
---|
| 437 |
|
---|
[642722f] | 438 | <!-- Call the download code template with appropriate parameters -->
|
---|
| 439 | <xsl:template match="itemizedlist" mode="package">
|
---|
| 440 | <xsl:call-template name="download-file">
|
---|
| 441 | <xsl:with-param name="httpurl">
|
---|
| 442 | <xsl:value-of select="./listitem[1]/para/ulink/@url"/>
|
---|
| 443 | </xsl:with-param>
|
---|
| 444 | <xsl:with-param name="ftpurl">
|
---|
| 445 | <xsl:value-of select="./listitem/para[contains(string(),'FTP')]/ulink/@url"/>
|
---|
| 446 | </xsl:with-param>
|
---|
| 447 | <xsl:with-param name="md5">
|
---|
| 448 | <xsl:apply-templates select="./listitem/para[contains(string(),'MD5')]"
|
---|
| 449 | mode="md5"/>
|
---|
| 450 | </xsl:with-param>
|
---|
| 451 | <xsl:with-param name="varname" select="'PACKAGE'"/>
|
---|
| 452 | </xsl:call-template>
|
---|
[e576789] | 453 | </xsl:template>
|
---|
| 454 |
|
---|
[642722f] | 455 | <xsl:template match="itemizedlist" mode="additional">
|
---|
| 456 | <!-- The normal layout is "one listitem"<->"one url", but some devs
|
---|
| 457 | find amusing to have FTP and/or MD5sum listitems, or to
|
---|
| 458 | enclose the download information inside a simplelist tag... -->
|
---|
| 459 | <xsl:for-each select="listitem[.//ulink]">
|
---|
| 460 | <xsl:choose>
|
---|
| 461 | <!-- hopefully, there was a HTTP line before -->
|
---|
| 462 | <xsl:when test="contains(string(./para),'FTP')"/>
|
---|
| 463 | <xsl:when test=".//simplelist">
|
---|
| 464 | <xsl:apply-templates select=".//simplelist">
|
---|
| 465 | <xsl:with-param name="varname" select="'PACKAGE1'"/>
|
---|
| 466 | </xsl:apply-templates>
|
---|
| 467 | </xsl:when>
|
---|
| 468 | <xsl:otherwise>
|
---|
| 469 | <xsl:call-template name="download-file">
|
---|
| 470 | <xsl:with-param name="httpurl">
|
---|
| 471 | <xsl:value-of select="./para/ulink/@url"/>
|
---|
| 472 | </xsl:with-param>
|
---|
| 473 | <xsl:with-param name="ftpurl">
|
---|
| 474 | <xsl:value-of
|
---|
| 475 | select="following-sibling::listitem[1]/
|
---|
| 476 | para[contains(string(),'FTP')]/ulink/@url"/>
|
---|
| 477 | </xsl:with-param>
|
---|
| 478 | <xsl:with-param name="md5">
|
---|
| 479 | <xsl:apply-templates
|
---|
| 480 | select="following-sibling::listitem[position()<3]/
|
---|
| 481 | para[contains(string(),'MD5')]"
|
---|
| 482 | mode="md5"/>
|
---|
| 483 | </xsl:with-param>
|
---|
| 484 | <xsl:with-param name="varname">
|
---|
| 485 | <xsl:choose>
|
---|
| 486 | <xsl:when test="contains(./para/ulink/@url,'.patch')">
|
---|
| 487 | <xsl:text>PATCH</xsl:text>
|
---|
| 488 | </xsl:when>
|
---|
| 489 | <xsl:otherwise>
|
---|
| 490 | <xsl:text>PACKAGE1</xsl:text>
|
---|
| 491 | </xsl:otherwise>
|
---|
| 492 | </xsl:choose>
|
---|
| 493 | </xsl:with-param>
|
---|
| 494 | </xsl:call-template>
|
---|
| 495 | </xsl:otherwise>
|
---|
| 496 | </xsl:choose>
|
---|
| 497 | </xsl:for-each>
|
---|
[e576789] | 498 | </xsl:template>
|
---|
| 499 |
|
---|
[642722f] | 500 | <!-- the simplelist case. Hopefully, the layout is one member for
|
---|
| 501 | url, one for md5 and others for various information, that we do not
|
---|
| 502 | use -->
|
---|
| 503 | <xsl:template match="simplelist">
|
---|
| 504 | <xsl:param name="varname" select="'PACKAGE1'"/>
|
---|
| 505 | <xsl:call-template name="download-file">
|
---|
| 506 | <xsl:with-param name="httpurl" select=".//ulink/@url"/>
|
---|
| 507 | <xsl:with-param name="md5">
|
---|
| 508 | <xsl:value-of select="substring-after(member[contains(string(),'MD5')],'sum: ')"/>
|
---|
| 509 | </xsl:with-param>
|
---|
| 510 | <xsl:with-param name="varname" select="$varname"/>
|
---|
| 511 | </xsl:call-template>
|
---|
| 512 | </xsl:template>
|
---|
[625cb14] | 513 |
|
---|
| 514 | <!--====================== Non package code =========================-->
|
---|
| 515 |
|
---|
| 516 | <xsl:template match="screen" mode="not-pack">
|
---|
| 517 | <xsl:choose>
|
---|
[6622409] | 518 | <xsl:when test="@role='nodump'"/>
|
---|
[625cb14] | 519 | <xsl:when test="ancestor::sect1[@id='postlfs-config-vimrc']">
|
---|
| 520 | <xsl:text>
|
---|
| 521 | cat > ~/.vimrc <<EOF
|
---|
| 522 | </xsl:text>
|
---|
| 523 | <xsl:apply-templates/>
|
---|
| 524 | <xsl:text>
|
---|
| 525 | EOF
|
---|
| 526 | </xsl:text>
|
---|
| 527 | </xsl:when>
|
---|
| 528 | <xsl:otherwise>
|
---|
| 529 | <xsl:apply-templates select="." mode="config"/>
|
---|
| 530 | </xsl:otherwise>
|
---|
| 531 | </xsl:choose>
|
---|
| 532 | </xsl:template>
|
---|
[e576789] | 533 | <!--======================== Commands code ==========================-->
|
---|
[c048987] | 534 | <!-- Code for installation instructions is in gen-install.xsl -->
|
---|
[e576789] | 535 |
|
---|
| 536 | <xsl:template match="screen">
|
---|
[c048987] | 537 | <xsl:choose>
|
---|
| 538 | <!-- instructions run as root (configuration mainly) -->
|
---|
| 539 | <xsl:when test="@role = 'root'">
|
---|
[aeb8539] | 540 | <!-- templates begin/end-root are in gen-install.xsl -->
|
---|
[c048987] | 541 | <xsl:if test="not(preceding-sibling::screen[1][@role='root'])">
|
---|
[aeb8539] | 542 | <xsl:call-template name="begin-root"/>
|
---|
[c048987] | 543 | </xsl:if>
|
---|
| 544 | <xsl:apply-templates mode="root"/>
|
---|
| 545 | <xsl:if test="not(following-sibling::screen[1][@role='root'])">
|
---|
[aeb8539] | 546 | <xsl:call-template name="end-root"/>
|
---|
[c048987] | 547 | </xsl:if>
|
---|
| 548 | </xsl:when>
|
---|
[67c3df4] | 549 | <!-- then all the instructions run as user -->
|
---|
[c048987] | 550 | <xsl:otherwise>
|
---|
| 551 | <xsl:apply-templates select="userinput"/>
|
---|
| 552 | </xsl:otherwise>
|
---|
| 553 | </xsl:choose>
|
---|
[e576789] | 554 | </xsl:template>
|
---|
| 555 |
|
---|
[8fc6a47] | 556 | <!-- Templates for bootscripts/units installation -->
|
---|
[70d73d1] | 557 | <xsl:template name="set-bootpkg-dir">
|
---|
| 558 | <xsl:param name="bootpkg" select="'bootscripts'"/>
|
---|
| 559 | <xsl:param name="url" select="''"/>
|
---|
[619b313] | 560 | <xsl:text>
|
---|
| 561 | BOOTPKG_DIR=blfs-</xsl:text>
|
---|
[70d73d1] | 562 | <xsl:copy-of select="$bootpkg"/>
|
---|
| 563 | <xsl:text>
|
---|
[619b313] | 564 |
|
---|
[1fa0dee] | 565 | BOOTSRC_DIR=${JH_SRC_ARCHIVE}${JH_SRC_SUBDIRS:+/${BOOTPKG_DIR}}
|
---|
| 566 | BOOTBUILD_DIR=${JH_BUILD_ROOT}${JH_BUILD_SUBDIRS:+/${BOOTPKG_DIR}}
|
---|
[973c767] | 567 | mkdir -p $BOOTSRC_DIR
|
---|
| 568 | mkdir -p $BOOTBUILD_DIR
|
---|
| 569 |
|
---|
| 570 | pushd $BOOTSRC_DIR
|
---|
[e576789] | 571 | URL=</xsl:text>
|
---|
[70d73d1] | 572 | <xsl:value-of select="$url"/>
|
---|
| 573 | <xsl:text>
|
---|
[e576789] | 574 | BOOTPACKG=$(basename $URL)
|
---|
[bbcdeab] | 575 | if [[ ! -f $BOOTPACKG ]] ; then
|
---|
[1fa0dee] | 576 | if [[ -f $JH_SRC_ARCHIVE/$BOOTPACKG ]] ; then
|
---|
| 577 | cp $JH_SRC_ARCHIVE/$BOOTPACKG $BOOTPACKG
|
---|
[bbcdeab] | 578 | else
|
---|
| 579 | wget -T 30 -t 5 $URL
|
---|
| 580 | fi
|
---|
[973c767] | 581 | rm -f $BOOTBUILD_DIR/unpacked
|
---|
[bbcdeab] | 582 | fi
|
---|
| 583 |
|
---|
[973c767] | 584 | cd $BOOTBUILD_DIR
|
---|
[e576789] | 585 | if [[ -e unpacked ]] ; then
|
---|
[f079f8f] | 586 | BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
|
---|
| 587 | if ! [[ -d $BOOTUNPACKDIR ]]; then
|
---|
[973c767] | 588 | tar -xvf $BOOTSRC_DIR/$BOOTPACKG > unpacked
|
---|
[f079f8f] | 589 | BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
|
---|
[e576789] | 590 | fi
|
---|
| 591 | else
|
---|
[973c767] | 592 | tar -xvf $BOOTSRC_DIR/$BOOTPACKG > unpacked
|
---|
[f079f8f] | 593 | BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
|
---|
[e576789] | 594 | fi
|
---|
[619b313] | 595 | cd $BOOTUNPACKDIR</xsl:text>
|
---|
[70d73d1] | 596 | </xsl:template>
|
---|
| 597 |
|
---|
| 598 | <xsl:template match="screen" mode="config">
|
---|
| 599 | <xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts']">
|
---|
[aeb8539] | 600 | <!-- if the preceding "screen" tag is role="root", and we are role="root"
|
---|
| 601 | the end-root has not been called. So do it -->
|
---|
[619b313] | 602 | <xsl:if
|
---|
| 603 | test="preceding-sibling::screen[1][@role='root'] and @role='root'">
|
---|
[aeb8539] | 604 | <xsl:call-template name="end-root"/>
|
---|
| 605 | </xsl:if>
|
---|
[70d73d1] | 606 | <xsl:call-template name="set-bootpkg-dir">
|
---|
| 607 | <xsl:with-param name="bootpkg" select="'bootscripts'"/>
|
---|
| 608 | <xsl:with-param name="url"
|
---|
| 609 | select="id('bootscripts')//itemizedlist//ulink/@url"/>
|
---|
| 610 | </xsl:call-template>
|
---|
[aeb8539] | 611 | <!-- if the preceding "screen" tag is role="root", and we are role="root"
|
---|
| 612 | the begin-root will not be called. So do it -->
|
---|
[619b313] | 613 | <xsl:if
|
---|
| 614 | test="preceding-sibling::screen[1][@role='root'] and @role='root'">
|
---|
[aeb8539] | 615 | <xsl:call-template name="begin-root"/>
|
---|
| 616 | </xsl:if>
|
---|
[70d73d1] | 617 | </xsl:if>
|
---|
| 618 | <xsl:if test="preceding-sibling::para[1]/xref[@linkend='systemd-units']">
|
---|
[aeb8539] | 619 | <!-- if the preceding "screen" tag is role="root", and we are role="root"
|
---|
| 620 | the end-root has not been called. So do it -->
|
---|
[619b313] | 621 | <xsl:if
|
---|
| 622 | test="preceding-sibling::screen[1][@role='root'] and @role='root'">
|
---|
[aeb8539] | 623 | <xsl:call-template name="end-root"/>
|
---|
| 624 | </xsl:if>
|
---|
[70d73d1] | 625 | <xsl:call-template name="set-bootpkg-dir">
|
---|
| 626 | <xsl:with-param name="bootpkg" select="'systemd-units'"/>
|
---|
| 627 | <xsl:with-param name="url"
|
---|
| 628 | select="id('systemd-units')//itemizedlist//ulink/@url"/>
|
---|
| 629 | </xsl:call-template>
|
---|
[aeb8539] | 630 | <!-- if the preceding "screen" tag is role="root", and we are role="root"
|
---|
| 631 | the begin-root will not be called. So do it -->
|
---|
[619b313] | 632 | <xsl:if
|
---|
| 633 | test="preceding-sibling::screen[1][@role='root'] and @role='root'">
|
---|
[aeb8539] | 634 | <xsl:call-template name="begin-root"/>
|
---|
| 635 | </xsl:if>
|
---|
[e576789] | 636 | </xsl:if>
|
---|
| 637 | <xsl:apply-templates select='.'/>
|
---|
[70d73d1] | 638 | <xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts' or
|
---|
| 639 | @linkend='systemd-units']">
|
---|
[aeb8539] | 640 | <!-- if the next "screen" tag is role="root", and we are role="root"
|
---|
| 641 | the end-root has not been called. So do it -->
|
---|
[619b313] | 642 | <xsl:if
|
---|
| 643 | test="following-sibling::screen[1][@role='root'] and @role='root'">
|
---|
[aeb8539] | 644 | <xsl:call-template name="end-root"/>
|
---|
| 645 | </xsl:if>
|
---|
[619b313] | 646 | <xsl:text>
|
---|
| 647 | popd</xsl:text>
|
---|
[aeb8539] | 648 | <!-- if the next "screen" tag is role="root", and we are role="root"
|
---|
| 649 | the begin-root will not be called. So do it -->
|
---|
[619b313] | 650 | <xsl:if
|
---|
| 651 | test="following-sibling::screen[1][@role='root'] and @role='root'">
|
---|
[aeb8539] | 652 | <xsl:call-template name="begin-root"/>
|
---|
| 653 | </xsl:if>
|
---|
[e576789] | 654 | </xsl:if>
|
---|
| 655 | </xsl:template>
|
---|
| 656 |
|
---|
[c048987] | 657 | <xsl:template match="command" mode="installation">
|
---|
[619b313] | 658 | <xsl:param name="want-stats" select="false"/>
|
---|
[a743e57] | 659 | <xsl:variable name="ns" select="normalize-space(string())"/>
|
---|
[c048987] | 660 | <xsl:variable name="first"
|
---|
| 661 | select="not(
|
---|
| 662 | boolean(
|
---|
| 663 | preceding-sibling::command[contains(text(),'check') or
|
---|
| 664 | contains(text(),'test')]))"/>
|
---|
| 665 | <xsl:variable name="last"
|
---|
| 666 | select="not(
|
---|
| 667 | boolean(
|
---|
| 668 | following-sibling::command[contains(text(),'check') or
|
---|
| 669 | contains(text(),'test')]))"/>
|
---|
| 670 | <xsl:choose>
|
---|
[619b313] | 671 | <xsl:when test="$want-stats">
|
---|
[c048987] | 672 | <xsl:if test="$first">
|
---|
[67c3df4] | 673 | <xsl:text>
|
---|
[619b313] | 674 |
|
---|
[67c3df4] | 675 | echo Time after make: ${SECONDS} >> $INFOLOG
|
---|
| 676 | echo Size after make: $(sudo du -skx --exclude home /) >> $INFOLOG
|
---|
| 677 | echo Time before test: ${SECONDS} >> $INFOLOG
|
---|
[c048987] | 678 |
|
---|
[67c3df4] | 679 | </xsl:text>
|
---|
[c048987] | 680 | </xsl:if>
|
---|
| 681 | </xsl:when>
|
---|
| 682 | <xsl:otherwise>
|
---|
[619b313] | 683 | <xsl:text>
|
---|
| 684 | #</xsl:text>
|
---|
[c048987] | 685 | </xsl:otherwise>
|
---|
| 686 | </xsl:choose>
|
---|
| 687 | <xsl:choose>
|
---|
| 688 | <xsl:when test="contains($ns,'make')">
|
---|
| 689 | <xsl:value-of select="substring-before($ns,'make ')"/>
|
---|
| 690 | <xsl:text>make </xsl:text>
|
---|
| 691 | <xsl:if test="not(contains($ns,'-k'))">
|
---|
| 692 | <xsl:text>-k </xsl:text>
|
---|
| 693 | </xsl:if>
|
---|
| 694 | <xsl:value-of select="substring-after($ns,'make ')"/>
|
---|
| 695 | </xsl:when>
|
---|
| 696 | <xsl:otherwise>
|
---|
| 697 | <xsl:copy-of select="$ns"/>
|
---|
| 698 | </xsl:otherwise>
|
---|
| 699 | </xsl:choose>
|
---|
[619b313] | 700 | <xsl:if test="$want-stats">
|
---|
[c048987] | 701 | <xsl:text> >> $TESTLOG 2>&1</xsl:text>
|
---|
[e576789] | 702 | </xsl:if>
|
---|
[619b313] | 703 | <xsl:text> || true</xsl:text>
|
---|
| 704 | <xsl:if test="$want-stats">
|
---|
[c048987] | 705 | <xsl:text>
|
---|
[619b313] | 706 |
|
---|
[c048987] | 707 | echo Time after test: ${SECONDS} >> $INFOLOG
|
---|
| 708 | echo Size after test: $(sudo du -skx --exclude home /) >> $INFOLOG
|
---|
| 709 | echo Time before install: ${SECONDS} >> $INFOLOG
|
---|
| 710 | </xsl:text>
|
---|
| 711 | </xsl:if>
|
---|
[e576789] | 712 | </xsl:template>
|
---|
| 713 |
|
---|
[8fc6a47] | 714 | <xsl:template match="userinput|command">
|
---|
[619b313] | 715 | <xsl:text>
|
---|
| 716 | </xsl:text>
|
---|
[e576789] | 717 | <xsl:apply-templates/>
|
---|
| 718 | </xsl:template>
|
---|
| 719 |
|
---|
[619b313] | 720 | <xsl:template match="userinput" mode="root">
|
---|
| 721 | <xsl:text>
|
---|
| 722 | </xsl:text>
|
---|
| 723 | <xsl:apply-templates mode="root"/>
|
---|
| 724 | </xsl:template>
|
---|
| 725 |
|
---|
[aeb8539] | 726 | <xsl:template match="text()">
|
---|
| 727 | <xsl:call-template name="remove-ampersand">
|
---|
| 728 | <xsl:with-param name="out-string" select="string()"/>
|
---|
| 729 | </xsl:call-template>
|
---|
| 730 | </xsl:template>
|
---|
| 731 |
|
---|
[e576789] | 732 | <xsl:template match="text()" mode="root">
|
---|
| 733 | <xsl:call-template name="output-root">
|
---|
| 734 | <xsl:with-param name="out-string" select="string()"/>
|
---|
| 735 | </xsl:call-template>
|
---|
| 736 | </xsl:template>
|
---|
| 737 |
|
---|
| 738 | <xsl:template name="output-root">
|
---|
| 739 | <xsl:param name="out-string" select="''"/>
|
---|
| 740 | <xsl:choose>
|
---|
| 741 | <xsl:when test="contains($out-string,'$') and $sudo = 'y'">
|
---|
| 742 | <xsl:call-template name="output-root">
|
---|
| 743 | <xsl:with-param name="out-string"
|
---|
| 744 | select="substring-before($out-string,'$')"/>
|
---|
| 745 | </xsl:call-template>
|
---|
| 746 | <xsl:text>\$</xsl:text>
|
---|
| 747 | <xsl:call-template name="output-root">
|
---|
| 748 | <xsl:with-param name="out-string"
|
---|
| 749 | select="substring-after($out-string,'$')"/>
|
---|
| 750 | </xsl:call-template>
|
---|
| 751 | </xsl:when>
|
---|
| 752 | <xsl:when test="contains($out-string,'`') and $sudo = 'y'">
|
---|
| 753 | <xsl:call-template name="output-root">
|
---|
| 754 | <xsl:with-param name="out-string"
|
---|
| 755 | select="substring-before($out-string,'`')"/>
|
---|
| 756 | </xsl:call-template>
|
---|
| 757 | <xsl:text>\`</xsl:text>
|
---|
| 758 | <xsl:call-template name="output-root">
|
---|
| 759 | <xsl:with-param name="out-string"
|
---|
| 760 | select="substring-after($out-string,'`')"/>
|
---|
| 761 | </xsl:call-template>
|
---|
| 762 | </xsl:when>
|
---|
| 763 | <xsl:when test="contains($out-string,'\') and $sudo = 'y'">
|
---|
| 764 | <xsl:call-template name="output-root">
|
---|
| 765 | <xsl:with-param name="out-string"
|
---|
| 766 | select="substring-before($out-string,'\')"/>
|
---|
| 767 | </xsl:call-template>
|
---|
| 768 | <xsl:text>\\</xsl:text>
|
---|
| 769 | <xsl:call-template name="output-root">
|
---|
| 770 | <xsl:with-param name="out-string"
|
---|
| 771 | select="substring-after($out-string,'\')"/>
|
---|
| 772 | </xsl:call-template>
|
---|
| 773 | </xsl:when>
|
---|
| 774 | <xsl:otherwise>
|
---|
[aeb8539] | 775 | <xsl:call-template name="remove-ampersand">
|
---|
| 776 | <xsl:with-param name="out-string" select="$out-string"/>
|
---|
| 777 | </xsl:call-template>
|
---|
| 778 | <!-- <xsl:value-of select="$out-string"/> -->
|
---|
[e576789] | 779 | </xsl:otherwise>
|
---|
| 780 | </xsl:choose>
|
---|
| 781 | </xsl:template>
|
---|
| 782 |
|
---|
[67c3df4] | 783 | <xsl:template name="output-destdir">
|
---|
| 784 | <xsl:apply-templates
|
---|
| 785 | select="userinput|following-sibling::screen[@role='root']/userinput"
|
---|
| 786 | mode="destdir"/>
|
---|
| 787 | <xsl:text>
|
---|
[619b313] | 788 |
|
---|
[67c3df4] | 789 | echo Time after install: ${SECONDS} >> $INFOLOG
|
---|
| 790 | echo Size after install: $(sudo du -skx --exclude home /) >> $INFOLOG
|
---|
| 791 | </xsl:text>
|
---|
| 792 | </xsl:template>
|
---|
| 793 |
|
---|
| 794 | <xsl:template match="userinput" mode="destdir">
|
---|
[8fc6a47] | 795 | <xsl:text>
|
---|
| 796 | </xsl:text>
|
---|
[67c3df4] | 797 | <xsl:choose>
|
---|
| 798 | <xsl:when test="./literal">
|
---|
| 799 | <xsl:call-template name="outputpkgdest">
|
---|
| 800 | <xsl:with-param name="outputstring" select="text()[1]"/>
|
---|
| 801 | </xsl:call-template>
|
---|
| 802 | <xsl:apply-templates select="literal"/>
|
---|
| 803 | <xsl:call-template name="outputpkgdest">
|
---|
| 804 | <xsl:with-param name="outputstring" select="text()[2]"/>
|
---|
| 805 | </xsl:call-template>
|
---|
| 806 | </xsl:when>
|
---|
| 807 | <xsl:otherwise>
|
---|
| 808 | <xsl:call-template name="outputpkgdest">
|
---|
| 809 | <xsl:with-param name="outputstring" select="string()"/>
|
---|
| 810 | </xsl:call-template>
|
---|
| 811 | </xsl:otherwise>
|
---|
| 812 | </xsl:choose>
|
---|
| 813 | </xsl:template>
|
---|
| 814 |
|
---|
| 815 | <xsl:template name="outputpkgdest">
|
---|
| 816 | <xsl:param name="outputstring" select="'foo'"/>
|
---|
| 817 | <xsl:choose>
|
---|
| 818 | <xsl:when test="contains($outputstring,'make ')">
|
---|
| 819 | <xsl:choose>
|
---|
| 820 | <xsl:when test="not(starts-with($outputstring,'make'))">
|
---|
| 821 | <xsl:call-template name="outputpkgdest">
|
---|
| 822 | <xsl:with-param name="outputstring"
|
---|
| 823 | select="substring-before($outputstring,'make')"/>
|
---|
| 824 | </xsl:call-template>
|
---|
| 825 | <xsl:call-template name="outputpkgdest">
|
---|
| 826 | <xsl:with-param
|
---|
| 827 | name="outputstring"
|
---|
| 828 | select="substring-after($outputstring,
|
---|
| 829 | substring-before($outputstring,'make'))"/>
|
---|
| 830 | </xsl:call-template>
|
---|
| 831 | </xsl:when>
|
---|
| 832 | <xsl:otherwise>
|
---|
[619b313] | 833 | <xsl:text>
|
---|
| 834 | make DESTDIR=$PKG_DEST</xsl:text>
|
---|
[67c3df4] | 835 | <xsl:call-template name="outputpkgdest">
|
---|
| 836 | <xsl:with-param
|
---|
| 837 | name="outputstring"
|
---|
| 838 | select="substring-after($outputstring,'make')"/>
|
---|
| 839 | </xsl:call-template>
|
---|
| 840 | </xsl:otherwise>
|
---|
| 841 | </xsl:choose>
|
---|
| 842 | </xsl:when>
|
---|
| 843 | <xsl:when test="contains($outputstring,'ninja install')">
|
---|
| 844 | <xsl:choose>
|
---|
| 845 | <xsl:when test="not(starts-with($outputstring,'ninja install'))">
|
---|
| 846 | <xsl:call-template name="outputpkgdest">
|
---|
| 847 | <xsl:with-param name="outputstring"
|
---|
| 848 | select="substring-before($outputstring,'ninja install')"/>
|
---|
| 849 | </xsl:call-template>
|
---|
| 850 | <xsl:call-template name="outputpkgdest">
|
---|
| 851 | <xsl:with-param
|
---|
| 852 | name="outputstring"
|
---|
| 853 | select="substring-after($outputstring,
|
---|
| 854 | substring-before($outputstring,'ninja install'))"/>
|
---|
| 855 | </xsl:call-template>
|
---|
| 856 | </xsl:when>
|
---|
| 857 | <xsl:otherwise>
|
---|
[619b313] | 858 | <xsl:text>
|
---|
| 859 | DESTDIR=$PKG_DEST ninja</xsl:text>
|
---|
[67c3df4] | 860 | <xsl:call-template name="outputpkgdest">
|
---|
| 861 | <xsl:with-param
|
---|
| 862 | name="outputstring"
|
---|
| 863 | select="substring-after($outputstring,'ninja')"/>
|
---|
| 864 | </xsl:call-template>
|
---|
| 865 | </xsl:otherwise>
|
---|
| 866 | </xsl:choose>
|
---|
| 867 | </xsl:when>
|
---|
| 868 | <xsl:otherwise> <!-- no make nor ninja in this string -->
|
---|
| 869 | <xsl:choose>
|
---|
| 870 | <xsl:when test="contains($outputstring,'>/') and
|
---|
| 871 | not(contains(substring-before($outputstring,'>/'),' /'))">
|
---|
[aeb8539] | 872 | <xsl:call-template name="remove-ampersand">
|
---|
| 873 | <xsl:with-param name="out-string"
|
---|
| 874 | select="substring-before($outputstring,'>/')"/>
|
---|
| 875 | </xsl:call-template>
|
---|
| 876 | <!-- <xsl:value-of select="substring-before($outputstring,'>/')"/>-->
|
---|
[67c3df4] | 877 | <xsl:text>>$PKG_DEST/</xsl:text>
|
---|
| 878 | <xsl:call-template name="outputpkgdest">
|
---|
| 879 | <xsl:with-param name="outputstring" select="substring-after($outputstring,'>/')"/>
|
---|
| 880 | </xsl:call-template>
|
---|
| 881 | </xsl:when>
|
---|
| 882 | <xsl:when test="contains($outputstring,' /')">
|
---|
[aeb8539] | 883 | <xsl:call-template name="remove-ampersand">
|
---|
| 884 | <xsl:with-param name="out-string"
|
---|
| 885 | select="substring-before($outputstring,' /')"/>
|
---|
| 886 | </xsl:call-template>
|
---|
| 887 | <!-- <xsl:value-of select="substring-before($outputstring,' /')"/>-->
|
---|
[67c3df4] | 888 | <xsl:text> $PKG_DEST/</xsl:text>
|
---|
| 889 | <xsl:call-template name="outputpkgdest">
|
---|
| 890 | <xsl:with-param name="outputstring" select="substring-after($outputstring,' /')"/>
|
---|
| 891 | </xsl:call-template>
|
---|
| 892 | </xsl:when>
|
---|
| 893 | <xsl:otherwise>
|
---|
[aeb8539] | 894 | <xsl:call-template name="remove-ampersand">
|
---|
| 895 | <xsl:with-param name="out-string" select="$outputstring"/>
|
---|
| 896 | </xsl:call-template>
|
---|
| 897 | <!-- <xsl:value-of select="$outputstring"/>-->
|
---|
[67c3df4] | 898 | </xsl:otherwise>
|
---|
| 899 | </xsl:choose>
|
---|
| 900 | </xsl:otherwise>
|
---|
| 901 | </xsl:choose>
|
---|
| 902 | </xsl:template>
|
---|
| 903 |
|
---|
[aeb8539] | 904 | <xsl:template name="remove-ampersand">
|
---|
| 905 | <xsl:param name="out-string" select="''"/>
|
---|
| 906 | <xsl:choose>
|
---|
| 907 | <xsl:when test="contains($out-string,'&&
')">
|
---|
| 908 | <xsl:variable name="instruction-before">
|
---|
| 909 | <xsl:call-template name="last-line">
|
---|
| 910 | <xsl:with-param
|
---|
| 911 | name="instructions"
|
---|
| 912 | select="substring-before($out-string,'&&
')"/>
|
---|
| 913 | </xsl:call-template>
|
---|
| 914 | </xsl:variable>
|
---|
| 915 | <xsl:call-template name="remove-end-space">
|
---|
| 916 | <xsl:with-param
|
---|
| 917 | name="instructions"
|
---|
| 918 | select="substring-before($out-string,'&&
')"/>
|
---|
| 919 | </xsl:call-template>
|
---|
| 920 | <xsl:if test="contains($instruction-before,' ]') or
|
---|
| 921 | contains($instruction-before,'test ') or
|
---|
| 922 | contains($instruction-before,'pgrep -l')">
|
---|
| 923 | <xsl:text> &&</xsl:text>
|
---|
| 924 | </xsl:if>
|
---|
[619b313] | 925 | <xsl:text>
|
---|
| 926 | </xsl:text>
|
---|
[aeb8539] | 927 | <xsl:call-template name="remove-ampersand">
|
---|
| 928 | <xsl:with-param name="out-string"
|
---|
| 929 | select="substring-after($out-string,
|
---|
| 930 | '&&
')"/>
|
---|
| 931 | </xsl:call-template>
|
---|
| 932 | </xsl:when>
|
---|
| 933 | <xsl:otherwise>
|
---|
| 934 | <xsl:copy-of select="$out-string"/>
|
---|
| 935 | </xsl:otherwise>
|
---|
| 936 | </xsl:choose>
|
---|
| 937 | </xsl:template>
|
---|
| 938 |
|
---|
| 939 | <xsl:template name="last-line">
|
---|
| 940 | <xsl:param name="instructions" select="''"/>
|
---|
| 941 | <xsl:choose>
|
---|
| 942 | <xsl:when test="contains($instructions,'
')">
|
---|
| 943 | <xsl:call-template name="last-line">
|
---|
| 944 | <xsl:with-param
|
---|
| 945 | name="instructions"
|
---|
| 946 | select="substring-after($instructions,'
')"/>
|
---|
| 947 | </xsl:call-template>
|
---|
| 948 | </xsl:when>
|
---|
| 949 | <xsl:otherwise>
|
---|
| 950 | <xsl:copy-of select="normalize-space($instructions)"/>
|
---|
| 951 | </xsl:otherwise>
|
---|
| 952 | </xsl:choose>
|
---|
| 953 | </xsl:template>
|
---|
| 954 |
|
---|
| 955 | <xsl:template name="remove-end-space">
|
---|
| 956 | <xsl:param name="instructions" select="''"/>
|
---|
| 957 | <xsl:choose>
|
---|
[619b313] | 958 | <xsl:when
|
---|
| 959 | test="substring($instructions,string-length($instructions))=' '">
|
---|
[aeb8539] | 960 | <xsl:call-template name="remove-end-space">
|
---|
| 961 | <xsl:with-param
|
---|
| 962 | name="instructions"
|
---|
[619b313] | 963 | select="substring($instructions,
|
---|
| 964 | 1,
|
---|
| 965 | string-length($instructions)-1)"/>
|
---|
[aeb8539] | 966 | </xsl:call-template>
|
---|
| 967 | </xsl:when>
|
---|
| 968 | <xsl:otherwise>
|
---|
[619b313] | 969 | <xsl:copy-of select="$instructions"/>
|
---|
[aeb8539] | 970 | </xsl:otherwise>
|
---|
| 971 | </xsl:choose>
|
---|
| 972 | </xsl:template>
|
---|
| 973 |
|
---|
[e576789] | 974 | </xsl:stylesheet>
|
---|