[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 |
|
---|
| 8 | <!-- XSLT stylesheet to create shell scripts from "linear build" BLFS books. -->
|
---|
| 9 |
|
---|
[c048987] | 10 | <!-- parameters and global variables -->
|
---|
| 11 | <!-- Check whether the book is sysv or systemd -->
|
---|
[70d73d1] | 12 | <xsl:variable name="rev">
|
---|
| 13 | <xsl:choose>
|
---|
| 14 | <xsl:when test="//bookinfo/title/phrase[@revision='systemd']">
|
---|
| 15 | systemd
|
---|
| 16 | </xsl:when>
|
---|
| 17 | <xsl:otherwise>
|
---|
| 18 | sysv
|
---|
| 19 | </xsl:otherwise>
|
---|
| 20 | </xsl:choose>
|
---|
| 21 | </xsl:variable>
|
---|
| 22 |
|
---|
[945ccaa] | 23 | <!-- Wrap "root" commands inside a wrapper function, allowing
|
---|
| 24 | "porg style" package management -->
|
---|
| 25 | <xsl:param name="wrap-install" select="'n'"/>
|
---|
[9daa202] | 26 | <xsl:param name="pack-install" select="'$HOME/blfs_root/packInstall.sh'"/>
|
---|
[945ccaa] | 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 |
|
---|
[9daa202] | 37 | <!-- Root of sources directory -->
|
---|
| 38 | <xsl:param name="src-archive" select="'/sources'"/>
|
---|
| 39 |
|
---|
| 40 | <!-- Download and archive tarballs to subdirs. Can be 'y' or '',
|
---|
| 41 | not 'n' -->
|
---|
| 42 | <xsl:param name="src-subdirs" select="''"/>
|
---|
| 43 |
|
---|
| 44 | <!-- Root of build directory -->
|
---|
| 45 | <xsl:param name="build-root" select="'/sources'"/>
|
---|
| 46 |
|
---|
| 47 | <!-- extract sources and build into subdirs. Can be 'y' or '',
|
---|
| 48 | not 'n' -->
|
---|
| 49 | <xsl:param name="build-subdirs" select="''"/>
|
---|
| 50 |
|
---|
| 51 | <!-- Keep files in the build directory after building. Can be 'y' or '',
|
---|
| 52 | not 'n' -->
|
---|
| 53 | <xsl:param name="keep-files" select="''"/>
|
---|
| 54 |
|
---|
| 55 | <!-- Number of parallel jobs; type integer, not string -->
|
---|
| 56 | <xsl:param name="jobs" select="0"/>
|
---|
[dc7fd7b] | 57 | <!-- simple instructions for removing .la files. -->
|
---|
[619b313] | 58 | <!-- We'll use the rule that any text output begins with a linefeed if needed
|
---|
| 59 | so that we do not need to output one at the end-->
|
---|
[dc7fd7b] | 60 | <xsl:variable name="la-files-instr">
|
---|
| 61 |
|
---|
| 62 | for libdir in /lib /usr/lib $(find /opt -name lib); do
|
---|
[2969cdf] | 63 | find $libdir -name \*.la \
|
---|
| 64 | ! -path \*ImageMagick\* \
|
---|
| 65 | -delete
|
---|
[619b313] | 66 | done</xsl:variable>
|
---|
[67c3df4] | 67 |
|
---|
[c048987] | 68 | <xsl:variable name="list-stat-norm"
|
---|
| 69 | select="concat(' ', normalize-space($list-stat),' ')"/>
|
---|
| 70 |
|
---|
| 71 | <!-- To be able to use the single quote in tests -->
|
---|
| 72 | <xsl:variable name="APOS">'</xsl:variable>
|
---|
| 73 |
|
---|
| 74 | <!-- end parameters and global variables -->
|
---|
| 75 |
|
---|
[7933ed7] | 76 | <!-- include the template for processing screen children of
|
---|
| 77 | role="install" sect2 -->
|
---|
| 78 | <xsl:include href="process-install.xsl"/>
|
---|
[c048987] | 79 |
|
---|
[96d7e44] | 80 | <!-- include the template for replaceable tags -->
|
---|
| 81 | <xsl:include href="process-replaceable.xsl"/>
|
---|
| 82 |
|
---|
[c048987] | 83 | <!--=================== Begin processing ========================-->
|
---|
[67c3df4] | 84 |
|
---|
[e576789] | 85 | <xsl:template match="/">
|
---|
[c048987] | 86 | <xsl:apply-templates select="//sect1[@id != 'bootscripts' and
|
---|
| 87 | @id != 'systemd-units']"/>
|
---|
[e576789] | 88 | </xsl:template>
|
---|
| 89 |
|
---|
| 90 | <!--=================== Master chunks code ======================-->
|
---|
| 91 |
|
---|
| 92 | <xsl:template match="sect1">
|
---|
| 93 |
|
---|
[619b313] | 94 | <!-- Are stat requested for this page? -->
|
---|
| 95 | <xsl:variable name="want-stats"
|
---|
| 96 | select="contains($list-stat-norm,
|
---|
| 97 | concat(' ',@id,' '))"/>
|
---|
| 98 |
|
---|
[c048987] | 99 | <!-- The file names -->
|
---|
| 100 | <xsl:variable name="filename" select="@id"/>
|
---|
[e576789] | 101 |
|
---|
[c048987] | 102 | <!-- The build order -->
|
---|
| 103 | <xsl:variable name="position" select="position()"/>
|
---|
| 104 | <xsl:variable name="order">
|
---|
| 105 | <xsl:choose>
|
---|
| 106 | <xsl:when test="string-length($position) = 1">
|
---|
| 107 | <xsl:text>00</xsl:text>
|
---|
| 108 | <xsl:value-of select="$position"/>
|
---|
| 109 | </xsl:when>
|
---|
| 110 | <xsl:when test="string-length($position) = 2">
|
---|
| 111 | <xsl:text>0</xsl:text>
|
---|
| 112 | <xsl:value-of select="$position"/>
|
---|
| 113 | </xsl:when>
|
---|
| 114 | <xsl:otherwise>
|
---|
| 115 | <xsl:value-of select="$position"/>
|
---|
| 116 | </xsl:otherwise>
|
---|
| 117 | </xsl:choose>
|
---|
| 118 | </xsl:variable>
|
---|
[e576789] | 119 |
|
---|
| 120 | <!-- Depuration code -->
|
---|
[c048987] | 121 | <xsl:message>
|
---|
| 122 | <xsl:text>SCRIPT is </xsl:text>
|
---|
| 123 | <xsl:value-of select="concat($order,'-z-',$filename)"/>
|
---|
| 124 | <xsl:text>
 FTPDIR is </xsl:text>
|
---|
| 125 | <xsl:value-of select="$filename"/>
|
---|
| 126 | <xsl:text>

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