2013-10-29 16:42:03 +01:00
|
|
|
|
<?xml version="1.0"?>
|
|
|
|
|
|
|
|
|
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
|
|
|
xmlns:exsl="http://exslt.org/common"
|
|
|
|
|
extension-element-prefixes="exsl"
|
|
|
|
|
version="1.0">
|
|
|
|
|
|
2017-03-12 14:20:02 +01:00
|
|
|
|
<!-- $Id$ -->
|
2013-10-29 16:42:03 +01:00
|
|
|
|
|
|
|
|
|
<!-- XSLT stylesheet to create shell scripts from "linear build" BLFS books. -->
|
|
|
|
|
|
2017-03-01 16:54:16 +01:00
|
|
|
|
<!-- Check whether the book is sysv or systemd -->
|
|
|
|
|
<xsl:variable name="rev">
|
|
|
|
|
<xsl:choose>
|
|
|
|
|
<xsl:when test="//bookinfo/title/phrase[@revision='systemd']">
|
|
|
|
|
systemd
|
|
|
|
|
</xsl:when>
|
|
|
|
|
<xsl:otherwise>
|
|
|
|
|
sysv
|
|
|
|
|
</xsl:otherwise>
|
|
|
|
|
</xsl:choose>
|
|
|
|
|
</xsl:variable>
|
|
|
|
|
|
2017-04-09 12:29:32 +02:00
|
|
|
|
<!-- Wrap "root" commands inside a wrapper function, allowing
|
|
|
|
|
"porg style" package management -->
|
|
|
|
|
<xsl:param name="wrap-install" select="'n'"/>
|
|
|
|
|
|
2013-10-29 16:42:03 +01:00
|
|
|
|
<!-- Build as user (y) or as root (n)? -->
|
|
|
|
|
<xsl:param name="sudo" select="'y'"/>
|
|
|
|
|
|
|
|
|
|
<xsl:template match="/">
|
|
|
|
|
<xsl:apply-templates select="//sect1"/>
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
|
|
<!--=================== Master chunks code ======================-->
|
|
|
|
|
|
|
|
|
|
<xsl:template match="sect1">
|
|
|
|
|
|
2017-03-01 16:54:16 +01:00
|
|
|
|
<xsl:if test="@id != 'bootscripts' and @id != 'systemd-units'">
|
2013-10-29 16:42:03 +01:00
|
|
|
|
<!-- The file names -->
|
|
|
|
|
<xsl:variable name="filename" select="@id"/>
|
|
|
|
|
|
|
|
|
|
<!-- The build order -->
|
|
|
|
|
<xsl:variable name="position" select="position()"/>
|
|
|
|
|
<xsl:variable name="order">
|
|
|
|
|
<xsl:choose>
|
|
|
|
|
<xsl:when test="string-length($position) = 1">
|
|
|
|
|
<xsl:text>00</xsl:text>
|
|
|
|
|
<xsl:value-of select="$position"/>
|
|
|
|
|
</xsl:when>
|
|
|
|
|
<xsl:when test="string-length($position) = 2">
|
|
|
|
|
<xsl:text>0</xsl:text>
|
|
|
|
|
<xsl:value-of select="$position"/>
|
|
|
|
|
</xsl:when>
|
|
|
|
|
<xsl:otherwise>
|
|
|
|
|
<xsl:value-of select="$position"/>
|
|
|
|
|
</xsl:otherwise>
|
|
|
|
|
</xsl:choose>
|
|
|
|
|
</xsl:variable>
|
|
|
|
|
|
|
|
|
|
<!-- Depuration code -->
|
|
|
|
|
<xsl:message>
|
|
|
|
|
<xsl:text>SCRIPT is </xsl:text>
|
|
|
|
|
<xsl:value-of select="concat($order,'-z-',$filename)"/>
|
|
|
|
|
<xsl:text>
 FTPDIR is </xsl:text>
|
|
|
|
|
<xsl:value-of select="$filename"/>
|
|
|
|
|
<xsl:text>

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

</xsl:text>
|
|
|
|
|
<xsl:choose>
|
|
|
|
|
<!-- Package page -->
|
2014-03-26 09:47:59 +01:00
|
|
|
|
<xsl:when test="sect2[@role='package']">
|
2017-04-09 12:29:32 +02:00
|
|
|
|
<!-- We build in a subdirectory, whose name may be needed
|
|
|
|
|
if using package management (see envars.conf), so
|
|
|
|
|
"export" it -->
|
|
|
|
|
<xsl:text>export PKG_DIR=</xsl:text>
|
2013-10-29 16:42:03 +01:00
|
|
|
|
<xsl:value-of select="$filename"/>
|
2017-03-15 22:06:17 +01:00
|
|
|
|
<xsl:text>
|
|
|
|
|
SRC_DIR=${SRC_ARCHIVE}${SRC_SUBDIRS:+/${PKG_DIR}}
|
|
|
|
|
BUILD_DIR=${BUILD_ROOT}${BUILD_SUBDIRS:+/${PKG_DIR}}
|
|
|
|
|
mkdir -p $SRC_DIR
|
|
|
|
|
mkdir -p $BUILD_DIR
|
|
|
|
|
|
|
|
|
|
</xsl:text>
|
2013-10-29 16:42:03 +01:00
|
|
|
|
<!-- Download code and build commands -->
|
|
|
|
|
<xsl:apply-templates select="sect2"/>
|
|
|
|
|
<!-- Clean-up -->
|
2017-03-15 22:06:17 +01:00
|
|
|
|
<xsl:text>cd $BUILD_DIR
|
|
|
|
|
[[ -n "$KEEP_FILES" ]] || </xsl:text>
|
2013-10-29 16:42:03 +01:00
|
|
|
|
<!-- In some case, some files in the build tree are owned
|
|
|
|
|
by root -->
|
2014-03-26 09:47:59 +01:00
|
|
|
|
<xsl:if test="$sudo='y'">
|
|
|
|
|
<xsl:text>sudo </xsl:text>
|
2013-10-29 16:42:03 +01:00
|
|
|
|
</xsl:if>
|
2014-03-26 09:47:59 +01:00
|
|
|
|
<xsl:text>rm -rf $UNPACKDIR unpacked

