[e576789] | 1 | <?xml version="1.0"?>
|
---|
| 2 |
|
---|
| 3 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
| 4 | xmlns:exsl="http://exslt.org/common"
|
---|
| 5 | extension-element-prefixes="exsl"
|
---|
| 6 | version="1.0">
|
---|
| 7 |
|
---|
[56178ba] | 8 | <!-- $Id$ -->
|
---|
[e576789] | 9 |
|
---|
| 10 | <!-- XSLT stylesheet to create shell scripts from "linear build" BLFS books. -->
|
---|
| 11 |
|
---|
[70d73d1] | 12 | <!-- Check whether the book is sysv or systemd -->
|
---|
| 13 | <xsl:variable name="rev">
|
---|
| 14 | <xsl:choose>
|
---|
| 15 | <xsl:when test="//bookinfo/title/phrase[@revision='systemd']">
|
---|
| 16 | systemd
|
---|
| 17 | </xsl:when>
|
---|
| 18 | <xsl:otherwise>
|
---|
| 19 | sysv
|
---|
| 20 | </xsl:otherwise>
|
---|
| 21 | </xsl:choose>
|
---|
| 22 | </xsl:variable>
|
---|
| 23 |
|
---|
[945ccaa] | 24 | <!-- Wrap "root" commands inside a wrapper function, allowing
|
---|
| 25 | "porg style" package management -->
|
---|
| 26 | <xsl:param name="wrap-install" select="'n'"/>
|
---|
| 27 |
|
---|
[67c3df4] | 28 | <!-- list of packages needing stats -->
|
---|
| 29 | <xsl:param name="list-stat" select="''"/>
|
---|
| 30 |
|
---|
[dc7fd7b] | 31 | <!-- Remove libtool .la files -->
|
---|
| 32 | <xsl:param name="del-la-files" select="'y'"/>
|
---|
| 33 |
|
---|
[e576789] | 34 | <!-- Build as user (y) or as root (n)? -->
|
---|
| 35 | <xsl:param name="sudo" select="'y'"/>
|
---|
| 36 |
|
---|
[625cb14] | 37 | <!-- Localization in the form ll_CC.charmap@modifier (to be used in
|
---|
| 38 | bash shell startup scripts). ll, CC, and charmap must be present:
|
---|
| 39 | no way to use "C" or "POSIX". -->
|
---|
| 40 | <xsl:param name="language" select="'en_US.UTF-8'"/>
|
---|
| 41 |
|
---|
| 42 | <!-- Break it in pieces -->
|
---|
| 43 | <xsl:variable name="lang-ll">
|
---|
| 44 | <xsl:copy-of select="substring-before($language,'_')"/>
|
---|
| 45 | </xsl:variable>
|
---|
| 46 | <xsl:variable name="lang-CC">
|
---|
| 47 | <xsl:copy-of
|
---|
| 48 | select="substring-before(substring-after($language,'_'),'.')"/>
|
---|
| 49 | </xsl:variable>
|
---|
| 50 | <xsl:variable name="lang-charmap">
|
---|
| 51 | <xsl:choose>
|
---|
| 52 | <xsl:when test="contains($language,'@')">
|
---|
| 53 | <xsl:copy-of
|
---|
| 54 | select="substring-before(substring-after($language,'.'),'@')"/>
|
---|
| 55 | </xsl:when>
|
---|
| 56 | <xsl:otherwise>
|
---|
| 57 | <xsl:copy-of select="substring-after($language,'.')"/>
|
---|
| 58 | </xsl:otherwise>
|
---|
| 59 | </xsl:choose>
|
---|
| 60 | </xsl:variable>
|
---|
| 61 | <xsl:variable name="lang-modifier">
|
---|
| 62 | <xsl:choose>
|
---|
| 63 | <xsl:when test="contains($language,'@')">
|
---|
| 64 | <xsl:copy-of select="concat('@',substring-after($language,'@'))"/>
|
---|
| 65 | </xsl:when>
|
---|
| 66 | <xsl:otherwise>
|
---|
| 67 | <xsl:copy-of select="''"/>
|
---|
| 68 | </xsl:otherwise>
|
---|
| 69 | </xsl:choose>
|
---|
| 70 | </xsl:variable>
|
---|
| 71 |
|
---|
[dc7fd7b] | 72 | <!-- simple instructions for removing .la files. -->
|
---|
| 73 | <xsl:variable name="la-files-instr">
|
---|
| 74 |
|
---|
| 75 | for libdir in /lib /usr/lib $(find /opt -name lib); do
|
---|
[2969cdf] | 76 | find $libdir -name \*.la \
|
---|
| 77 | ! -path \*ImageMagick\* \
|
---|
| 78 | -delete
|
---|
[dc7fd7b] | 79 | done
|
---|
| 80 |
|
---|
| 81 | </xsl:variable>
|
---|
[67c3df4] | 82 |
|
---|
| 83 | <xsl:variable name="list-stat-norm"
|
---|
| 84 | select="concat(' ', normalize-space($list-stat),' ')"/>
|
---|
| 85 |
|
---|
[e576789] | 86 | <xsl:template match="/">
|
---|
| 87 | <xsl:apply-templates select="//sect1"/>
|
---|
| 88 | </xsl:template>
|
---|
| 89 |
|
---|
| 90 | <!--=================== Master chunks code ======================-->
|
---|
| 91 |
|
---|
| 92 | <xsl:template match="sect1">
|
---|
| 93 |
|
---|
[70d73d1] | 94 | <xsl:if test="@id != 'bootscripts' and @id != 'systemd-units'">
|
---|
[e576789] | 95 | <!-- The file names -->
|
---|
| 96 | <xsl:variable name="filename" select="@id"/>
|
---|
| 97 |
|
---|
| 98 | <!-- The build order -->
|
---|
| 99 | <xsl:variable name="position" select="position()"/>
|
---|
| 100 | <xsl:variable name="order">
|
---|
| 101 | <xsl:choose>
|
---|
| 102 | <xsl:when test="string-length($position) = 1">
|
---|
| 103 | <xsl:text>00</xsl:text>
|
---|
| 104 | <xsl:value-of select="$position"/>
|
---|
| 105 | </xsl:when>
|
---|
| 106 | <xsl:when test="string-length($position) = 2">
|
---|
| 107 | <xsl:text>0</xsl:text>
|
---|
| 108 | <xsl:value-of select="$position"/>
|
---|
| 109 | </xsl:when>
|
---|
| 110 | <xsl:otherwise>
|
---|
| 111 | <xsl:value-of select="$position"/>
|
---|
| 112 | </xsl:otherwise>
|
---|
| 113 | </xsl:choose>
|
---|
| 114 | </xsl:variable>
|
---|
| 115 |
|
---|
| 116 | <!-- Depuration code -->
|
---|
| 117 | <xsl:message>
|
---|
| 118 | <xsl:text>SCRIPT is </xsl:text>
|
---|
| 119 | <xsl:value-of select="concat($order,'-z-',$filename)"/>
|
---|
| 120 | <xsl:text>
 FTPDIR is </xsl:text>
|
---|
| 121 | <xsl:value-of select="$filename"/>
|
---|
| 122 | <xsl:text>

