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">
|
|
|
|
|
|
|
|
|
|
<!-- $Id: scripts.xsl 34 2012-02-21 16:05:09Z labastie $ -->
|
|
|
|
|
|
|
|
|
|
<!-- XSLT stylesheet to create shell scripts from "linear build" BLFS books. -->
|
|
|
|
|
|
|
|
|
|
<!-- 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">
|
|
|
|
|
|
|
|
|
|
<xsl:if test="@id != 'bootscripts'">
|
|
|
|
|
<!-- 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']">
|
|
|
|
|
<!-- We build in a subdirectory -->
|
|
|
|
|
<xsl:text>PKG_DIR=</xsl:text>
|
2013-10-29 16:42:03 +01:00
|
|
|
|
<xsl:value-of select="$filename"/>
|
|
|
|
|
<xsl:text>
</xsl:text>
|
|
|
|
|
<!-- Download code and build commands -->
|
|
|
|
|
<xsl:apply-templates select="sect2"/>
|
|
|
|
|
<!-- Clean-up -->
|
2014-03-26 09:47:59 +01:00
|
|
|
|
<xsl:text>cd $SRC_DIR/$PKG_DIR
</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'">
|
|
|
|
|
<xsl:text>mkdir -p $SRC_DIR/$PKG_DIR
</xsl:text>
|
|
|
|
|
<xsl:text>cd $SRC_DIR/$PKG_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>
|
2015-11-20 18:19:08 +01:00
|
|
|
|
find . -maxdepth 1 -mindepth 1 -type d | xargs sudo rm -rf
|
|
|
|
|
case $PACKAGE in
|
|
|
|
|
*.tar.gz|*.tar.bz2|*.tar.xz|*.tgz)
|
|
|
|
|
tar -xvf $PACKAGE > unpacked
|
|
|
|
|
UNPACKDIR=`grep '[^./]\+' unpacked | head -n1 | sed 's@^./@@;s@/.*@@'`
|
|
|
|
|
;;
|
|
|
|
|
*.zip)
|
|
|
|
|
zipinfo -1 $PACKAGE > unpacked
|
|
|
|
|
UNPACKDIR="$(sed 's@/.*@@' unpacked | uniq )"
|
|
|
|
|
if test $(wc -w <<< $UNPACKDIR) -eq 1; then
|
|
|
|
|
unzip $PACKAGE
|
|
|
|
|
else
|
|
|
|
|
UNPACKDIR=${PACKAGE%.zip}
|
|
|
|
|
unzip -d $UNPACKDIR $PACKAGE
|
|
|
|
|
fi
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
UNPACKDIR=$PKG_DIR-build
|
|
|
|
|
mkdir $UNPACKDIR
|
|
|
|
|
cp $PACKAGE $UNPACKDIR
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
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"/>
|
|
|
|
|
<xsl:text> ]] ; then
</xsl:text>
|
|
|
|
|
<!-- SRC_ARCHIVE may have subdirectories or not -->
|
|
|
|
|
<xsl:text> if [[ -f $SRC_ARCHIVE/$PKG_DIR/$</xsl:text>
|
|
|
|
|
<xsl:value-of select="$varname"/>
|
|
|
|
|
<xsl:text> ]] ; then
</xsl:text>
|
|
|
|
|
<xsl:text> cp $SRC_ARCHIVE/$PKG_DIR/$</xsl:text>
|
|
|
|
|
<xsl:value-of select="$varname"/>
|
|
|
|
|
<xsl:text> $</xsl:text>
|
|
|
|
|
<xsl:value-of select="$varname"/>
|
|
|
|
|
<xsl:text>
</xsl:text>
|
|
|
|
|
<xsl:text> elif [[ -f $SRC_ARCHIVE/$</xsl:text>
|
|
|
|
|
<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"/>
|
|
|
|
|
<xsl:text>
 else
</xsl:text>
|
|
|
|
|
<!-- The FTP_SERVER mirror -->
|
|
|
|
|
<xsl:text> wget -T 30 -t 5 ${FTP_SERVER}svn/</xsl:text>
|
|
|
|
|
<xsl:value-of select="$first_letter"/>
|
|
|
|
|
<xsl:text>/$</xsl:text>
|
|
|
|
|
<xsl:value-of select="$varname"/>
|
|
|
|
|
<xsl:if test="string-length($httpurl) > 10">
|
|
|
|
|
<xsl:text> ||
|
|
|
|
|
wget -T 30 -t 5 </xsl:text>
|
|
|
|
|
<xsl:value-of select="$httpurl"/>
|
|
|
|
|
</xsl:if>
|
|
|
|
|
<xsl:if test="string-length($ftpurl) > 10">
|
|
|
|
|
<xsl:text> ||
|
|
|
|
|
wget -T 30 -t 5 </xsl:text>
|
|
|
|
|
<xsl:value-of select="$ftpurl"/>
|
|
|
|
|
</xsl:if>
|
|
|
|
|
<xsl:text>
|
|
|
|
|
cp $</xsl:text>
|
|
|
|
|
<xsl:value-of select="$varname"/>
|
|
|
|
|
<xsl:text> $SRC_ARCHIVE
|
2013-10-29 16:42:03 +01:00
|
|
|
|
fi
|
|
|
|
|
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 -
|
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'">
|
|
|
|
|
<xsl:if test="$sudo = 'y'">
|
|
|
|
|
<xsl:text>sudo -E sh << ROOT_EOF
</xsl:text>
|
|
|
|
|
</xsl:if>
|
|
|
|
|
<xsl:apply-templates mode="root"/>
|
|
|
|
|
<xsl:if test="$sudo = 'y'">
|
|
|
|
|
<xsl:text>
ROOT_EOF</xsl:text>
|
|
|
|
|
</xsl:if>
|
|
|
|
|
</xsl:when>
|
|
|
|
|
<xsl:otherwise>
|
|
|
|
|
<xsl:apply-templates select="userinput"/>
|
|
|
|
|
</xsl:otherwise>
|
|
|
|
|
</xsl:choose>
|
|
|
|
|
<xsl:text>
</xsl:text>
|
|
|
|
|
</xsl:if>
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
|
|
<xsl:template match="screen" mode="config">
|
|
|
|
|
<xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts']">
|
|
|
|
|
<xsl:text>[[ ! -d $SRC_DIR/blfs-bootscripts ]] && mkdir $SRC_DIR/blfs-bootscripts
|
|
|
|
|
pushd $SRC_DIR/blfs-bootscripts
|
|
|
|
|
URL=</xsl:text>
|
|
|
|
|
<xsl:value-of select="id('bootscripts')//itemizedlist//ulink/@url"/><xsl:text>
|
|
|
|
|
BOOTPACKG=$(basename $URL)
|
2013-10-30 16:44:46 +01:00
|
|
|
|
if [[ ! -f $BOOTPACKG ]] ; then
|
|
|
|
|
if [[ -f $SRC_ARCHIVE/$PKG_DIR/$BOOTPACKG ]] ; then
|
|
|
|
|
cp $SRC_ARCHIVE/$PKG_DIR/$BOOTPACKG $BOOTPACKG
|
|
|
|
|
elif [[ -f $SRC_ARCHIVE/$BOOTPACKG ]] ; then
|
|
|
|
|
cp $SRC_ARCHIVE/$BOOTPACKG $BOOTPACKG
|
|
|
|
|
else
|
|
|
|
|
wget -T 30 -t 5 $URL
|
|
|
|
|
cp $BOOTPACKG $SRC_ARCHIVE
|
|
|
|
|
fi
|
|
|
|
|
rm -f unpacked
|
|
|
|
|
fi
|
|
|
|
|
|
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
|
2013-10-29 16:42:03 +01:00
|
|
|
|
rm unpacked
|
|
|
|
|
tar -xvf $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
|
|
|
|
|
tar -xvf $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>
|
|
|
|
|
</xsl:if>
|
|
|
|
|
<xsl:apply-templates select='.'/>
|
|
|
|
|
<xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts']">
|
|
|
|
|
<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>
|
|
|
|
|
|
|
|
|
|
<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>
|
|
|
|
|
<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>
|