</xsl:text>
|
2013-10-29 16:42:03 +01:00
|
|
|
|
</xsl:when>
|
|
|
|
|
<!-- Non-package page -->
|
|
|
|
|
<xsl:otherwise>
|
|
|
|
|
<xsl:apply-templates select=".//screen"/>
|
|
|
|
|
</xsl:otherwise>
|
|
|
|
|
</xsl:choose>
|
|
|
|
|
<xsl:text>exit</xsl:text>
|
|
|
|
|
</exsl:document>
|
|
|
|
|
</xsl:if>
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
|
|
<!--======================= Sub-sections code =======================-->
|
|
|
|
|
|
|
|
|
|
<xsl:template match="sect2">
|
|
|
|
|
<xsl:choose>
|
|
|
|
|
<xsl:when test="@role = 'package'">
|
2017-03-15 22:06:17 +01:00
|
|
|
|
<xsl:text>cd $SRC_DIR
|
|
|
|
|
</xsl:text>
|
2014-03-26 09:47:59 +01:00
|
|
|
|
<!-- Download information is in bridgehead tags -->
|
2013-10-29 16:42:03 +01:00
|
|
|
|
<xsl:apply-templates select="bridgehead[@renderas='sect3']"/>
|
|
|
|
|
<xsl:text>
</xsl:text>
|
|
|
|
|
</xsl:when>
|
2015-09-20 12:18:20 +02:00
|
|
|
|
<xsl:when test="@role = 'qt4-prefix' or @role = 'qt5-prefix'">
|
|
|
|
|
<xsl:apply-templates select=".//screen"/>
|
|
|
|
|
</xsl:when>
|
2013-10-29 16:42:03 +01:00
|
|
|
|
<xsl:when test="@role = 'installation'">
|
|
|
|
|
<xsl:text>
|
2017-03-15 22:06:17 +01:00
|
|
|
|
cd $BUILD_DIR
|
2015-11-30 22:29:12 +01:00
|
|
|
|
find . -maxdepth 1 -mindepth 1 -type d | xargs </xsl:text>
|
|
|
|
|
<xsl:if test="$sudo='y'">
|
|
|
|
|
<xsl:text>sudo </xsl:text>
|
|
|
|
|
</xsl:if>
|
|
|
|
|
<xsl:text>rm -rf
|
2015-11-20 18:19:08 +01:00
|
|
|
|
case $PACKAGE in
|
2016-01-30 09:33:14 +01:00
|
|
|
|
*.tar.gz|*.tar.bz2|*.tar.xz|*.tgz|*.tar.lzma)
|
2017-03-15 22:06:17 +01:00
|
|
|
|
tar -xvf $SRC_DIR/$PACKAGE > unpacked
|
2017-02-28 13:46:52 +01:00
|
|
|
|
UNPACKDIR=`grep '[^./]\+' unpacked | head -n1 | sed 's@^\./@@;s@/.*@@'`
|
|
|
|
|
;;
|
|
|
|
|
*.tar.lz)
|
2017-03-15 22:06:17 +01:00
|
|
|
|
bsdtar -xvf $SRC_DIR/$PACKAGE 2> unpacked
|
2017-02-28 13:46:52 +01:00
|
|
|
|
UNPACKDIR=`head -n1 unpacked | cut -d" " -f2 | sed 's@^\./@@;s@/.*@@'`
|
2015-11-20 18:19:08 +01:00
|
|
|
|
;;
|
|
|
|
|
*.zip)
|
2017-03-15 22:06:17 +01:00
|
|
|
|
zipinfo -1 $SRC_DIR/$PACKAGE > unpacked
|
2015-11-20 18:19:08 +01:00
|
|
|
|
UNPACKDIR="$(sed 's@/.*@@' unpacked | uniq )"
|
|
|
|
|
if test $(wc -w <<< $UNPACKDIR) -eq 1; then
|
2017-03-15 22:06:17 +01:00
|
|
|
|
unzip $SRC_DIR/$PACKAGE
|
2015-11-20 18:19:08 +01:00
|
|
|
|
else
|
|
|
|
|
UNPACKDIR=${PACKAGE%.zip}
|
2017-03-15 22:06:17 +01:00
|
|
|
|
unzip -d $UNPACKDIR $SRC_DIR/$PACKAGE
|
2015-11-20 18:19:08 +01:00
|
|
|
|
fi
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
UNPACKDIR=$PKG_DIR-build
|
|
|
|
|
mkdir $UNPACKDIR
|
2017-03-19 17:17:18 +01:00
|
|
|
|
cp $SRC_DIR/$PACKAGE $UNPACKDIR
|
|
|
|
|
cp $(find . -mindepth 1 -maxdepth 1 -type l) $UNPACKDIR
|
2015-11-20 18:19:08 +01:00
|
|
|
|
;;
|
|
|
|
|
esac
|
2017-04-09 12:29:32 +02:00
|
|
|
|
export UNPACKDIR
|
2015-11-20 18:19:08 +01:00
|
|
|
|
cd $UNPACKDIR