</xsl:text>
|
---|
| 123 | </xsl:message>
|
---|
| 124 |
|
---|
| 125 | <!-- Creating the scripts -->
|
---|
| 126 | <exsl:document href="{$order}-z-{$filename}" method="text">
|
---|
[eabfc59] | 127 | <xsl:text>#!/bin/bash
|
---|
| 128 | set -e
|
---|
| 129 | unset MAKELEVEL
|
---|
| 130 |
|
---|
| 131 | </xsl:text>
|
---|
[e576789] | 132 | <xsl:choose>
|
---|
| 133 | <!-- Package page -->
|
---|
[642722f] | 134 | <xsl:when test="sect2[@role='package']">
|
---|
[945ccaa] | 135 | <!-- We build in a subdirectory, whose name may be needed
|
---|
| 136 | if using package management (see envars.conf), so
|
---|
| 137 | "export" it -->
|
---|
[1fa0dee] | 138 | <xsl:text>export JH_PKG_DIR=</xsl:text>
|
---|
[e576789] | 139 | <xsl:value-of select="$filename"/>
|
---|
[39dc04a] | 140 | <xsl:text>
|
---|
[1fa0dee] | 141 | SRC_DIR=${JH_SRC_ARCHIVE}${JH_SRC_SUBDIRS:+/${JH_PKG_DIR}}
|
---|
| 142 | BUILD_DIR=${JH_BUILD_ROOT}${JH_BUILD_SUBDIRS:+/${JH_PKG_DIR}}
|
---|
[39dc04a] | 143 | mkdir -p $SRC_DIR
|
---|
| 144 | mkdir -p $BUILD_DIR
|
---|
| 145 |
|
---|
| 146 | </xsl:text>
|
---|
[67c3df4] | 147 |
|
---|
| 148 | <!-- If stats are requested, include some definitions and intitializations -->
|
---|
| 149 | <xsl:if test="contains($list-stat-norm,concat(' ',@id,' '))">
|
---|
[9e0c4b6] | 150 | <xsl:text>INFOLOG=$(pwd)/info-${JH_PKG_DIR}
|
---|
| 151 | TESTLOG=$(pwd)/test-${JH_PKG_DIR}
|
---|
[67c3df4] | 152 | unset MAKEFLAGS
|
---|
| 153 | #MAKEFLAGS=-j4
|
---|
| 154 | echo MAKEFLAGS: $MAKEFLAGS > $INFOLOG
|
---|
| 155 | > $TESTLOG
|
---|
| 156 | PKG_DEST=${BUILD_DIR}/dest
|
---|
| 157 | rm -rf $PKG_DEST
|
---|
| 158 |
|
---|
| 159 | </xsl:text>
|
---|
| 160 | </xsl:if>
|
---|
[e576789] | 161 | <!-- Download code and build commands -->
|
---|
| 162 | <xsl:apply-templates select="sect2"/>
|
---|
| 163 | <!-- Clean-up -->
|
---|
[39dc04a] | 164 | <xsl:text>cd $BUILD_DIR
|
---|
[1fa0dee] | 165 | [[ -n "$JH_KEEP_FILES" ]] || </xsl:text>
|
---|
[e576789] | 166 | <!-- In some case, some files in the build tree are owned
|
---|
| 167 | by root -->
|
---|
[642722f] | 168 | <xsl:if test="$sudo='y'">
|
---|
| 169 | <xsl:text>sudo </xsl:text>
|
---|
[e576789] | 170 | </xsl:if>
|
---|
[1fa0dee] | 171 | <xsl:text>rm -rf $JH_UNPACKDIR unpacked

</xsl:text>
|
---|
[e576789] | 172 | </xsl:when>
|
---|
| 173 | <!-- Non-package page -->
|
---|
| 174 | <xsl:otherwise>
|
---|
[625cb14] | 175 | <xsl:apply-templates select=".//screen" mode="not-pack"/>
|
---|
[e576789] | 176 | </xsl:otherwise>
|
---|
| 177 | </xsl:choose>
|
---|
| 178 | <xsl:text>exit</xsl:text>
|
---|
| 179 | </exsl:document>
|
---|
[625cb14] | 180 | </xsl:if><!-- id!=bootscript or id!=systemd-units -->
|
---|
[e576789] | 181 | </xsl:template>
|
---|
| 182 |
|
---|
| 183 | <!--======================= Sub-sections code =======================-->
|
---|
| 184 |
|
---|
| 185 | <xsl:template match="sect2">
|
---|
| 186 | <xsl:choose>
|
---|
| 187 | <xsl:when test="@role = 'package'">
|
---|
[39dc04a] | 188 | <xsl:text>cd $SRC_DIR
|
---|
| 189 | </xsl:text>
|
---|
[642722f] | 190 | <!-- Download information is in bridgehead tags -->
|
---|
[e576789] | 191 | <xsl:apply-templates select="bridgehead[@renderas='sect3']"/>
|
---|
| 192 | <xsl:text>
</xsl:text>
|
---|
| 193 | </xsl:when>
|
---|
[967b819] | 194 | <xsl:when test="@role = 'qt4-prefix' or @role = 'qt5-prefix'">
|
---|
[625cb14] | 195 | <xsl:apply-templates select=".//screen[./userinput]"/>
|
---|
[967b819] | 196 | </xsl:when>
|
---|
[e576789] | 197 | <xsl:when test="@role = 'installation'">
|
---|
| 198 | <xsl:text>
|
---|
[39dc04a] | 199 | cd $BUILD_DIR
|
---|
[07f7eff] | 200 | find . -maxdepth 1 -mindepth 1 -type d | xargs </xsl:text>
|
---|
| 201 | <xsl:if test="$sudo='y'">
|
---|
| 202 | <xsl:text>sudo </xsl:text>
|
---|
| 203 | </xsl:if>
|
---|
| 204 | <xsl:text>rm -rf
|
---|
[67c3df4] | 205 |
|
---|
| 206 | </xsl:text>
|
---|
| 207 | <!-- If stats are requested, insert the start size -->
|
---|
| 208 | <xsl:if test="contains($list-stat-norm,concat(' ',../@id,' '))">
|
---|
| 209 | <xsl:text>echo Start Size: $(sudo du -skx --exclude home /) >> $INFOLOG
|
---|
| 210 |
|
---|
| 211 | </xsl:text>
|
---|
| 212 | </xsl:if>
|
---|
| 213 |
|
---|
| 214 | <xsl:text>case $PACKAGE in
|
---|
[e6967a1] | 215 | *.tar.gz|*.tar.bz2|*.tar.xz|*.tgz|*.tar.lzma)
|
---|
[39dc04a] | 216 | tar -xvf $SRC_DIR/$PACKAGE > unpacked
|
---|
[1fa0dee] | 217 | JH_UNPACKDIR=`grep '[^./]\+' unpacked | head -n1 | sed 's@^\./@@;s@/.*@@'`
|
---|
[6eaae5e] | 218 | ;;
|
---|
| 219 | *.tar.lz)
|
---|
[39dc04a] | 220 | bsdtar -xvf $SRC_DIR/$PACKAGE 2> unpacked
|
---|
[1fa0dee] | 221 | JH_UNPACKDIR=`head -n1 unpacked | cut -d" " -f2 | sed 's@^\./@@;s@/.*@@'`
|
---|
[67992a0] | 222 | ;;
|
---|
| 223 | *.zip)
|
---|
[39dc04a] | 224 | zipinfo -1 $SRC_DIR/$PACKAGE > unpacked
|
---|
[1fa0dee] | 225 | JH_UNPACKDIR="$(sed 's@/.*@@' unpacked | uniq )"
|
---|
| 226 | if test $(wc -w <<< $JH_UNPACKDIR) -eq 1; then
|
---|
[39dc04a] | 227 | unzip $SRC_DIR/$PACKAGE
|
---|
[67992a0] | 228 | else
|
---|
[1fa0dee] | 229 | JH_UNPACKDIR=${PACKAGE%.zip}
|
---|
| 230 | unzip -d $JH_UNPACKDIR $SRC_DIR/$PACKAGE
|
---|
[67992a0] | 231 | fi
|
---|
| 232 | ;;
|
---|
| 233 | *)
|
---|
[1fa0dee] | 234 | JH_UNPACKDIR=$JH_PKG_DIR-build
|
---|
| 235 | mkdir $JH_UNPACKDIR
|
---|
| 236 | cp $SRC_DIR/$PACKAGE $JH_UNPACKDIR
|
---|
| 237 | cp $(find . -mindepth 1 -maxdepth 1 -type l) $JH_UNPACKDIR
|
---|
[67992a0] | 238 | ;;
|
---|
| 239 | esac
|
---|
[1fa0dee] | 240 | export JH_UNPACKDIR
|
---|
| 241 | cd $JH_UNPACKDIR

