[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 |
|
---|
[625cb14] | 38 | <!-- Localization in the form ll_CC.charmap@modifier (to be used in
|
---|
| 39 | bash shell startup scripts). ll, CC, and charmap must be present:
|
---|
| 40 | no way to use "C" or "POSIX". -->
|
---|
| 41 | <xsl:param name="language" select="'en_US.UTF-8'"/>
|
---|
| 42 |
|
---|
| 43 | <!-- Break it in pieces -->
|
---|
| 44 | <xsl:variable name="lang-ll">
|
---|
| 45 | <xsl:copy-of select="substring-before($language,'_')"/>
|
---|
| 46 | </xsl:variable>
|
---|
| 47 | <xsl:variable name="lang-CC">
|
---|
| 48 | <xsl:copy-of
|
---|
| 49 | select="substring-before(substring-after($language,'_'),'.')"/>
|
---|
| 50 | </xsl:variable>
|
---|
| 51 | <xsl:variable name="lang-charmap">
|
---|
| 52 | <xsl:choose>
|
---|
| 53 | <xsl:when test="contains($language,'@')">
|
---|
| 54 | <xsl:copy-of
|
---|
| 55 | select="substring-before(substring-after($language,'.'),'@')"/>
|
---|
| 56 | </xsl:when>
|
---|
| 57 | <xsl:otherwise>
|
---|
| 58 | <xsl:copy-of select="substring-after($language,'.')"/>
|
---|
| 59 | </xsl:otherwise>
|
---|
| 60 | </xsl:choose>
|
---|
| 61 | </xsl:variable>
|
---|
| 62 | <xsl:variable name="lang-modifier">
|
---|
| 63 | <xsl:choose>
|
---|
| 64 | <xsl:when test="contains($language,'@')">
|
---|
| 65 | <xsl:copy-of select="concat('@',substring-after($language,'@'))"/>
|
---|
| 66 | </xsl:when>
|
---|
| 67 | <xsl:otherwise>
|
---|
| 68 | <xsl:copy-of select="''"/>
|
---|
| 69 | </xsl:otherwise>
|
---|
| 70 | </xsl:choose>
|
---|
| 71 | </xsl:variable>
|
---|
| 72 |
|
---|
[dc7fd7b] | 73 | <!-- simple instructions for removing .la files. -->
|
---|
[619b313] | 74 | <!-- We'll use the rule that any text output begins with a linefeed if needed
|
---|
| 75 | so that we do not need to output one at the end-->
|
---|
[dc7fd7b] | 76 | <xsl:variable name="la-files-instr">
|
---|
| 77 |
|
---|
| 78 | for libdir in /lib /usr/lib $(find /opt -name lib); do
|
---|
[2969cdf] | 79 | find $libdir -name \*.la \
|
---|
| 80 | ! -path \*ImageMagick\* \
|
---|
| 81 | -delete
|
---|
[619b313] | 82 | done</xsl:variable>
|
---|
[67c3df4] | 83 |
|
---|
[c048987] | 84 | <xsl:variable name="list-stat-norm"
|
---|
| 85 | select="concat(' ', normalize-space($list-stat),' ')"/>
|
---|
| 86 |
|
---|
| 87 | <!-- To be able to use the single quote in tests -->
|
---|
| 88 | <xsl:variable name="APOS">'</xsl:variable>
|
---|
| 89 |
|
---|
| 90 | <!-- end parameters and global variables -->
|
---|
| 91 |
|
---|
[7933ed7] | 92 | <!-- include the template for processing screen children of
|
---|
| 93 | role="install" sect2 -->
|
---|
| 94 | <xsl:include href="process-install.xsl"/>
|
---|
[c048987] | 95 |
|
---|
| 96 | <!--=================== Begin processing ========================-->
|
---|
[67c3df4] | 97 |
|
---|
[e576789] | 98 | <xsl:template match="/">
|
---|
[c048987] | 99 | <xsl:apply-templates select="//sect1[@id != 'bootscripts' and
|
---|
| 100 | @id != 'systemd-units']"/>
|
---|
[e576789] | 101 | </xsl:template>
|
---|
| 102 |
|
---|
| 103 | <!--=================== Master chunks code ======================-->
|
---|
| 104 |
|
---|
| 105 | <xsl:template match="sect1">
|
---|
| 106 |
|
---|
[619b313] | 107 | <!-- Are stat requested for this page? -->
|
---|
| 108 | <xsl:variable name="want-stats"
|
---|
| 109 | select="contains($list-stat-norm,
|
---|
| 110 | concat(' ',@id,' '))"/>
|
---|
| 111 |
|
---|
[c048987] | 112 | <!-- The file names -->
|
---|
| 113 | <xsl:variable name="filename" select="@id"/>
|
---|
[e576789] | 114 |
|
---|
[c048987] | 115 | <!-- The build order -->
|
---|
| 116 | <xsl:variable name="position" select="position()"/>
|
---|
| 117 | <xsl:variable name="order">
|
---|
| 118 | <xsl:choose>
|
---|
| 119 | <xsl:when test="string-length($position) = 1">
|
---|
| 120 | <xsl:text>00</xsl:text>
|
---|
| 121 | <xsl:value-of select="$position"/>
|
---|
| 122 | </xsl:when>
|
---|
| 123 | <xsl:when test="string-length($position) = 2">
|
---|
| 124 | <xsl:text>0</xsl:text>
|
---|
| 125 | <xsl:value-of select="$position"/>
|
---|
| 126 | </xsl:when>
|
---|
| 127 | <xsl:otherwise>
|
---|
| 128 | <xsl:value-of select="$position"/>
|
---|
| 129 | </xsl:otherwise>
|
---|
| 130 | </xsl:choose>
|
---|
| 131 | </xsl:variable>
|
---|
[e576789] | 132 |
|
---|
| 133 | <!-- Depuration code -->
|
---|
[c048987] | 134 | <xsl:message>
|
---|
| 135 | <xsl:text>SCRIPT is </xsl:text>
|
---|
| 136 | <xsl:value-of select="concat($order,'-z-',$filename)"/>
|
---|
| 137 | <xsl:text>
 FTPDIR is </xsl:text>
|
---|
| 138 | <xsl:value-of select="$filename"/>
|
---|
| 139 | <xsl:text>

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