|
|
|
|
|
</xsl:text>
|
2013-10-29 16:42:03 +01:00
|
|
|
|
<xsl:apply-templates select=".//screen | .//para/command"/>
|
|
|
|
|
<xsl:if test="$sudo = 'y'">
|
|
|
|
|
<xsl:text>sudo /sbin/</xsl:text>
|
|
|
|
|
</xsl:if>
|
|
|
|
|
<xsl:text>ldconfig

</xsl:text>
|
|
|
|
|
</xsl:when>
|
|
|
|
|
<xsl:when test="@role = 'configuration'">
|
|
|
|
|
<xsl:apply-templates select=".//screen" mode="config"/>
|
|
|
|
|
</xsl:when>
|
|
|
|
|
</xsl:choose>
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
|
|
<!--==================== Download code =======================-->
|
|
|
|
|
|
2014-03-26 09:47:59 +01:00
|
|
|
|
<!-- template for extracting the filename from an url in the form:
|
|
|
|
|
proto://internet.name/dir1/.../dirn/filename?condition.
|
|
|
|
|
Needed, because substring-after(...,'/') returns only the
|
|
|
|
|
substring after the first '/'. -->
|
2013-10-29 16:42:03 +01:00
|
|
|
|
<xsl:template name="package_name">
|
|
|
|
|
<xsl:param name="url" select="foo"/>
|
|
|
|
|
<xsl:param name="sub-url" select="substring-after($url,'/')"/>
|
|
|
|
|
<xsl:choose>
|
|
|
|
|
<xsl:when test="contains($sub-url,'/')">
|
|
|
|
|
<xsl:call-template name="package_name">
|
|
|
|
|
<xsl:with-param name="url" select="$sub-url"/>
|
|
|
|
|
</xsl:call-template>
|
|
|
|
|
</xsl:when>
|
|
|
|
|
<xsl:otherwise>
|
|
|
|
|
<xsl:choose>
|
|
|
|
|
<xsl:when test="contains($sub-url,'?')">
|
|
|
|
|
<xsl:value-of select="substring-before($sub-url,'?')"/>
|
|
|
|
|
</xsl:when>
|
|
|
|
|
<xsl:otherwise>
|
|
|
|
|
<xsl:value-of select="$sub-url"/>
|
|
|
|
|
</xsl:otherwise>
|
|
|
|
|
</xsl:choose>
|
|
|
|
|
</xsl:otherwise>
|
|
|
|
|
</xsl:choose>
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
2014-03-26 09:47:59 +01:00
|
|
|
|
<!-- Generates the code to download a package, an additional package or
|
|
|
|
|
a patch. -->
|
|
|
|
|
<xsl:template name="download-file">
|
|
|
|
|
<xsl:param name="httpurl" select="''"/>
|
|
|
|
|
<xsl:param name="ftpurl" select="''"/>
|
|
|
|
|
<xsl:param name="md5" select="''"/>
|
|
|
|
|
<xsl:param name="varname" select="''"/>
|
|
|
|
|
<xsl:variable name="package">
|
|
|
|
|
<xsl:call-template name="package_name">
|
|
|
|
|
<xsl:with-param name="url">
|
2013-10-29 16:42:03 +01:00
|
|
|
|
<xsl:choose>
|
2014-03-26 09:47:59 +01:00
|
|
|
|
<xsl:when test="string-length($httpurl) > 10">
|
|
|
|
|
<xsl:value-of select="$httpurl"/>
|
2013-10-29 16:42:03 +01:00
|
|
|
|
</xsl:when>
|
|
|
|
|
<xsl:otherwise>
|
2014-03-26 09:47:59 +01:00
|
|
|
|
<xsl:value-of select="$ftpurl"/>
|
2013-10-29 16:42:03 +01:00
|
|
|
|
</xsl:otherwise>
|
|
|
|
|
</xsl:choose>
|
2014-03-26 09:47:59 +01:00
|
|
|
|
</xsl:with-param>
|
|
|
|
|
</xsl:call-template>
|
|
|
|
|
</xsl:variable>
|
|
|
|
|
<xsl:variable name="first_letter"
|
|
|
|
|
select="translate(substring($package,1,1),
|
|
|
|
|
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
|
|
|
|
'abcdefghijklmnopqrstuvwxyz')"/>
|
|
|
|
|
<xsl:text>
</xsl:text>
|
|
|
|
|
<xsl:value-of select="$varname"/>
|
|
|
|
|
<xsl:text>=</xsl:text>
|
|
|
|
|
<xsl:value-of select="$package"/>
|
|
|
|
|
<xsl:text>
if [[ ! -f $</xsl:text>
|
|
|
|
|
<xsl:value-of select="$varname"/>
|
2017-03-16 13:49:01 +01:00
|
|
|
|
<xsl:text> ]] ; then
|
|
|
|
|
if [[ -f $SRC_ARCHIVE/$</xsl:text>
|
2014-03-26 09:47:59 +01:00
|
|
|
|
<xsl:value-of select="$varname"/>
|
|
|
|
|
<xsl:text> ]] ; then
</xsl:text>
|
|
|
|
|
<xsl:text> cp $SRC_ARCHIVE/$</xsl:text>
|
|
|
|
|
<xsl:value-of select="$varname"/>
|
|
|
|
|
<xsl:text> $</xsl:text>
|
|
|
|
|
<xsl:value-of select="$varname"/>
|
2017-03-16 13:49:01 +01:00
|
|
|
|
<xsl:text>
|
|
|
|
|
else
</xsl:text>
|
2017-02-27 15:09:03 +01:00
|
|
|
|
<!-- Download from upstream http -->
|
2014-03-26 09:47:59 +01:00
|
|
|
|
<xsl:if test="string-length($httpurl) > 10">
|
2017-03-16 13:49:01 +01:00
|
|
|
|
<xsl:text> wget -T 30 -t 5 </xsl:text>
|
2014-03-26 09:47:59 +01:00
|
|
|
|
<xsl:value-of select="$httpurl"/>
|
2017-02-27 15:09:03 +01:00
|
|
|
|
<xsl:text> ||
</xsl:text>
|
2014-03-26 09:47:59 +01:00
|
|
|
|
</xsl:if>
|
2017-02-27 15:09:03 +01:00
|
|
|
|
<!-- Download from upstream ftp -->
|
2014-03-26 09:47:59 +01:00
|
|
|
|
<xsl:if test="string-length($ftpurl) > 10">
|
2017-03-16 13:49:01 +01:00
|
|
|
|
<xsl:text> wget -T 30 -t 5 </xsl:text>
|
2014-03-26 09:47:59 +01:00
|
|
|
|
<xsl:value-of select="$ftpurl"/>
|
2017-02-27 15:09:03 +01:00
|
|
|
|
<xsl:text> ||
</xsl:text>
|
2014-03-26 09:47:59 +01:00
|
|
|
|
</xsl:if>
|
2017-02-27 15:09:03 +01:00
|
|
|
|
<!-- The FTP_SERVER mirror as a last resort -->
|
2017-03-16 13:49:01 +01:00
|
|
|
|
<xsl:text> wget -T 30 -t 5 ${FTP_SERVER}svn/</xsl:text>
|
2017-02-27 15:09:03 +01:00
|
|
|
|
<xsl:value-of select="$first_letter"/>
|
|
|
|
|
<xsl:text>/$</xsl:text>
|
|
|
|
|
<xsl:value-of select="$varname"/>
|
2017-03-16 13:49:01 +01:00
|
|
|
|
<xsl:text><!--
|
|
|
|
|
cp $</xsl:text>
|
2014-03-26 09:47:59 +01:00
|
|
|
|
<xsl:value-of select="$varname"/>
|
2017-03-16 13:49:01 +01:00
|
|
|
|
<xsl:text> $SRC_ARCHIVE-->
|
|
|
|
|
fi
|
2013-10-29 16:42:03 +01:00
|
|
|
|
fi
|
|
|
|
|
</xsl:text>
|
2014-03-26 09:47:59 +01:00
|
|
|
|
<xsl:if test="string-length($md5) > 10">
|
|
|
|
|
<xsl:text>echo "</xsl:text>
|
|
|
|
|
<xsl:value-of select="$md5"/>
|
|
|
|
|
<xsl:text>  $</xsl:text>
|
|
|
|
|
<xsl:value-of select="$varname"/>
|
|
|
|
|
<xsl:text>" | md5sum -c -
|
2017-03-15 22:06:17 +01:00
|
|
|
|
</xsl:text>
|
|
|
|
|
</xsl:if>
|
|
|
|
|
<!-- link additional packages into $BUILD_DIR, because they are supposed to
|
|
|
|
|
be there-->
|
|
|
|
|
<xsl:if test="string($varname) != 'PACKAGE'">
|
2017-03-16 13:49:01 +01:00
|
|
|
|
<xsl:text>[[ "$SRC_DIR" != "$BUILD_DIR" ]] && ln -sf $SRC_DIR/$</xsl:text>
|
2017-03-15 22:06:17 +01:00
|
|
|
|
<xsl:value-of select="$varname"/>
|
|
|
|
|
<xsl:text> $BUILD_DIR
|
2013-10-29 16:42:03 +01:00
|
|
|
|
</xsl:text>
|
2014-03-26 09:47:59 +01:00
|
|
|
|
</xsl:if>
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
|
|
<!-- Extract the MD5 sum information -->
|
|
|
|
|
<xsl:template match="para" mode="md5">
|
|
|
|
|
<xsl:choose>
|
|
|
|
|
<xsl:when test="contains(substring-after(string(),'sum: '),'
')">
|
|
|
|
|
<xsl:value-of select="substring-before(substring-after(string(),'sum: '),'
')"/>
|
2013-10-29 16:42:03 +01:00
|
|
|
|
</xsl:when>
|
2014-03-26 09:47:59 +01:00
|
|
|
|
<xsl:otherwise>
|
|
|
|
|
<xsl:value-of select="substring-after(string(),'sum: ')"/>
|
|
|
|
|
</xsl:otherwise>
|
2013-10-29 16:42:03 +01:00
|
|
|
|
</xsl:choose>
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
2014-03-26 09:47:59 +01:00
|
|
|
|
<!-- We have several templates itemizedlist, depending on whether we
|
|
|
|
|
expect the package information, or additional package(s) or patch(es)
|
|
|
|
|
information. Select the appropriate mode here. -->
|
|
|
|
|
<xsl:template match="bridgehead">
|
2013-10-29 16:42:03 +01:00
|
|
|
|
<xsl:choose>
|
2014-03-26 09:47:59 +01:00
|
|
|
|
<!-- Special case for Openjdk -->
|
|
|
|
|
<xsl:when test="contains(string(),'Source Package Information')">
|
|
|
|
|
<xsl:apply-templates
|
|
|
|
|
select="following-sibling::itemizedlist[1]//simplelist">
|
|
|
|
|
<xsl:with-param name="varname" select="'PACKAGE'"/>
|
|
|
|
|
</xsl:apply-templates>
|
|
|
|
|
<xsl:apply-templates select="following-sibling::itemizedlist
|
|
|
|
|
[preceding-sibling::bridgehead[1]=current()
|
|
|
|
|
and position() >1]//simplelist">
|
|
|
|
|
<xsl:with-param name="varname" select="'PACKAGE1'"/>
|
|
|
|
|
</xsl:apply-templates>
|
2013-10-29 16:42:03 +01:00
|
|
|
|
</xsl:when>
|
2014-03-26 09:47:59 +01:00
|
|
|
|
<!-- Package information -->
|
|
|
|
|
<xsl:when test="contains(string(),'Package Information')">
|
|
|
|
|
<xsl:apply-templates select="following-sibling::itemizedlist
|
|
|
|
|
[preceding-sibling::bridgehead[1]=current()]"
|
|
|
|
|
mode="package"/>
|
2013-10-29 16:42:03 +01:00
|
|
|
|
</xsl:when>
|
2014-03-26 09:47:59 +01:00
|
|
|
|
<!-- Additional package information -->
|
2014-05-20 22:31:22 +02:00
|
|
|
|
<!-- special case for llvm -->
|
|
|
|
|
<xsl:when test="contains(string(),'Optional Download')">
|
|
|
|
|
<xsl:apply-templates select="following-sibling::itemizedlist"
|
|
|
|
|
mode="additional"/>
|
|
|
|
|
</xsl:when>
|
|
|
|
|
<!-- All other additional packages have "Additional" -->
|
2014-03-26 09:47:59 +01:00
|
|
|
|
<xsl:when test="contains(string(),'Additional')">
|
|
|
|
|
<xsl:apply-templates select="following-sibling::itemizedlist"
|
|
|
|
|
mode="additional"/>
|
2013-10-29 16:42:03 +01:00
|
|
|
|
</xsl:when>
|
2014-03-26 09:47:59 +01:00
|
|
|
|
<!-- Do not do anything if the dev has created another type of
|
|
|
|
|
bridgehead. -->
|
|
|
|
|
<xsl:otherwise/>
|
2013-10-29 16:42:03 +01:00
|
|
|
|
</xsl:choose>
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
2014-03-26 09:47:59 +01:00
|
|
|
|
<!-- Call the download code template with appropriate parameters -->
|
|
|
|
|
<xsl:template match="itemizedlist" mode="package">
|
|
|
|
|
<xsl:call-template name="download-file">
|
|
|
|
|
<xsl:with-param name="httpurl">
|
|
|
|
|
<xsl:value-of select="./listitem[1]/para/ulink/@url"/>
|
|
|
|
|
</xsl:with-param>
|
|
|
|
|
<xsl:with-param name="ftpurl">
|
|
|
|
|
<xsl:value-of select="./listitem/para[contains(string(),'FTP')]/ulink/@url"/>
|
|
|
|
|
</xsl:with-param>
|
|
|
|
|
<xsl:with-param name="md5">
|
|
|
|
|
<xsl:apply-templates select="./listitem/para[contains(string(),'MD5')]"
|
|
|
|
|
mode="md5"/>
|
|
|
|
|
</xsl:with-param>
|
|
|
|
|
<xsl:with-param name="varname" select="'PACKAGE'"/>
|
|
|
|
|
</xsl:call-template>
|
2013-10-29 16:42:03 +01:00
|
|
|
|
</xsl:template>
|
|
|
|
|
|
2014-03-26 09:47:59 +01:00
|
|
|
|
<xsl:template match="itemizedlist" mode="additional">
|
|
|
|
|
<!-- The normal layout is "one listitem"<->"one url", but some devs
|
|
|
|
|
find amusing to have FTP and/or MD5sum listitems, or to
|
|
|
|
|
enclose the download information inside a simplelist tag... -->
|
|
|
|
|
<xsl:for-each select="listitem[.//ulink]">
|
|
|
|
|
<xsl:choose>
|
|
|
|
|
<!-- hopefully, there was a HTTP line before -->
|
|
|
|
|
<xsl:when test="contains(string(./para),'FTP')"/>
|
|
|
|
|
<xsl:when test=".//simplelist">
|
|
|
|
|
<xsl:apply-templates select=".//simplelist">
|
|
|
|
|
<xsl:with-param name="varname" select="'PACKAGE1'"/>
|
|
|
|
|
</xsl:apply-templates>
|
|
|
|
|
</xsl:when>
|
|
|
|
|
<xsl:otherwise>
|
|
|
|
|
<xsl:call-template name="download-file">
|
|
|
|
|
<xsl:with-param name="httpurl">
|
|
|
|
|
<xsl:value-of select="./para/ulink/@url"/>
|
|
|
|
|
</xsl:with-param>
|
|
|
|
|
<xsl:with-param name="ftpurl">
|
|
|
|
|
<xsl:value-of
|
|
|
|
|
select="following-sibling::listitem[1]/
|
|
|
|
|
para[contains(string(),'FTP')]/ulink/@url"/>
|
|
|
|
|
</xsl:with-param>
|
|
|
|
|
<xsl:with-param name="md5">
|
|
|
|
|
<xsl:apply-templates
|
|
|
|
|
select="following-sibling::listitem[position()<3]/
|
|
|
|
|
para[contains(string(),'MD5')]"
|
|
|
|
|
mode="md5"/>
|
|
|
|
|
</xsl:with-param>
|
|
|
|
|
<xsl:with-param name="varname">
|
|
|
|
|
<xsl:choose>
|
|
|
|
|
<xsl:when test="contains(./para/ulink/@url,'.patch')">
|
|
|
|
|
<xsl:text>PATCH</xsl:text>
|
|
|
|
|
</xsl:when>
|
|
|
|
|
<xsl:otherwise>
|
|
|
|
|
<xsl:text>PACKAGE1</xsl:text>
|
|
|
|
|
</xsl:otherwise>
|
|
|
|
|
</xsl:choose>
|
|
|
|
|
</xsl:with-param>
|
|
|
|
|
</xsl:call-template>
|
|
|
|
|
</xsl:otherwise>
|
|
|
|
|
</xsl:choose>
|
|
|
|
|
</xsl:for-each>
|
2013-10-29 16:42:03 +01:00
|
|
|
|
</xsl:template>
|
|
|
|
|
|
2014-03-26 09:47:59 +01:00
|
|
|
|
<!-- the simplelist case. Hopefully, the layout is one member for
|
|
|
|
|
url, one for md5 and others for various information, that we do not
|
|
|
|
|
use -->
|
|
|
|
|
<xsl:template match="simplelist">
|
|
|
|
|
<xsl:param name="varname" select="'PACKAGE1'"/>
|
|
|
|
|
<xsl:call-template name="download-file">
|
|
|
|
|
<xsl:with-param name="httpurl" select=".//ulink/@url"/>
|
|
|
|
|
<xsl:with-param name="md5">
|
|
|
|
|
<xsl:value-of select="substring-after(member[contains(string(),'MD5')],'sum: ')"/>
|
|
|
|
|
</xsl:with-param>
|
|
|
|
|
<xsl:with-param name="varname" select="$varname"/>
|
|
|
|
|
</xsl:call-template>
|
|
|
|
|
</xsl:template>
|
2013-10-29 16:42:03 +01:00
|
|
|
|
<!--======================== Commands code ==========================-->
|
|
|
|
|
|
|
|
|
|
<xsl:template match="screen">
|
|
|
|
|
<xsl:if test="child::* = userinput and not(@role = 'nodump')">
|
|
|
|
|
<xsl:choose>
|
|
|
|
|
<xsl:when test="@role = 'root'">
|
2017-04-09 12:29:32 +02:00
|
|
|
|
<xsl:if test="not(preceding-sibling::screen[1][@role='root'])">
|
|
|
|
|
<xsl:if test="$sudo = 'y'">
|
|
|
|
|
<xsl:text>sudo -E sh << ROOT_EOF
</xsl:text>
|
|
|
|
|
</xsl:if>
|
|
|
|
|
<xsl:if test="$wrap-install = 'y' and
|
|
|
|
|
ancestor::sect2[@role='installation']">
|
|
|
|
|
<xsl:text>if [ -r "$PACK_INSTALL" ]; then
|
|
|
|
|
source $PACK_INSTALL
|
|
|
|
|
export -f wrapInstall
|
|
|
|
|
export -f packInstall
|
|
|
|
|
fi
|
|
|
|
|
wrapInstall '
|
|
|
|
|
</xsl:text>
|
|
|
|
|
</xsl:if>
|
2013-10-29 16:42:03 +01:00
|
|
|
|
</xsl:if>
|
|
|
|
|
<xsl:apply-templates mode="root"/>
|
2017-04-09 12:29:32 +02:00
|
|
|
|
<xsl:if test="not(following-sibling::screen[1][@role='root'])">
|
|
|
|
|
<xsl:if test="$wrap-install = 'y' and
|
|
|
|
|
ancestor::sect2[@role='installation']">
|
|
|
|
|
<xsl:text>'
packInstall</xsl:text>
|
|
|
|
|
</xsl:if>
|
|
|
|
|
<xsl:if test="$sudo = 'y'">
|
|
|
|
|
<xsl:text>
ROOT_EOF</xsl:text>
|
|
|
|
|
</xsl:if>
|
2013-10-29 16:42:03 +01:00
|
|
|
|
</xsl:if>
|
|
|
|
|
</xsl:when>
|
|
|
|
|
<xsl:otherwise>
|
|
|
|
|
<xsl:apply-templates select="userinput"/>
|
|
|
|
|
</xsl:otherwise>
|
|
|
|
|
</xsl:choose>
|
|
|
|
|
<xsl:text>
</xsl:text>
|
|
|
|
|
</xsl:if>
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
2017-03-01 16:54:16 +01:00
|
|
|
|
<xsl:template name="set-bootpkg-dir">
|
|
|
|
|
<xsl:param name="bootpkg" select="'bootscripts'"/>
|
|
|
|
|
<xsl:param name="url" select="''"/>
|
2017-06-29 10:25:01 +02:00
|
|
|
|
<xsl:text>BOOTPKG_DIR=blfs-</xsl:text>
|
2017-03-01 16:54:16 +01:00
|
|
|
|
<xsl:copy-of select="$bootpkg"/>
|
|
|
|
|
<xsl:text>
|
2017-06-29 10:25:01 +02:00
|
|
|
|
BOOTSRC_DIR=${SRC_ARCHIVE}${SRC_SUBDIRS:+/${BOOTPKG_DIR}}
|
|
|
|
|
BOOTBUILD_DIR=${BUILD_ROOT}${BUILD_SUBDIRS:+/${BOOTPKG_DIR}}
|
|
|
|
|
mkdir -p $BOOTSRC_DIR
|
|
|
|
|
mkdir -p $BOOTBUILD_DIR
|
|
|
|
|
|
|
|
|
|
pushd $BOOTSRC_DIR
|
2013-10-29 16:42:03 +01:00
|
|
|
|
URL=</xsl:text>
|
2017-03-01 16:54:16 +01:00
|
|
|
|
<xsl:value-of select="$url"/>
|
|
|
|
|
<xsl:text>
|
2013-10-29 16:42:03 +01:00
|
|
|
|
BOOTPACKG=$(basename $URL)
|
2013-10-30 16:44:46 +01:00
|
|
|
|
if [[ ! -f $BOOTPACKG ]] ; then
|
2017-06-29 10:25:01 +02:00
|
|
|
|
if [[ -f $SRC_ARCHIVE/$BOOTPACKG ]] ; then
|
2013-10-30 16:44:46 +01:00
|
|
|
|
cp $SRC_ARCHIVE/$BOOTPACKG $BOOTPACKG
|
|
|
|
|
else
|
|
|
|
|
wget -T 30 -t 5 $URL
|
|
|
|
|
fi
|
2017-06-29 10:25:01 +02:00
|
|
|
|
rm -f $BOOTBUILD_DIR/unpacked
|
2013-10-30 16:44:46 +01:00
|
|
|
|
fi
|
|
|
|
|
|
2017-06-29 10:25:01 +02:00
|
|
|
|
cd $BOOTBUILD_DIR
|
2013-10-29 16:42:03 +01:00
|
|
|
|
if [[ -e unpacked ]] ; then
|
2014-09-24 12:10:53 +02:00
|
|
|
|
BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
|
|
|
|
|
if ! [[ -d $BOOTUNPACKDIR ]]; then
|
2017-06-29 10:25:01 +02:00
|
|
|
|
tar -xvf $BOOTSRC_DIR/$BOOTPACKG > unpacked
|
2014-09-24 12:10:53 +02:00
|
|
|
|
BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
|
2013-10-29 16:42:03 +01:00
|
|
|
|
fi
|
|
|
|
|
else
|
2017-06-29 10:25:01 +02:00
|
|
|
|
tar -xvf $BOOTSRC_DIR/$BOOTPACKG > unpacked
|
2014-09-24 12:10:53 +02:00
|
|
|
|
BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
|
2013-10-29 16:42:03 +01:00
|
|
|
|
fi
|
2014-09-24 12:10:53 +02:00
|
|
|
|
cd $BOOTUNPACKDIR
|
2013-10-29 16:42:03 +01:00
|
|
|
|
</xsl:text>
|
2017-03-01 16:54:16 +01:00
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
|
|
<xsl:template match="screen" mode="config">
|
|
|
|
|
<xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts']">
|
|
|
|
|
<xsl:call-template name="set-bootpkg-dir">
|
|
|
|
|
<xsl:with-param name="bootpkg" select="'bootscripts'"/>
|
|
|
|
|
<xsl:with-param name="url"
|
|
|
|
|
select="id('bootscripts')//itemizedlist//ulink/@url"/>
|
|
|
|
|
</xsl:call-template>
|
|
|
|
|
</xsl:if>
|
|
|
|
|
<xsl:if test="preceding-sibling::para[1]/xref[@linkend='systemd-units']">
|
|
|
|
|
<xsl:call-template name="set-bootpkg-dir">
|
|
|
|
|
<xsl:with-param name="bootpkg" select="'systemd-units'"/>
|
|
|
|
|
<xsl:with-param name="url"
|
|
|
|
|
select="id('systemd-units')//itemizedlist//ulink/@url"/>
|
|
|
|
|
</xsl:call-template>
|
2013-10-29 16:42:03 +01:00
|
|
|
|
</xsl:if>
|
|
|
|
|
<xsl:apply-templates select='.'/>
|
2017-03-01 16:54:16 +01:00
|
|
|
|
<xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts' or
|
|
|
|
|
@linkend='systemd-units']">
|
2013-10-29 16:42:03 +01:00
|
|
|
|
<xsl:text>
|
|
|
|
|
popd</xsl:text>
|
|
|
|
|
</xsl:if>
|
|
|
|
|
<xsl:text>
</xsl:text>
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
|
|
<xsl:template match="para/command">
|
2014-09-28 10:06:23 +02:00
|
|
|
|
<xsl:variable name="ns" select="normalize-space(string())"/>
|
|
|
|
|
<xsl:if test="(contains($ns,'test') or
|
|
|
|
|
contains($ns,'check'))">
|
2013-10-29 16:42:03 +01:00
|
|
|
|
<xsl:text>#</xsl:text>
|
2014-09-28 10:06:23 +02:00
|
|
|
|
<xsl:value-of select="substring-before($ns,'make ')"/>
|
2013-11-17 09:26:47 +01:00
|
|
|
|
<xsl:text>make </xsl:text>
|
2014-09-28 10:06:23 +02:00
|
|
|
|
<xsl:if test="not(contains($ns,'-k'))">
|
2013-11-17 09:26:47 +01:00
|
|
|
|
<xsl:text>-k </xsl:text>
|
|
|
|
|
</xsl:if>
|
2014-09-28 10:06:23 +02:00
|
|
|
|
<xsl:value-of select="substring-after($ns,'make ')"/>
|
2013-10-29 16:42:03 +01:00
|
|
|
|
<xsl:text> || true
</xsl:text>
|
|
|
|
|
</xsl:if>
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
|
|
<xsl:template match="userinput">
|
|
|
|
|
<xsl:apply-templates/>
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
|
|
<xsl:template match="text()" mode="root">
|
|
|
|
|
<xsl:call-template name="output-root">
|
|
|
|
|
<xsl:with-param name="out-string" select="string()"/>
|
|
|
|
|
</xsl:call-template>
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
2017-04-09 12:29:32 +02:00
|
|
|
|
<xsl:variable name="APOS">'</xsl:variable>
|
|
|
|
|
|
2013-10-29 16:42:03 +01:00
|
|
|
|
<xsl:template name="output-root">
|
|
|
|
|
<xsl:param name="out-string" select="''"/>
|
|
|
|
|
<xsl:choose>
|
2013-11-17 09:26:47 +01:00
|
|
|
|
<xsl:when test="contains($out-string,'make ')">
|
2013-10-29 16:42:03 +01:00
|
|
|
|
<xsl:call-template name="output-root">
|
|
|
|
|
<xsl:with-param name="out-string"
|
2013-11-17 09:26:47 +01:00
|
|
|
|
select="substring-before($out-string,'make ')"/>
|
2013-10-29 16:42:03 +01:00
|
|
|
|
</xsl:call-template>
|
2013-11-17 09:26:47 +01:00
|
|
|
|
<xsl:text>make -j1 </xsl:text>
|
2013-10-29 16:42:03 +01:00
|
|
|
|
<xsl:call-template name="output-root">
|
|
|
|
|
<xsl:with-param name="out-string"
|
2013-11-17 09:26:47 +01:00
|
|
|
|
select="substring-after($out-string,'make ')"/>
|
2013-10-29 16:42:03 +01:00
|
|
|
|
</xsl:call-template>
|
|
|
|
|
</xsl:when>
|
|
|
|
|
<xsl:when test="contains($out-string,'$') and $sudo = 'y'">
|
|
|
|
|
<xsl:call-template name="output-root">
|
|
|
|
|
<xsl:with-param name="out-string"
|
|
|
|
|
select="substring-before($out-string,'$')"/>
|
|
|
|
|
</xsl:call-template>
|
|
|
|
|
<xsl:text>\$</xsl:text>
|
|
|
|
|
<xsl:call-template name="output-root">
|
|
|
|
|
<xsl:with-param name="out-string"
|
|
|
|
|
select="substring-after($out-string,'$')"/>
|
|
|
|
|
</xsl:call-template>
|
|
|
|
|
</xsl:when>
|
|
|
|
|
<xsl:when test="contains($out-string,'`') and $sudo = 'y'">
|
|
|
|
|
<xsl:call-template name="output-root">
|
|
|
|
|
<xsl:with-param name="out-string"
|
|
|
|
|
select="substring-before($out-string,'`')"/>
|
|
|
|
|
</xsl:call-template>
|
|
|
|
|
<xsl:text>\`</xsl:text>
|
|
|
|
|
<xsl:call-template name="output-root">
|
|
|
|
|
<xsl:with-param name="out-string"
|
|
|
|
|
select="substring-after($out-string,'`')"/>
|
|
|
|
|
</xsl:call-template>
|
|
|
|
|
</xsl:when>
|
|
|
|
|
<xsl:when test="contains($out-string,'\') and $sudo = 'y'">
|
|
|
|
|
<xsl:call-template name="output-root">
|
|
|
|
|
<xsl:with-param name="out-string"
|
|
|
|
|
select="substring-before($out-string,'\')"/>
|
|
|
|
|
</xsl:call-template>
|
|
|
|
|
<xsl:text>\\</xsl:text>
|
|
|
|
|
<xsl:call-template name="output-root">
|
|
|
|
|
<xsl:with-param name="out-string"
|
|
|
|
|
select="substring-after($out-string,'\')"/>
|
|
|
|
|
</xsl:call-template>
|
|
|
|
|
</xsl:when>
|
2017-04-09 12:29:32 +02:00
|
|
|
|
<xsl:when test="contains($out-string,string($APOS))
|
|
|
|
|
and $wrap-install = 'y'
|
|
|
|
|
and ancestor::sect2[@role='installation']">
|
|
|
|
|
<xsl:call-template name="output-root">
|
|
|
|
|
<xsl:with-param name="out-string"
|
|
|
|
|
select="substring-before($out-string,string($APOS))"/>
|
|
|
|
|
</xsl:call-template>
|
|
|
|
|
<xsl:text>'\''</xsl:text>
|
|
|
|
|
<xsl:call-template name="output-root">
|
|
|
|
|
<xsl:with-param name="out-string"
|
|
|
|
|
select="substring-after($out-string,string($APOS))"/>
|
|
|
|
|
</xsl:call-template>
|
|
|
|
|
</xsl:when>
|
2013-10-29 16:42:03 +01:00
|
|
|
|
<xsl:otherwise>
|
|
|
|
|
<xsl:value-of select="$out-string"/>
|
|
|
|
|
</xsl:otherwise>
|
|
|
|
|
</xsl:choose>
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
|
|
<xsl:template match="replaceable">
|
|
|
|
|
<xsl:text>**EDITME</xsl:text>
|
|
|
|
|
<xsl:apply-templates/>
|
|
|
|
|
<xsl:text>EDITME**</xsl:text>
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
|
|
<xsl:template match="replaceable" mode="root">
|
|
|
|
|
<xsl:text>**EDITME</xsl:text>
|
|
|
|
|
<xsl:apply-templates/>
|
|
|
|
|
<xsl:text>EDITME**</xsl:text>
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
|
|
</xsl:stylesheet>
|