|
---|
[67992a0] | 242 | </xsl:text>
|
---|
[67c3df4] | 243 | <!-- If stats are requested, insert the start time -->
|
---|
| 244 | <xsl:if test="contains($list-stat-norm,concat(' ',../@id,' '))">
|
---|
| 245 | <xsl:text>echo Start Time: ${SECONDS} >> $INFOLOG
|
---|
| 246 |
|
---|
| 247 | </xsl:text>
|
---|
| 248 | </xsl:if>
|
---|
| 249 |
|
---|
[625cb14] | 250 | <xsl:apply-templates
|
---|
| 251 | select=".//screen[not(@role = 'nodump') and ./userinput] |
|
---|
| 252 | .//para/command"/>
|
---|
[e576789] | 253 | <xsl:if test="$sudo = 'y'">
|
---|
| 254 | <xsl:text>sudo /sbin/</xsl:text>
|
---|
| 255 | </xsl:if>
|
---|
| 256 | <xsl:text>ldconfig

</xsl:text>
|
---|
| 257 | </xsl:when>
|
---|
| 258 | <xsl:when test="@role = 'configuration'">
|
---|
[625cb14] | 259 | <xsl:apply-templates mode="config"
|
---|
| 260 | select=".//screen[not(@role = 'nodump') and ./userinput]"/>
|
---|
[e576789] | 261 | </xsl:when>
|
---|
| 262 | </xsl:choose>
|
---|
| 263 | </xsl:template>
|
---|
| 264 |
|
---|
| 265 | <!--==================== Download code =======================-->
|
---|
| 266 |
|
---|
[642722f] | 267 | <!-- template for extracting the filename from an url in the form:
|
---|
| 268 | proto://internet.name/dir1/.../dirn/filename?condition.
|
---|
| 269 | Needed, because substring-after(...,'/') returns only the
|
---|
| 270 | substring after the first '/'. -->
|
---|
[e576789] | 271 | <xsl:template name="package_name">
|
---|
| 272 | <xsl:param name="url" select="foo"/>
|
---|
| 273 | <xsl:param name="sub-url" select="substring-after($url,'/')"/>
|
---|
| 274 | <xsl:choose>
|
---|
| 275 | <xsl:when test="contains($sub-url,'/')">
|
---|
| 276 | <xsl:call-template name="package_name">
|
---|
| 277 | <xsl:with-param name="url" select="$sub-url"/>
|
---|
| 278 | </xsl:call-template>
|
---|
| 279 | </xsl:when>
|
---|
| 280 | <xsl:otherwise>
|
---|
| 281 | <xsl:choose>
|
---|
| 282 | <xsl:when test="contains($sub-url,'?')">
|
---|
| 283 | <xsl:value-of select="substring-before($sub-url,'?')"/>
|
---|
| 284 | </xsl:when>
|
---|
| 285 | <xsl:otherwise>
|
---|
| 286 | <xsl:value-of select="$sub-url"/>
|
---|
| 287 | </xsl:otherwise>
|
---|
| 288 | </xsl:choose>
|
---|
| 289 | </xsl:otherwise>
|
---|
| 290 | </xsl:choose>
|
---|
| 291 | </xsl:template>
|
---|
| 292 |
|
---|
[642722f] | 293 | <!-- Generates the code to download a package, an additional package or
|
---|
| 294 | a patch. -->
|
---|
| 295 | <xsl:template name="download-file">
|
---|
| 296 | <xsl:param name="httpurl" select="''"/>
|
---|
| 297 | <xsl:param name="ftpurl" select="''"/>
|
---|
| 298 | <xsl:param name="md5" select="''"/>
|
---|
| 299 | <xsl:param name="varname" select="''"/>
|
---|
| 300 | <xsl:variable name="package">
|
---|
| 301 | <xsl:call-template name="package_name">
|
---|
| 302 | <xsl:with-param name="url">
|
---|
[e576789] | 303 | <xsl:choose>
|
---|
[642722f] | 304 | <xsl:when test="string-length($httpurl) > 10">
|
---|
| 305 | <xsl:value-of select="$httpurl"/>
|
---|
[e576789] | 306 | </xsl:when>
|
---|
| 307 | <xsl:otherwise>
|
---|
[642722f] | 308 | <xsl:value-of select="$ftpurl"/>
|
---|
[e576789] | 309 | </xsl:otherwise>
|
---|
| 310 | </xsl:choose>
|
---|
[642722f] | 311 | </xsl:with-param>
|
---|
| 312 | </xsl:call-template>
|
---|
| 313 | </xsl:variable>
|
---|
| 314 | <xsl:variable name="first_letter"
|
---|
| 315 | select="translate(substring($package,1,1),
|
---|
| 316 | 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
---|
| 317 | 'abcdefghijklmnopqrstuvwxyz')"/>
|
---|
| 318 | <xsl:text>
</xsl:text>
|
---|
| 319 | <xsl:value-of select="$varname"/>
|
---|
| 320 | <xsl:text>=</xsl:text>
|
---|
| 321 | <xsl:value-of select="$package"/>
|
---|
| 322 | <xsl:text>
if [[ ! -f $</xsl:text>
|
---|
| 323 | <xsl:value-of select="$varname"/>
|
---|
[8dc4646] | 324 | <xsl:text> ]] ; then
|
---|
[1fa0dee] | 325 | if [[ -f $JH_SRC_ARCHIVE/$</xsl:text>
|
---|
[642722f] | 326 | <xsl:value-of select="$varname"/>
|
---|
| 327 | <xsl:text> ]] ; then
</xsl:text>
|
---|
[1fa0dee] | 328 | <xsl:text> cp $JH_SRC_ARCHIVE/$</xsl:text>
|
---|
[642722f] | 329 | <xsl:value-of select="$varname"/>
|
---|
| 330 | <xsl:text> $</xsl:text>
|
---|
| 331 | <xsl:value-of select="$varname"/>
|
---|
[8dc4646] | 332 | <xsl:text>
|
---|
| 333 | else
</xsl:text>
|
---|
[342c862] | 334 | <!-- Download from upstream http -->
|
---|
[642722f] | 335 | <xsl:if test="string-length($httpurl) > 10">
|
---|
[8dc4646] | 336 | <xsl:text> wget -T 30 -t 5 </xsl:text>
|
---|
[642722f] | 337 | <xsl:value-of select="$httpurl"/>
|
---|
[342c862] | 338 | <xsl:text> ||
</xsl:text>
|
---|
[642722f] | 339 | </xsl:if>
|
---|
[342c862] | 340 | <!-- Download from upstream ftp -->
|
---|
[642722f] | 341 | <xsl:if test="string-length($ftpurl) > 10">
|
---|
[8dc4646] | 342 | <xsl:text> wget -T 30 -t 5 </xsl:text>
|
---|
[642722f] | 343 | <xsl:value-of select="$ftpurl"/>
|
---|
[342c862] | 344 | <xsl:text> ||
</xsl:text>
|
---|
[642722f] | 345 | </xsl:if>
|
---|
[342c862] | 346 | <!-- The FTP_SERVER mirror as a last resort -->
|
---|
[1fa0dee] | 347 | <xsl:text> wget -T 30 -t 5 ${JH_FTP_SERVER}svn/</xsl:text>
|
---|
[342c862] | 348 | <xsl:value-of select="$first_letter"/>
|
---|
| 349 | <xsl:text>/$</xsl:text>
|
---|
| 350 | <xsl:value-of select="$varname"/>
|
---|
[1fa0dee] | 351 | <xsl:text>
|
---|
[8dc4646] | 352 | fi
|
---|
[e576789] | 353 | fi
|
---|
| 354 | </xsl:text>
|
---|
[642722f] | 355 | <xsl:if test="string-length($md5) > 10">
|
---|
| 356 | <xsl:text>echo "</xsl:text>
|
---|
| 357 | <xsl:value-of select="$md5"/>
|
---|
| 358 | <xsl:text>  $</xsl:text>
|
---|
| 359 | <xsl:value-of select="$varname"/>
|
---|
| 360 | <xsl:text>" | md5sum -c -
|
---|
[39dc04a] | 361 | </xsl:text>
|
---|
| 362 | </xsl:if>
|
---|
| 363 | <!-- link additional packages into $BUILD_DIR, because they are supposed to
|
---|
| 364 | be there-->
|
---|
| 365 | <xsl:if test="string($varname) != 'PACKAGE'">
|
---|
[8dc4646] | 366 | <xsl:text>[[ "$SRC_DIR" != "$BUILD_DIR" ]] && ln -sf $SRC_DIR/$</xsl:text>
|
---|
[39dc04a] | 367 | <xsl:value-of select="$varname"/>
|
---|
| 368 | <xsl:text> $BUILD_DIR
|
---|
[e576789] | 369 | </xsl:text>
|
---|
[642722f] | 370 | </xsl:if>
|
---|
| 371 | </xsl:template>
|
---|
| 372 |
|
---|
| 373 | <!-- Extract the MD5 sum information -->
|
---|
| 374 | <xsl:template match="para" mode="md5">
|
---|
| 375 | <xsl:choose>
|
---|
| 376 | <xsl:when test="contains(substring-after(string(),'sum: '),'
')">
|
---|
| 377 | <xsl:value-of select="substring-before(substring-after(string(),'sum: '),'
')"/>
|
---|
[e576789] | 378 | </xsl:when>
|
---|
[642722f] | 379 | <xsl:otherwise>
|
---|
| 380 | <xsl:value-of select="substring-after(string(),'sum: ')"/>
|
---|
| 381 | </xsl:otherwise>
|
---|
[e576789] | 382 | </xsl:choose>
|
---|
| 383 | </xsl:template>
|
---|
| 384 |
|
---|
[642722f] | 385 | <!-- We have several templates itemizedlist, depending on whether we
|
---|
| 386 | expect the package information, or additional package(s) or patch(es)
|
---|
| 387 | information. Select the appropriate mode here. -->
|
---|
| 388 | <xsl:template match="bridgehead">
|
---|
[e576789] | 389 | <xsl:choose>
|
---|
[642722f] | 390 | <!-- Special case for Openjdk -->
|
---|
| 391 | <xsl:when test="contains(string(),'Source Package Information')">
|
---|
| 392 | <xsl:apply-templates
|
---|
| 393 | select="following-sibling::itemizedlist[1]//simplelist">
|
---|
| 394 | <xsl:with-param name="varname" select="'PACKAGE'"/>
|
---|
| 395 | </xsl:apply-templates>
|
---|
| 396 | <xsl:apply-templates select="following-sibling::itemizedlist
|
---|
| 397 | [preceding-sibling::bridgehead[1]=current()
|
---|
| 398 | and position() >1]//simplelist">
|
---|
| 399 | <xsl:with-param name="varname" select="'PACKAGE1'"/>
|
---|
| 400 | </xsl:apply-templates>
|
---|
[e576789] | 401 | </xsl:when>
|
---|
[642722f] | 402 | <!-- Package information -->
|
---|
| 403 | <xsl:when test="contains(string(),'Package Information')">
|
---|
| 404 | <xsl:apply-templates select="following-sibling::itemizedlist
|
---|
| 405 | [preceding-sibling::bridgehead[1]=current()]"
|
---|
| 406 | mode="package"/>
|
---|
[e576789] | 407 | </xsl:when>
|
---|
[642722f] | 408 | <!-- Additional package information -->
|
---|
[ba57e61] | 409 | <!-- special case for llvm -->
|
---|
| 410 | <xsl:when test="contains(string(),'Optional Download')">
|
---|
| 411 | <xsl:apply-templates select="following-sibling::itemizedlist"
|
---|
| 412 | mode="additional"/>
|
---|
| 413 | </xsl:when>
|
---|
| 414 | <!-- All other additional packages have "Additional" -->
|
---|
[642722f] | 415 | <xsl:when test="contains(string(),'Additional')">
|
---|
| 416 | <xsl:apply-templates select="following-sibling::itemizedlist"
|
---|
| 417 | mode="additional"/>
|
---|
[e576789] | 418 | </xsl:when>
|
---|
[642722f] | 419 | <!-- Do not do anything if the dev has created another type of
|
---|
| 420 | bridgehead. -->
|
---|
| 421 | <xsl:otherwise/>
|
---|
[e576789] | 422 | </xsl:choose>
|
---|
| 423 | </xsl:template>
|
---|
| 424 |
|
---|
[642722f] | 425 | <!-- Call the download code template with appropriate parameters -->
|
---|
| 426 | <xsl:template match="itemizedlist" mode="package">
|
---|
| 427 | <xsl:call-template name="download-file">
|
---|
| 428 | <xsl:with-param name="httpurl">
|
---|
| 429 | <xsl:value-of select="./listitem[1]/para/ulink/@url"/>
|
---|
| 430 | </xsl:with-param>
|
---|
| 431 | <xsl:with-param name="ftpurl">
|
---|
| 432 | <xsl:value-of select="./listitem/para[contains(string(),'FTP')]/ulink/@url"/>
|
---|
| 433 | </xsl:with-param>
|
---|
| 434 | <xsl:with-param name="md5">
|
---|
| 435 | <xsl:apply-templates select="./listitem/para[contains(string(),'MD5')]"
|
---|
| 436 | mode="md5"/>
|
---|
| 437 | </xsl:with-param>
|
---|
| 438 | <xsl:with-param name="varname" select="'PACKAGE'"/>
|
---|
| 439 | </xsl:call-template>
|
---|
[e576789] | 440 | </xsl:template>
|
---|
| 441 |
|
---|
[642722f] | 442 | <xsl:template match="itemizedlist" mode="additional">
|
---|
| 443 | <!-- The normal layout is "one listitem"<->"one url", but some devs
|
---|
| 444 | find amusing to have FTP and/or MD5sum listitems, or to
|
---|
| 445 | enclose the download information inside a simplelist tag... -->
|
---|
| 446 | <xsl:for-each select="listitem[.//ulink]">
|
---|
| 447 | <xsl:choose>
|
---|
| 448 | <!-- hopefully, there was a HTTP line before -->
|
---|
| 449 | <xsl:when test="contains(string(./para),'FTP')"/>
|
---|
| 450 | <xsl:when test=".//simplelist">
|
---|
| 451 | <xsl:apply-templates select=".//simplelist">
|
---|
| 452 | <xsl:with-param name="varname" select="'PACKAGE1'"/>
|
---|
| 453 | </xsl:apply-templates>
|
---|
| 454 | </xsl:when>
|
---|
| 455 | <xsl:otherwise>
|
---|
| 456 | <xsl:call-template name="download-file">
|
---|
| 457 | <xsl:with-param name="httpurl">
|
---|
| 458 | <xsl:value-of select="./para/ulink/@url"/>
|
---|
| 459 | </xsl:with-param>
|
---|
| 460 | <xsl:with-param name="ftpurl">
|
---|
| 461 | <xsl:value-of
|
---|
| 462 | select="following-sibling::listitem[1]/
|
---|
| 463 | para[contains(string(),'FTP')]/ulink/@url"/>
|
---|
| 464 | </xsl:with-param>
|
---|
| 465 | <xsl:with-param name="md5">
|
---|
| 466 | <xsl:apply-templates
|
---|
| 467 | select="following-sibling::listitem[position()<3]/
|
---|
| 468 | para[contains(string(),'MD5')]"
|
---|
| 469 | mode="md5"/>
|
---|
| 470 | </xsl:with-param>
|
---|
| 471 | <xsl:with-param name="varname">
|
---|
| 472 | <xsl:choose>
|
---|
| 473 | <xsl:when test="contains(./para/ulink/@url,'.patch')">
|
---|
| 474 | <xsl:text>PATCH</xsl:text>
|
---|
| 475 | </xsl:when>
|
---|
| 476 | <xsl:otherwise>
|
---|
| 477 | <xsl:text>PACKAGE1</xsl:text>
|
---|
| 478 | </xsl:otherwise>
|
---|
| 479 | </xsl:choose>
|
---|
| 480 | </xsl:with-param>
|
---|
| 481 | </xsl:call-template>
|
---|
| 482 | </xsl:otherwise>
|
---|
| 483 | </xsl:choose>
|
---|
| 484 | </xsl:for-each>
|
---|
[e576789] | 485 | </xsl:template>
|
---|
| 486 |
|
---|
[642722f] | 487 | <!-- the simplelist case. Hopefully, the layout is one member for
|
---|
| 488 | url, one for md5 and others for various information, that we do not
|
---|
| 489 | use -->
|
---|
| 490 | <xsl:template match="simplelist">
|
---|
| 491 | <xsl:param name="varname" select="'PACKAGE1'"/>
|
---|
| 492 | <xsl:call-template name="download-file">
|
---|
| 493 | <xsl:with-param name="httpurl" select=".//ulink/@url"/>
|
---|
| 494 | <xsl:with-param name="md5">
|
---|
| 495 | <xsl:value-of select="substring-after(member[contains(string(),'MD5')],'sum: ')"/>
|
---|
| 496 | </xsl:with-param>
|
---|
| 497 | <xsl:with-param name="varname" select="$varname"/>
|
---|
| 498 | </xsl:call-template>
|
---|
| 499 | </xsl:template>
|
---|
[625cb14] | 500 |
|
---|
| 501 | <!--====================== Non package code =========================-->
|
---|
| 502 |
|
---|
| 503 | <xsl:template match="screen" mode="not-pack">
|
---|
| 504 | <xsl:choose>
|
---|
| 505 | <xsl:when test="ancestor::sect1[@id='postlfs-config-vimrc']">
|
---|
| 506 | <xsl:text>
|
---|
| 507 | cat > ~/.vimrc <<EOF
|
---|
| 508 | </xsl:text>
|
---|
| 509 | <xsl:apply-templates/>
|
---|
| 510 | <xsl:text>
|
---|
| 511 | EOF
|
---|
| 512 | </xsl:text>
|
---|
| 513 | </xsl:when>
|
---|
| 514 | <xsl:otherwise>
|
---|
| 515 | <xsl:apply-templates select="." mode="config"/>
|
---|
| 516 | </xsl:otherwise>
|
---|
| 517 | </xsl:choose>
|
---|
| 518 | </xsl:template>
|
---|
[e576789] | 519 | <!--======================== Commands code ==========================-->
|
---|
| 520 |
|
---|
| 521 | <xsl:template match="screen">
|
---|
| 522 | <xsl:if test="child::* = userinput and not(@role = 'nodump')">
|
---|
| 523 | <xsl:choose>
|
---|
[67c3df4] | 524 | <!-- First the case of installation instructions -->
|
---|
| 525 | <xsl:when test="@role = 'root' and
|
---|
| 526 | ancestor::sect2[@role='installation'] and
|
---|
| 527 | not(contains(string(),'useradd')) and
|
---|
[625cb14] | 528 | not(contains(string(),'usermod')) and
|
---|
| 529 | not(contains(string(),'icon-cache')) and
|
---|
| 530 | not(contains(string(),'desktop-database')) and
|
---|
| 531 | not(contains(string(),'compile-schemas')) and
|
---|
[67c3df4] | 532 | not(contains(string(),'groupadd'))">
|
---|
[945ccaa] | 533 | <xsl:if test="not(preceding-sibling::screen[1][@role='root'])">
|
---|
[67c3df4] | 534 | <xsl:if test="contains($list-stat-norm,
|
---|
| 535 | concat(' ',
|
---|
| 536 | ancestor::sect1/@id,
|
---|
| 537 | ' '))">
|
---|
| 538 | <xsl:call-template name="output-destdir"/>
|
---|
| 539 | </xsl:if>
|
---|
[945ccaa] | 540 | <xsl:if test="$sudo = 'y'">
|
---|
| 541 | <xsl:text>sudo -E sh << ROOT_EOF
</xsl:text>
|
---|
| 542 | </xsl:if>
|
---|
[67c3df4] | 543 | <xsl:if test="$wrap-install = 'y'">
|
---|
[1fa0dee] | 544 | <xsl:text>if [ -r "$JH_PACK_INSTALL" ]; then
|
---|
| 545 | source $JH_PACK_INSTALL
|
---|
[945ccaa] | 546 | export -f wrapInstall
|
---|
| 547 | export -f packInstall
|
---|
| 548 | fi
|
---|
| 549 | wrapInstall '
|
---|
| 550 | </xsl:text>
|
---|
| 551 | </xsl:if>
|
---|
[e576789] | 552 | </xsl:if>
|
---|
| 553 | <xsl:apply-templates mode="root"/>
|
---|
[945ccaa] | 554 | <xsl:if test="not(following-sibling::screen[1][@role='root'])">
|
---|
[67c3df4] | 555 | <xsl:if test="$del-la-files = 'y'">
|
---|
[dc7fd7b] | 556 | <xsl:call-template name="output-root">
|
---|
| 557 | <xsl:with-param name="out-string" select="$la-files-instr"/>
|
---|
| 558 | </xsl:call-template>
|
---|
| 559 | </xsl:if>
|
---|
[67c3df4] | 560 | <xsl:if test="$wrap-install = 'y'">
|
---|
[945ccaa] | 561 | <xsl:text>'
packInstall</xsl:text>
|
---|
| 562 | </xsl:if>
|
---|
| 563 | <xsl:if test="$sudo = 'y'">
|
---|
| 564 | <xsl:text>
ROOT_EOF</xsl:text>
|
---|
| 565 | </xsl:if>
|
---|
[e576789] | 566 | </xsl:if>
|
---|
| 567 | </xsl:when>
|
---|
[67c3df4] | 568 | <!-- then the case of other instructions run as root (configuration mainly) -->
|
---|
| 569 | <xsl:when test="@role = 'root'">
|
---|
| 570 | <xsl:if test="not(preceding-sibling::screen[1][@role='root'])">
|
---|
| 571 | <xsl:if test="$sudo = 'y'">
|
---|
| 572 | <xsl:text>sudo -E sh << ROOT_EOF
</xsl:text>
|
---|
| 573 | </xsl:if>
|
---|
| 574 | </xsl:if>
|
---|
| 575 | <xsl:apply-templates mode="root"/>
|
---|
| 576 | <xsl:if test="not(following-sibling::screen[1][@role='root'])">
|
---|
| 577 | <xsl:if test="$sudo = 'y'">
|
---|
| 578 | <xsl:text>
ROOT_EOF</xsl:text>
|
---|
| 579 | </xsl:if>
|
---|
| 580 | </xsl:if>
|
---|
| 581 | </xsl:when>
|
---|
| 582 | <!-- then all the instructions run as user -->
|
---|
[e576789] | 583 | <xsl:otherwise>
|
---|
| 584 | <xsl:apply-templates select="userinput"/>
|
---|
| 585 | </xsl:otherwise>
|
---|
| 586 | </xsl:choose>
|
---|
| 587 | <xsl:text>
</xsl:text>
|
---|
| 588 | </xsl:if>
|
---|
| 589 | </xsl:template>
|
---|
| 590 |
|
---|
[70d73d1] | 591 | <xsl:template name="set-bootpkg-dir">
|
---|
| 592 | <xsl:param name="bootpkg" select="'bootscripts'"/>
|
---|
| 593 | <xsl:param name="url" select="''"/>
|
---|
[973c767] | 594 | <xsl:text>BOOTPKG_DIR=blfs-</xsl:text>
|
---|
[70d73d1] | 595 | <xsl:copy-of select="$bootpkg"/>
|
---|
| 596 | <xsl:text>
|
---|
[1fa0dee] | 597 | BOOTSRC_DIR=${JH_SRC_ARCHIVE}${JH_SRC_SUBDIRS:+/${BOOTPKG_DIR}}
|
---|
| 598 | BOOTBUILD_DIR=${JH_BUILD_ROOT}${JH_BUILD_SUBDIRS:+/${BOOTPKG_DIR}}
|
---|
[973c767] | 599 | mkdir -p $BOOTSRC_DIR
|
---|
| 600 | mkdir -p $BOOTBUILD_DIR
|
---|
| 601 |
|
---|
| 602 | pushd $BOOTSRC_DIR
|
---|
[e576789] | 603 | URL=</xsl:text>
|
---|
[70d73d1] | 604 | <xsl:value-of select="$url"/>
|
---|
| 605 | <xsl:text>
|
---|
[e576789] | 606 | BOOTPACKG=$(basename $URL)
|
---|
[bbcdeab] | 607 | if [[ ! -f $BOOTPACKG ]] ; then
|
---|
[1fa0dee] | 608 | if [[ -f $JH_SRC_ARCHIVE/$BOOTPACKG ]] ; then
|
---|
| 609 | cp $JH_SRC_ARCHIVE/$BOOTPACKG $BOOTPACKG
|
---|
[bbcdeab] | 610 | else
|
---|
| 611 | wget -T 30 -t 5 $URL
|
---|
| 612 | fi
|
---|
[973c767] | 613 | rm -f $BOOTBUILD_DIR/unpacked
|
---|
[bbcdeab] | 614 | fi
|
---|
| 615 |
|
---|
[973c767] | 616 | cd $BOOTBUILD_DIR
|
---|
[e576789] | 617 | if [[ -e unpacked ]] ; then
|
---|
[f079f8f] | 618 | BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
|
---|
| 619 | if ! [[ -d $BOOTUNPACKDIR ]]; then
|
---|
[973c767] | 620 | tar -xvf $BOOTSRC_DIR/$BOOTPACKG > unpacked
|
---|
[f079f8f] | 621 | BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
|
---|
[e576789] | 622 | fi
|
---|
| 623 | else
|
---|
[973c767] | 624 | tar -xvf $BOOTSRC_DIR/$BOOTPACKG > unpacked
|
---|
[f079f8f] | 625 | BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
|
---|
[e576789] | 626 | fi
|
---|
[f079f8f] | 627 | cd $BOOTUNPACKDIR
|
---|
[e576789] | 628 | </xsl:text>
|
---|
[70d73d1] | 629 | </xsl:template>
|
---|
| 630 |
|
---|
| 631 | <xsl:template match="screen" mode="config">
|
---|
| 632 | <xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts']">
|
---|
| 633 | <xsl:call-template name="set-bootpkg-dir">
|
---|
| 634 | <xsl:with-param name="bootpkg" select="'bootscripts'"/>
|
---|
| 635 | <xsl:with-param name="url"
|
---|
| 636 | select="id('bootscripts')//itemizedlist//ulink/@url"/>
|
---|
| 637 | </xsl:call-template>
|
---|
| 638 | </xsl:if>
|
---|
| 639 | <xsl:if test="preceding-sibling::para[1]/xref[@linkend='systemd-units']">
|
---|
| 640 | <xsl:call-template name="set-bootpkg-dir">
|
---|
| 641 | <xsl:with-param name="bootpkg" select="'systemd-units'"/>
|
---|
| 642 | <xsl:with-param name="url"
|
---|
| 643 | select="id('systemd-units')//itemizedlist//ulink/@url"/>
|
---|
| 644 | </xsl:call-template>
|
---|
[e576789] | 645 | </xsl:if>
|
---|
| 646 | <xsl:apply-templates select='.'/>
|
---|
[70d73d1] | 647 | <xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts' or
|
---|
| 648 | @linkend='systemd-units']">
|
---|
[e576789] | 649 | <xsl:text>
|
---|
| 650 | popd</xsl:text>
|
---|
| 651 | </xsl:if>
|
---|
| 652 | <xsl:text>
</xsl:text>
|
---|
| 653 | </xsl:template>
|
---|
| 654 |
|
---|
| 655 | <xsl:template match="para/command">
|
---|
[a743e57] | 656 | <xsl:variable name="ns" select="normalize-space(string())"/>
|
---|
[67c3df4] | 657 | <xsl:if test="contains($ns,'test') or
|
---|
| 658 | contains($ns,'check')">
|
---|
| 659 | <xsl:choose>
|
---|
| 660 | <xsl:when test="contains($list-stat-norm,
|
---|
| 661 | concat(' ',ancestor::sect1/@id,' '))">
|
---|
| 662 | <xsl:text>
|
---|
| 663 | echo Time after make: ${SECONDS} >> $INFOLOG
|
---|
| 664 | echo Size after make: $(sudo du -skx --exclude home /) >> $INFOLOG
|
---|
| 665 | echo Time before test: ${SECONDS} >> $INFOLOG
|
---|
| 666 | </xsl:text>
|
---|
| 667 | </xsl:when>
|
---|
| 668 | <xsl:otherwise>
|
---|
| 669 | <xsl:text>#</xsl:text>
|
---|
| 670 | </xsl:otherwise>
|
---|
| 671 | </xsl:choose>
|
---|
| 672 | <xsl:choose>
|
---|
| 673 | <xsl:when test="contains($ns,'make')">
|
---|
| 674 | <xsl:value-of select="substring-before($ns,'make ')"/>
|
---|
| 675 | <xsl:text>make </xsl:text>
|
---|
| 676 | <xsl:if test="not(contains($ns,'-k'))">
|
---|
| 677 | <xsl:text>-k </xsl:text>
|
---|
| 678 | </xsl:if>
|
---|
| 679 | <xsl:value-of select="substring-after($ns,'make ')"/>
|
---|
| 680 | </xsl:when>
|
---|
| 681 | <xsl:otherwise>
|
---|
| 682 | <xsl:copy-of select="$ns"/>
|
---|
| 683 | </xsl:otherwise>
|
---|
| 684 | </xsl:choose>
|
---|
| 685 | <xsl:if test="contains($list-stat-norm,
|
---|
| 686 | concat(' ',ancestor::sect1/@id,' '))">
|
---|
| 687 | <xsl:text> >> $TESTLOG 2>&1</xsl:text>
|
---|
[9c5ea2f] | 688 | </xsl:if>
|
---|
[e576789] | 689 | <xsl:text> || true
</xsl:text>
|
---|
| 690 | </xsl:if>
|
---|
| 691 | </xsl:template>
|
---|
| 692 |
|
---|
| 693 | <xsl:template match="userinput">
|
---|
| 694 | <xsl:apply-templates/>
|
---|
| 695 | </xsl:template>
|
---|
| 696 |
|
---|
| 697 | <xsl:template match="text()" mode="root">
|
---|
| 698 | <xsl:call-template name="output-root">
|
---|
| 699 | <xsl:with-param name="out-string" select="string()"/>
|
---|
| 700 | </xsl:call-template>
|
---|
| 701 | </xsl:template>
|
---|
| 702 |
|
---|
[945ccaa] | 703 | <xsl:variable name="APOS">'</xsl:variable>
|
---|
| 704 |
|
---|
[e576789] | 705 | <xsl:template name="output-root">
|
---|
| 706 | <xsl:param name="out-string" select="''"/>
|
---|
| 707 | <xsl:choose>
|
---|
[9c5ea2f] | 708 | <xsl:when test="contains($out-string,'make ')">
|
---|
[e576789] | 709 | <xsl:call-template name="output-root">
|
---|
| 710 | <xsl:with-param name="out-string"
|
---|
[9c5ea2f] | 711 | select="substring-before($out-string,'make ')"/>
|
---|
[e576789] | 712 | </xsl:call-template>
|
---|
[9c5ea2f] | 713 | <xsl:text>make -j1 </xsl:text>
|
---|
[e576789] | 714 | <xsl:call-template name="output-root">
|
---|
| 715 | <xsl:with-param name="out-string"
|
---|
[9c5ea2f] | 716 | select="substring-after($out-string,'make ')"/>
|
---|
[e576789] | 717 | </xsl:call-template>
|
---|
| 718 | </xsl:when>
|
---|
| 719 | <xsl:when test="contains($out-string,'$') and $sudo = 'y'">
|
---|
| 720 | <xsl:call-template name="output-root">
|
---|
| 721 | <xsl:with-param name="out-string"
|
---|
| 722 | select="substring-before($out-string,'$')"/>
|
---|
| 723 | </xsl:call-template>
|
---|
| 724 | <xsl:text>\$</xsl:text>
|
---|
| 725 | <xsl:call-template name="output-root">
|
---|
| 726 | <xsl:with-param name="out-string"
|
---|
| 727 | select="substring-after($out-string,'$')"/>
|
---|
| 728 | </xsl:call-template>
|
---|
| 729 | </xsl:when>
|
---|
| 730 | <xsl:when test="contains($out-string,'`') and $sudo = 'y'">
|
---|
| 731 | <xsl:call-template name="output-root">
|
---|
| 732 | <xsl:with-param name="out-string"
|
---|
| 733 | select="substring-before($out-string,'`')"/>
|
---|
| 734 | </xsl:call-template>
|
---|
| 735 | <xsl:text>\`</xsl:text>
|
---|
| 736 | <xsl:call-template name="output-root">
|
---|
| 737 | <xsl:with-param name="out-string"
|
---|
| 738 | select="substring-after($out-string,'`')"/>
|
---|
| 739 | </xsl:call-template>
|
---|
| 740 | </xsl:when>
|
---|
| 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>
|
---|
[945ccaa] | 752 | <xsl:when test="contains($out-string,string($APOS))
|
---|
| 753 | and $wrap-install = 'y'
|
---|
| 754 | and ancestor::sect2[@role='installation']">
|
---|
| 755 | <xsl:call-template name="output-root">
|
---|
| 756 | <xsl:with-param name="out-string"
|
---|
| 757 | select="substring-before($out-string,string($APOS))"/>
|
---|
| 758 | </xsl:call-template>
|
---|
| 759 | <xsl:text>'\''</xsl:text>
|
---|
| 760 | <xsl:call-template name="output-root">
|
---|
| 761 | <xsl:with-param name="out-string"
|
---|
| 762 | select="substring-after($out-string,string($APOS))"/>
|
---|
| 763 | </xsl:call-template>
|
---|
| 764 | </xsl:when>
|
---|
[e576789] | 765 | <xsl:otherwise>
|
---|
| 766 | <xsl:value-of select="$out-string"/>
|
---|
| 767 | </xsl:otherwise>
|
---|
| 768 | </xsl:choose>
|
---|
| 769 | </xsl:template>
|
---|
| 770 |
|
---|
| 771 | <xsl:template match="replaceable">
|
---|
[625cb14] | 772 | <xsl:choose>
|
---|
| 773 | <!-- When adding a user to a group, the book uses "username" in a replaceable
|
---|
| 774 | tag. Replace by the user name only if not running as root -->
|
---|
| 775 | <xsl:when test="contains(string(),'username') and $sudo='y'">
|
---|
| 776 | <xsl:text>$USER</xsl:text>
|
---|
| 777 | </xsl:when>
|
---|
| 778 | <!-- The next three entries are for gpm. I guess those settings are OK
|
---|
| 779 | for a laptop or desktop. -->
|
---|
| 780 | <xsl:when test="contains(string(),'yourprotocol')">
|
---|
| 781 | <xsl:text>imps2</xsl:text>
|
---|
| 782 | </xsl:when>
|
---|
| 783 | <xsl:when test="contains(string(),'yourdevice')">
|
---|
| 784 | <xsl:text>/dev/input/mice</xsl:text>
|
---|
| 785 | </xsl:when>
|
---|
| 786 | <xsl:when test="contains(string(),'additional options')"/>
|
---|
| 787 | <!-- the book has four fields for language. The language param is
|
---|
| 788 | broken into four pieces above. We use the results here. -->
|
---|
| 789 | <xsl:when test="contains(string(),'<ll>')">
|
---|
| 790 | <xsl:copy-of select="$lang-ll"/>
|
---|
| 791 | </xsl:when>
|
---|
| 792 | <xsl:when test="contains(string(),'<CC>')">
|
---|
| 793 | <xsl:copy-of select="$lang-CC"/>
|
---|
| 794 | </xsl:when>
|
---|
| 795 | <xsl:when test="contains(string(),'<charmap>')">
|
---|
| 796 | <xsl:copy-of select="$lang-charmap"/>
|
---|
| 797 | </xsl:when>
|
---|
| 798 | <xsl:when test="contains(string(),'@modifier')">
|
---|
| 799 | <xsl:copy-of select="$lang-modifier"/>
|
---|
| 800 | </xsl:when>
|
---|
| 801 | <!-- At several places, the number of jobs is given as "N" in a replaceable
|
---|
| 802 | tag. We either detect "N" alone or <N> Replace N with 4. -->
|
---|
| 803 | <xsl:when test="contains(string(),'<N>') or string()='N'">
|
---|
| 804 | <xsl:text>4</xsl:text>
|
---|
| 805 | </xsl:when>
|
---|
| 806 | <!-- Mercurial config file uses user_name. Replace only if non root.
|
---|
| 807 | Add a bogus mail field. That works for the proposed tests anyway. -->
|
---|
| 808 | <xsl:when test="contains(string(),'user_name') and $sudo='y'">
|
---|
| 809 | <xsl:text>$USER ${USER}@mail.bogus</xsl:text>
|
---|
| 810 | </xsl:when>
|
---|
| 811 | <!-- Use the config for Gtk+3 as is -->
|
---|
| 812 | <xsl:when test="ancestor::sect1[@id='gtk3']">
|
---|
| 813 | <xsl:copy-of select="string()"/>
|
---|
| 814 | </xsl:when>
|
---|
| 815 | <!-- Give 1Gb to fop. Hopefully, nobody has less RAM nowadays. -->
|
---|
| 816 | <xsl:when test="contains(string(),'RAM_Installed')">
|
---|
| 817 | <xsl:text>1024</xsl:text>
|
---|
| 818 | </xsl:when>
|
---|
| 819 | <xsl:otherwise>
|
---|
[e576789] | 820 | <xsl:text>**EDITME</xsl:text>
|
---|
| 821 | <xsl:apply-templates/>
|
---|
| 822 | <xsl:text>EDITME**</xsl:text>
|
---|
[625cb14] | 823 | </xsl:otherwise>
|
---|
| 824 | </xsl:choose>
|
---|
[e576789] | 825 | </xsl:template>
|
---|
| 826 |
|
---|
| 827 | <xsl:template match="replaceable" mode="root">
|
---|
[625cb14] | 828 | <xsl:apply-templates select="."/>
|
---|
[e576789] | 829 | </xsl:template>
|
---|
| 830 |
|
---|
[67c3df4] | 831 | <xsl:template name="output-destdir">
|
---|
| 832 | <!-- Hopefully, the current node is the first screen with role equal to root.
|
---|
| 833 | We first output stats, since we are only called if stats are needed.
|
---|
| 834 | then we output DESTDIR instructions,etc -->
|
---|
| 835 | <xsl:text>
|
---|
| 836 | echo Time after tests: ${SECONDS} >> $INFOLOG
|
---|
| 837 | echo Size after tests: $(sudo du -skx --exclude home /) >> $INFOLOG
|
---|
| 838 | echo Time before install: ${SECONDS} >> $INFOLOG
|
---|
| 839 | </xsl:text>
|
---|
| 840 | <xsl:apply-templates
|
---|
| 841 | select="userinput|following-sibling::screen[@role='root']/userinput"
|
---|
| 842 | mode="destdir"/>
|
---|
| 843 | <xsl:text>
|
---|
| 844 | echo Time after install: ${SECONDS} >> $INFOLOG
|
---|
| 845 | echo Size after install: $(sudo du -skx --exclude home /) >> $INFOLOG
|
---|
| 846 | </xsl:text>
|
---|
| 847 | </xsl:template>
|
---|
| 848 |
|
---|
| 849 | <xsl:template match="userinput" mode="destdir">
|
---|
| 850 | <xsl:choose>
|
---|
| 851 | <xsl:when test="./literal">
|
---|
| 852 | <xsl:call-template name="outputpkgdest">
|
---|
| 853 | <xsl:with-param name="outputstring" select="text()[1]"/>
|
---|
| 854 | </xsl:call-template>
|
---|
| 855 | <xsl:apply-templates select="literal"/>
|
---|
| 856 | <xsl:call-template name="outputpkgdest">
|
---|
| 857 | <xsl:with-param name="outputstring" select="text()[2]"/>
|
---|
| 858 | </xsl:call-template>
|
---|
| 859 | </xsl:when>
|
---|
| 860 | <xsl:otherwise>
|
---|
| 861 | <xsl:call-template name="outputpkgdest">
|
---|
| 862 | <xsl:with-param name="outputstring" select="string()"/>
|
---|
| 863 | </xsl:call-template>
|
---|
| 864 | </xsl:otherwise>
|
---|
| 865 | </xsl:choose>
|
---|
| 866 | <xsl:text>
</xsl:text>
|
---|
| 867 | </xsl:template>
|
---|
| 868 |
|
---|
| 869 | <xsl:template name="outputpkgdest">
|
---|
| 870 | <xsl:param name="outputstring" select="'foo'"/>
|
---|
| 871 | <xsl:choose>
|
---|
| 872 | <xsl:when test="contains($outputstring,'make ')">
|
---|
| 873 | <xsl:choose>
|
---|
| 874 | <xsl:when test="not(starts-with($outputstring,'make'))">
|
---|
| 875 | <xsl:call-template name="outputpkgdest">
|
---|
| 876 | <xsl:with-param name="outputstring"
|
---|
| 877 | select="substring-before($outputstring,'make')"/>
|
---|
| 878 | </xsl:call-template>
|
---|
| 879 | <xsl:call-template name="outputpkgdest">
|
---|
| 880 | <xsl:with-param
|
---|
| 881 | name="outputstring"
|
---|
| 882 | select="substring-after($outputstring,
|
---|
| 883 | substring-before($outputstring,'make'))"/>
|
---|
| 884 | </xsl:call-template>
|
---|
| 885 | </xsl:when>
|
---|
| 886 | <xsl:otherwise>
|
---|
| 887 | <xsl:text>make DESTDIR=$PKG_DEST</xsl:text>
|
---|
| 888 | <xsl:call-template name="outputpkgdest">
|
---|
| 889 | <xsl:with-param
|
---|
| 890 | name="outputstring"
|
---|
| 891 | select="substring-after($outputstring,'make')"/>
|
---|
| 892 | </xsl:call-template>
|
---|
| 893 | </xsl:otherwise>
|
---|
| 894 | </xsl:choose>
|
---|
| 895 | </xsl:when>
|
---|
| 896 | <xsl:when test="contains($outputstring,'ninja install')">
|
---|
| 897 | <xsl:choose>
|
---|
| 898 | <xsl:when test="not(starts-with($outputstring,'ninja install'))">
|
---|
| 899 | <xsl:call-template name="outputpkgdest">
|
---|
| 900 | <xsl:with-param name="outputstring"
|
---|
| 901 | select="substring-before($outputstring,'ninja install')"/>
|
---|
| 902 | </xsl:call-template>
|
---|
| 903 | <xsl:call-template name="outputpkgdest">
|
---|
| 904 | <xsl:with-param
|
---|
| 905 | name="outputstring"
|
---|
| 906 | select="substring-after($outputstring,
|
---|
| 907 | substring-before($outputstring,'ninja install'))"/>
|
---|
| 908 | </xsl:call-template>
|
---|
| 909 | </xsl:when>
|
---|
| 910 | <xsl:otherwise>
|
---|
| 911 | <xsl:text>DESTDIR=$PKG_DEST ninja</xsl:text>
|
---|
| 912 | <xsl:call-template name="outputpkgdest">
|
---|
| 913 | <xsl:with-param
|
---|
| 914 | name="outputstring"
|
---|
| 915 | select="substring-after($outputstring,'ninja')"/>
|
---|
| 916 | </xsl:call-template>
|
---|
| 917 | </xsl:otherwise>
|
---|
| 918 | </xsl:choose>
|
---|
| 919 | </xsl:when>
|
---|
| 920 | <xsl:otherwise> <!-- no make nor ninja in this string -->
|
---|
| 921 | <xsl:choose>
|
---|
| 922 | <xsl:when test="contains($outputstring,'>/') and
|
---|
| 923 | not(contains(substring-before($outputstring,'>/'),' /'))">
|
---|
| 924 | <xsl:value-of select="substring-before($outputstring,'>/')"/>
|
---|
| 925 | <xsl:text>>$PKG_DEST/</xsl:text>
|
---|
| 926 | <xsl:call-template name="outputpkgdest">
|
---|
| 927 | <xsl:with-param name="outputstring" select="substring-after($outputstring,'>/')"/>
|
---|
| 928 | </xsl:call-template>
|
---|
| 929 | </xsl:when>
|
---|
| 930 | <xsl:when test="contains($outputstring,' /')">
|
---|
| 931 | <xsl:value-of select="substring-before($outputstring,' /')"/>
|
---|
| 932 | <xsl:text> $PKG_DEST/</xsl:text>
|
---|
| 933 | <xsl:call-template name="outputpkgdest">
|
---|
| 934 | <xsl:with-param name="outputstring" select="substring-after($outputstring,' /')"/>
|
---|
| 935 | </xsl:call-template>
|
---|
| 936 | </xsl:when>
|
---|
| 937 | <xsl:otherwise>
|
---|
| 938 | <xsl:value-of select="$outputstring"/>
|
---|
| 939 | </xsl:otherwise>
|
---|
| 940 | </xsl:choose>
|
---|
| 941 | </xsl:otherwise>
|
---|
| 942 | </xsl:choose>
|
---|
| 943 | </xsl:template>
|
---|
| 944 |
|
---|
[e576789] | 945 | </xsl:stylesheet>
|
---|