[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 |
|
---|
[dc7fd7b] | 28 | <!-- Remove libtool .la files -->
|
---|
| 29 | <xsl:param name="del-la-files" select="'y'"/>
|
---|
| 30 |
|
---|
[e576789] | 31 | <!-- Build as user (y) or as root (n)? -->
|
---|
| 32 | <xsl:param name="sudo" select="'y'"/>
|
---|
| 33 |
|
---|
[dc7fd7b] | 34 | <!-- simple instructions for removing .la files. -->
|
---|
| 35 | <xsl:variable name="la-files-instr">
|
---|
| 36 |
|
---|
| 37 | for libdir in /lib /usr/lib $(find /opt -name lib); do
|
---|
| 38 | find $libdir -name \*.la ! -path \*ImageMagick\* -delete
|
---|
| 39 | done
|
---|
| 40 |
|
---|
| 41 | </xsl:variable>
|
---|
[e576789] | 42 | <xsl:template match="/">
|
---|
| 43 | <xsl:apply-templates select="//sect1"/>
|
---|
| 44 | </xsl:template>
|
---|
| 45 |
|
---|
| 46 | <!--=================== Master chunks code ======================-->
|
---|
| 47 |
|
---|
| 48 | <xsl:template match="sect1">
|
---|
| 49 |
|
---|
[70d73d1] | 50 | <xsl:if test="@id != 'bootscripts' and @id != 'systemd-units'">
|
---|
[e576789] | 51 | <!-- The file names -->
|
---|
| 52 | <xsl:variable name="filename" select="@id"/>
|
---|
| 53 |
|
---|
| 54 | <!-- The build order -->
|
---|
| 55 | <xsl:variable name="position" select="position()"/>
|
---|
| 56 | <xsl:variable name="order">
|
---|
| 57 | <xsl:choose>
|
---|
| 58 | <xsl:when test="string-length($position) = 1">
|
---|
| 59 | <xsl:text>00</xsl:text>
|
---|
| 60 | <xsl:value-of select="$position"/>
|
---|
| 61 | </xsl:when>
|
---|
| 62 | <xsl:when test="string-length($position) = 2">
|
---|
| 63 | <xsl:text>0</xsl:text>
|
---|
| 64 | <xsl:value-of select="$position"/>
|
---|
| 65 | </xsl:when>
|
---|
| 66 | <xsl:otherwise>
|
---|
| 67 | <xsl:value-of select="$position"/>
|
---|
| 68 | </xsl:otherwise>
|
---|
| 69 | </xsl:choose>
|
---|
| 70 | </xsl:variable>
|
---|
| 71 |
|
---|
| 72 | <!-- Depuration code -->
|
---|
| 73 | <xsl:message>
|
---|
| 74 | <xsl:text>SCRIPT is </xsl:text>
|
---|
| 75 | <xsl:value-of select="concat($order,'-z-',$filename)"/>
|
---|
| 76 | <xsl:text>
 FTPDIR is </xsl:text>
|
---|
| 77 | <xsl:value-of select="$filename"/>
|
---|
| 78 | <xsl:text>

</xsl:text>
|
---|
| 79 | </xsl:message>
|
---|
| 80 |
|
---|
| 81 | <!-- Creating the scripts -->
|
---|
| 82 | <exsl:document href="{$order}-z-{$filename}" method="text">
|
---|
| 83 | <xsl:text>#!/bin/bash
set -e

</xsl:text>
|
---|
| 84 | <xsl:choose>
|
---|
| 85 | <!-- Package page -->
|
---|
[642722f] | 86 | <xsl:when test="sect2[@role='package']">
|
---|
[945ccaa] | 87 | <!-- We build in a subdirectory, whose name may be needed
|
---|
| 88 | if using package management (see envars.conf), so
|
---|
| 89 | "export" it -->
|
---|
[1fa0dee] | 90 | <xsl:text>export JH_PKG_DIR=</xsl:text>
|
---|
[e576789] | 91 | <xsl:value-of select="$filename"/>
|
---|
[39dc04a] | 92 | <xsl:text>
|
---|
[1fa0dee] | 93 | SRC_DIR=${JH_SRC_ARCHIVE}${JH_SRC_SUBDIRS:+/${JH_PKG_DIR}}
|
---|
| 94 | BUILD_DIR=${JH_BUILD_ROOT}${JH_BUILD_SUBDIRS:+/${JH_PKG_DIR}}
|
---|
[39dc04a] | 95 | mkdir -p $SRC_DIR
|
---|
| 96 | mkdir -p $BUILD_DIR
|
---|
| 97 |
|
---|
| 98 | </xsl:text>
|
---|
[e576789] | 99 | <!-- Download code and build commands -->
|
---|
| 100 | <xsl:apply-templates select="sect2"/>
|
---|
| 101 | <!-- Clean-up -->
|
---|
[39dc04a] | 102 | <xsl:text>cd $BUILD_DIR
|
---|
[1fa0dee] | 103 | [[ -n "$JH_KEEP_FILES" ]] || </xsl:text>
|
---|
[e576789] | 104 | <!-- In some case, some files in the build tree are owned
|
---|
| 105 | by root -->
|
---|
[642722f] | 106 | <xsl:if test="$sudo='y'">
|
---|
| 107 | <xsl:text>sudo </xsl:text>
|
---|
[e576789] | 108 | </xsl:if>
|
---|
[1fa0dee] | 109 | <xsl:text>rm -rf $JH_UNPACKDIR unpacked

</xsl:text>
|
---|
[e576789] | 110 | </xsl:when>
|
---|
| 111 | <!-- Non-package page -->
|
---|
| 112 | <xsl:otherwise>
|
---|
| 113 | <xsl:apply-templates select=".//screen"/>
|
---|
| 114 | </xsl:otherwise>
|
---|
| 115 | </xsl:choose>
|
---|
| 116 | <xsl:text>exit</xsl:text>
|
---|
| 117 | </exsl:document>
|
---|
| 118 | </xsl:if>
|
---|
| 119 | </xsl:template>
|
---|
| 120 |
|
---|
| 121 | <!--======================= Sub-sections code =======================-->
|
---|
| 122 |
|
---|
| 123 | <xsl:template match="sect2">
|
---|
| 124 | <xsl:choose>
|
---|
| 125 | <xsl:when test="@role = 'package'">
|
---|
[39dc04a] | 126 | <xsl:text>cd $SRC_DIR
|
---|
| 127 | </xsl:text>
|
---|
[642722f] | 128 | <!-- Download information is in bridgehead tags -->
|
---|
[e576789] | 129 | <xsl:apply-templates select="bridgehead[@renderas='sect3']"/>
|
---|
| 130 | <xsl:text>
</xsl:text>
|
---|
| 131 | </xsl:when>
|
---|
[967b819] | 132 | <xsl:when test="@role = 'qt4-prefix' or @role = 'qt5-prefix'">
|
---|
| 133 | <xsl:apply-templates select=".//screen"/>
|
---|
| 134 | </xsl:when>
|
---|
[e576789] | 135 | <xsl:when test="@role = 'installation'">
|
---|
| 136 | <xsl:text>
|
---|
[39dc04a] | 137 | cd $BUILD_DIR
|
---|
[07f7eff] | 138 | find . -maxdepth 1 -mindepth 1 -type d | xargs </xsl:text>
|
---|
| 139 | <xsl:if test="$sudo='y'">
|
---|
| 140 | <xsl:text>sudo </xsl:text>
|
---|
| 141 | </xsl:if>
|
---|
| 142 | <xsl:text>rm -rf
|
---|
[67992a0] | 143 | case $PACKAGE in
|
---|
[e6967a1] | 144 | *.tar.gz|*.tar.bz2|*.tar.xz|*.tgz|*.tar.lzma)
|
---|
[39dc04a] | 145 | tar -xvf $SRC_DIR/$PACKAGE > unpacked
|
---|
[1fa0dee] | 146 | JH_UNPACKDIR=`grep '[^./]\+' unpacked | head -n1 | sed 's@^\./@@;s@/.*@@'`
|
---|
[6eaae5e] | 147 | ;;
|
---|
| 148 | *.tar.lz)
|
---|
[39dc04a] | 149 | bsdtar -xvf $SRC_DIR/$PACKAGE 2> unpacked
|
---|
[1fa0dee] | 150 | JH_UNPACKDIR=`head -n1 unpacked | cut -d" " -f2 | sed 's@^\./@@;s@/.*@@'`
|
---|
[67992a0] | 151 | ;;
|
---|
| 152 | *.zip)
|
---|
[39dc04a] | 153 | zipinfo -1 $SRC_DIR/$PACKAGE > unpacked
|
---|
[1fa0dee] | 154 | JH_UNPACKDIR="$(sed 's@/.*@@' unpacked | uniq )"
|
---|
| 155 | if test $(wc -w <<< $JH_UNPACKDIR) -eq 1; then
|
---|
[39dc04a] | 156 | unzip $SRC_DIR/$PACKAGE
|
---|
[67992a0] | 157 | else
|
---|
[1fa0dee] | 158 | JH_UNPACKDIR=${PACKAGE%.zip}
|
---|
| 159 | unzip -d $JH_UNPACKDIR $SRC_DIR/$PACKAGE
|
---|
[67992a0] | 160 | fi
|
---|
| 161 | ;;
|
---|
| 162 | *)
|
---|
[1fa0dee] | 163 | JH_UNPACKDIR=$JH_PKG_DIR-build
|
---|
| 164 | mkdir $JH_UNPACKDIR
|
---|
| 165 | cp $SRC_DIR/$PACKAGE $JH_UNPACKDIR
|
---|
| 166 | cp $(find . -mindepth 1 -maxdepth 1 -type l) $JH_UNPACKDIR
|
---|
[67992a0] | 167 | ;;
|
---|
| 168 | esac
|
---|
[1fa0dee] | 169 | export JH_UNPACKDIR
|
---|
| 170 | cd $JH_UNPACKDIR

|
---|
[67992a0] | 171 | </xsl:text>
|
---|
[e576789] | 172 | <xsl:apply-templates select=".//screen | .//para/command"/>
|
---|
| 173 | <xsl:if test="$sudo = 'y'">
|
---|
| 174 | <xsl:text>sudo /sbin/</xsl:text>
|
---|
| 175 | </xsl:if>
|
---|
| 176 | <xsl:text>ldconfig

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