2006-07-16 12:29:37 +02: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">
|
|
|
|
|
2012-02-22 18:09:47 +01:00
|
|
|
<!-- $Id: scripts.xsl 34 2012-02-21 16:05:09Z labastie $ -->
|
2006-07-16 12:29:37 +02:00
|
|
|
|
|
|
|
<!-- XSLT stylesheet to create shell scripts from "linear build" BLFS books. -->
|
|
|
|
|
2006-08-13 13:58:59 +02:00
|
|
|
<!-- Build as user (y) or as root (n)? -->
|
|
|
|
<xsl:param name="sudo" select="y"/>
|
|
|
|
|
2006-07-16 12:29:37 +02:00
|
|
|
<xsl:template match="/">
|
|
|
|
<xsl:apply-templates select="//sect1"/>
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
<!--=================== Master chunks code ======================-->
|
|
|
|
|
|
|
|
<xsl:template match="sect1">
|
|
|
|
|
2012-02-22 18:09:47 +01:00
|
|
|
<xsl:if test="@id != 'bootscripts'">
|
2006-07-16 12:29:37 +02:00
|
|
|
<!-- The file names -->
|
2006-08-24 22:38:22 +02:00
|
|
|
<xsl:variable name="filename" select="@id"/>
|
2006-07-16 12:29:37 +02:00
|
|
|
|
|
|
|
<!-- 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>
|
2012-02-22 18:09:47 +01:00
|
|
|
<xsl:value-of select="concat($order,'-z-',$filename)"/>
|
2006-07-16 12:29:37 +02:00
|
|
|
<xsl:text>
 FTPDIR is </xsl:text>
|
2012-02-22 18:09:47 +01:00
|
|
|
<xsl:value-of select="$filename"/>
|
2006-07-16 12:29:37 +02:00
|
|
|
<xsl:text>

</xsl:text>
|
|
|
|
</xsl:message>
|
|
|
|
|
|
|
|
<!-- Creating the scripts -->
|
2006-08-12 16:30:58 +02:00
|
|
|
<exsl:document href="{$order}-z-{$filename}" method="text">
|
2006-11-11 12:39:16 +01:00
|
|
|
<xsl:text>#!/bin/bash
set -e

</xsl:text>
|
2006-07-16 12:29:37 +02:00
|
|
|
<xsl:choose>
|
|
|
|
<!-- Package page -->
|
2006-08-15 19:00:43 +02:00
|
|
|
<xsl:when test="sect2[@role='package'] and not(@id = 'xorg7-app' or
|
|
|
|
@id = 'xorg7-data' or @id = 'xorg7-driver' or
|
|
|
|
@id = 'xorg7-font' or @id = 'xorg7-lib' or
|
|
|
|
@id = 'xorg7-proto' or @id = 'xorg7-util')">
|
2006-07-16 12:29:37 +02:00
|
|
|
<!-- Variables -->
|
2012-02-22 18:09:47 +01:00
|
|
|
<!-- These three lines could be important if SRC_ARCHIVE,
|
|
|
|
FTP_SERVER and SRCDIR were not set in the environment.
|
|
|
|
But they are not tested for length or anything later,
|
|
|
|
so not needed
|
2006-07-16 12:29:37 +02:00
|
|
|
<xsl:text>SRC_ARCHIVE=$SRC_ARCHIVE
</xsl:text>
|
2012-02-22 18:09:47 +01:00
|
|
|
<xsl:text>FTP_SERVER=$FTP_SERVER
</xsl:text>
|
|
|
|
<xsl:text>SRC_DIR=$SRC_DIR

</xsl:text>-->
|
2006-07-16 12:29:37 +02:00
|
|
|
<xsl:text>
PKG_DIR=</xsl:text>
|
2012-02-22 18:09:47 +01:00
|
|
|
<xsl:value-of select="$filename"/>
|
|
|
|
<xsl:text>
</xsl:text>
|
2006-07-16 12:29:37 +02:00
|
|
|
<!-- Download code and build commands -->
|
2012-02-22 18:09:47 +01:00
|
|
|
<xsl:apply-templates select="sect2"/>
|
2006-07-16 12:29:37 +02:00
|
|
|
<!-- Clean-up -->
|
2012-02-22 18:09:47 +01:00
|
|
|
<!-- xorg7-server used to require mesalib tree being present.
|
|
|
|
That is no more true
|
|
|
|
<xsl:if test="not(@id='mesalib')"> -->
|
2007-07-27 00:12:32 +02:00
|
|
|
<xsl:text>cd $SRC_DIR/$PKG_DIR
</xsl:text>
|
2012-02-25 10:51:13 +01:00
|
|
|
<!-- In some case, some files in the build tree are owned
|
|
|
|
by root -->
|
|
|
|
<xsl:if test="$sudo='y'">
|
|
|
|
<xsl:text>sudo </xsl:text>
|
|
|
|
</xsl:if>
|
2007-07-27 00:12:32 +02:00
|
|
|
<xsl:text>rm -rf $UNPACKDIR unpacked

</xsl:text>
|
2012-02-22 18:09:47 +01:00
|
|
|
<!-- Same reason as preceding comment
|
2007-07-27 00:12:32 +02:00
|
|
|
</xsl:if>
|
|
|
|
<xsl:if test="@id='xorg7-server'">
|
|
|
|
<xsl:text>cd $SRC_DIR/MesaLib
|
|
|
|
UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
|
|
|
|
rm -rf $UNPACKDIR unpacked

</xsl:text>
|
2012-02-22 18:09:47 +01:00
|
|
|
</xsl:if> -->
|
2006-07-16 12:29:37 +02:00
|
|
|
</xsl:when>
|
2006-08-15 19:00:43 +02:00
|
|
|
<!-- Xorg7 pseudo-packages -->
|
|
|
|
<xsl:when test="contains(@id,'xorg7') and not(@id = 'xorg7-server')">
|
2012-02-22 18:09:47 +01:00
|
|
|
<xsl:text># Useless SRC_DIR=$SRC_DIR
|
2006-08-15 19:00:43 +02:00
|
|
|
|
|
|
|
cd $SRC_DIR
|
|
|
|
mkdir -p xc
|
|
|
|
cd xc
</xsl:text>
|
|
|
|
<xsl:apply-templates select="sect2" mode="xorg7"/>
|
|
|
|
</xsl:when>
|
2006-07-16 12:29:37 +02:00
|
|
|
<!-- 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'">
|
2006-08-14 20:45:31 +02:00
|
|
|
<xsl:text>mkdir -p $SRC_DIR/$PKG_DIR
</xsl:text>
|
|
|
|
<xsl:text>cd $SRC_DIR/$PKG_DIR
</xsl:text>
|
2012-02-22 18:09:47 +01:00
|
|
|
<xsl:apply-templates select="bridgehead[@renderas='sect3']"/>
|
2006-07-16 12:29:37 +02:00
|
|
|
<xsl:text>
</xsl:text>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:when test="@role = 'installation'">
|
2006-08-12 16:27:36 +02:00
|
|
|
<xsl:text>
|
2012-02-27 11:47:30 +01:00
|
|
|
if [ "${PACKAGE%.zip}" = "${PACKAGE}" ]; then
|
|
|
|
if [[ -e unpacked ]] ; then
|
2006-08-12 16:27:36 +02:00
|
|
|
UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
|
2007-08-11 13:08:11 +02:00
|
|
|
[[ -n $UNPACKDIR ]] && [[ -d $UNPACKDIR ]] && rm -rf $UNPACKDIR
|
2012-02-27 11:47:30 +01:00
|
|
|
fi
|
|
|
|
tar -xvf $PACKAGE > unpacked
|
|
|
|
UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
|
|
|
|
else
|
|
|
|
UNPACKDIR=${PACKAGE%.zip}
|
|
|
|
[[ -n $UNPACKDIR ]] && [[ -d $UNPACKDIR ]] && rm -rf $UNPACKDIR
|
|
|
|
unzip -d $UNPACKDIR ${PACKAGE}
|
2006-08-12 16:27:36 +02:00
|
|
|
fi
|
2006-08-15 16:02:27 +02:00
|
|
|
cd $UNPACKDIR
</xsl:text>
|
2006-07-16 12:29:37 +02:00
|
|
|
<xsl:apply-templates select=".//screen | .//para/command"/>
|
2006-08-15 13:54:36 +02:00
|
|
|
<xsl:if test="$sudo = 'y'">
|
2007-07-06 02:59:01 +02:00
|
|
|
<xsl:text>sudo /sbin/</xsl:text>
|
2006-08-15 13:54:36 +02:00
|
|
|
</xsl:if>
|
|
|
|
<xsl:text>ldconfig

</xsl:text>
|
2006-07-16 12:29:37 +02:00
|
|
|
</xsl:when>
|
|
|
|
<xsl:when test="@role = 'configuration'">
|
2012-02-22 18:09:47 +01:00
|
|
|
<xsl:apply-templates select=".//screen" mode="config"/>
|
2006-07-16 12:29:37 +02:00
|
|
|
</xsl:when>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:template>
|
|
|
|
|
2006-08-15 19:00:43 +02:00
|
|
|
<xsl:template match="sect2" mode="xorg7">
|
|
|
|
<xsl:choose>
|
2007-07-26 21:07:03 +02:00
|
|
|
<xsl:when test="@role = 'package'">
|
|
|
|
<xsl:apply-templates select="itemizedlist/listitem/para" mode="xorg7"/>
|
|
|
|
</xsl:when>
|
2006-08-15 19:00:43 +02:00
|
|
|
<xsl:when test="not(@role)">
|
2012-02-22 18:09:47 +01:00
|
|
|
<!-- Useless <xsl:text>SRC_ARCHIVE=$SRC_ARCHIVE
|
|
|
|
FTP_SERVER=$FTP_SERVER
</xsl:text> -->
|
2007-07-26 21:07:03 +02:00
|
|
|
<xsl:apply-templates select=".//screen" mode="sect-ver"/>
|
2007-07-27 21:14:48 +02:00
|
|
|
<xsl:text>mkdir -p ${section}
cd ${section}
</xsl:text>
|
|
|
|
<xsl:apply-templates select="../sect2[@role='package']/itemizedlist/listitem/para" mode="xorg7-patch"/>
|
2007-08-06 20:28:09 +02:00
|
|
|
<xsl:text>for line in $(grep -v '^#' ../${sect_ver}.wget) ; do
|
2007-07-27 21:34:13 +02:00
|
|
|
if [[ ! -f ${line} ]] ; then
|
|
|
|
if [[ -f $SRC_ARCHIVE/Xorg/${section}/${line} ]] ; then
|
|
|
|
cp $SRC_ARCHIVE/Xorg/${section}/${line} ${line}
|
|
|
|
elif [[ -f $SRC_ARCHIVE/Xorg/${line} ]] ; then
|
|
|
|
cp $SRC_ARCHIVE/Xorg/${line} ${line}
|
|
|
|
elif [[ -f $SRC_ARCHIVE/${section}/${line} ]] ; then
|
|
|
|
cp $SRC_ARCHIVE/${section}/${line} ${line}
|
|
|
|
elif [[ -f $SRC_ARCHIVE/${line} ]] ; then
|
|
|
|
cp $SRC_ARCHIVE/${line} ${line}
|
2007-07-27 21:14:48 +02:00
|
|
|
else
|
2012-02-22 18:09:47 +01:00
|
|
|
wget -T 30 -t 5 ${FTP_X_SERVER}pub/individual/${section}/${line} || \
|
|
|
|
wget -T 30 -t 5 http://xorg.freedesktop.org/releases/individual/${section}/${line}
|
2007-07-27 21:14:48 +02:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
2007-08-06 20:28:09 +02:00
|
|
|
md5sum -c ../${sect_ver}.md5
|
|
|
|
cp ../${sect_ver}.wget ../${sect_ver}.wget.orig
|
|
|
|
cp ../${sect_ver}.md5 ../${sect_ver}.md5.orig
</xsl:text>
|
2006-08-15 19:00:43 +02:00
|
|
|
</xsl:when>
|
|
|
|
<xsl:when test="@role = 'installation'">
|
2007-08-06 20:28:09 +02:00
|
|
|
<xsl:text>for package in $(grep -v '^#' ../${sect_ver}.wget) ; do
|
2006-08-15 19:00:43 +02:00
|
|
|
packagedir=$(echo $package | sed 's/.tar.bz2//')
|
2007-07-27 21:34:13 +02:00
|
|
|
tar -xf ${package}
|
|
|
|
cd ${packagedir}
</xsl:text>
|
2006-08-15 19:00:43 +02:00
|
|
|
<xsl:apply-templates select=".//screen | .//para/command"/>
|
2006-08-15 19:23:39 +02:00
|
|
|
<xsl:text> cd ..
|
2007-07-27 21:34:13 +02:00
|
|
|
rm -rf ${packagedir}
|
2007-08-06 20:28:09 +02:00
|
|
|
sed -i "/${package}/d" ../${sect_ver}.wget
|
|
|
|
sed -i "/${package}/d" ../${sect_ver}.md5
|
2007-07-27 21:14:48 +02:00
|
|
|
done
|
2007-08-06 20:28:09 +02:00
|
|
|
mv ../${sect_ver}.wget.orig ../${sect_ver}.wget
|
|
|
|
mv ../${sect_ver}.md5.orig ../${sect_ver}.md5
</xsl:text>
|
2006-08-15 19:00:43 +02:00
|
|
|
<xsl:if test="$sudo = 'y'">
|
2007-07-06 02:59:01 +02:00
|
|
|
<xsl:text>sudo /sbin/</xsl:text>
|
2006-08-15 19:00:43 +02:00
|
|
|
</xsl:if>
|
|
|
|
<xsl:text>ldconfig

</xsl:text>
|
|
|
|
</xsl:when>
|
2007-07-26 21:07:03 +02:00
|
|
|
<xsl:when test="@role = 'configuration'">
|
|
|
|
<xsl:apply-templates select=".//screen"/>
|
|
|
|
<xsl:text>
</xsl:text>
|
|
|
|
</xsl:when>
|
2006-08-15 19:00:43 +02:00
|
|
|
</xsl:choose>
|
|
|
|
</xsl:template>
|
|
|
|
|
2006-07-16 12:29:37 +02:00
|
|
|
<!--==================== Download code =======================-->
|
|
|
|
|
|
|
|
<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>
|
|
|
|
|
2012-02-22 18:09:47 +01:00
|
|
|
<xsl:template match="bridgehead">
|
2006-07-16 12:29:37 +02:00
|
|
|
<xsl:choose>
|
2012-02-22 18:09:47 +01:00
|
|
|
<xsl:when test="string()='Package Information'">
|
|
|
|
<xsl:variable name="url">
|
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when
|
|
|
|
test="string-length(
|
|
|
|
following-sibling::itemizedlist[1]/listitem[1]/para/ulink/@url)
|
|
|
|
> 10">
|
|
|
|
<xsl:value-of select=
|
|
|
|
"following-sibling::itemizedlist[1]/listitem[1]/para/ulink/@url"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select=
|
|
|
|
"following-sibling::itemizedlist[1]/listitem[2]/para/ulink/@url"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
2006-07-16 12:29:37 +02:00
|
|
|
</xsl:variable>
|
2012-02-22 18:09:47 +01:00
|
|
|
<xsl:variable name="package">
|
|
|
|
<xsl:call-template name="package_name">
|
|
|
|
<xsl:with-param name="url" select="$url"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:variable>
|
|
|
|
<xsl:variable
|
|
|
|
name="first_letter"
|
|
|
|
select="translate(substring($package,1,1),
|
|
|
|
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
|
|
|
'abcdefghijklmnopqrstuvwxyz')"/>
|
|
|
|
<xsl:text>PACKAGE=</xsl:text>
|
|
|
|
<xsl:value-of select="$package"/>
|
|
|
|
<xsl:text>
if [[ ! -f $PACKAGE ]] ; then
</xsl:text>
|
2006-07-16 12:29:37 +02:00
|
|
|
<!-- SRC_ARCHIVE may have subdirectories or not -->
|
|
|
|
<xsl:text> if [[ -f $SRC_ARCHIVE/$PKG_DIR/$PACKAGE ]] ; then
</xsl:text>
|
|
|
|
<xsl:text> cp $SRC_ARCHIVE/$PKG_DIR/$PACKAGE $PACKAGE
</xsl:text>
|
|
|
|
<xsl:text> elif [[ -f $SRC_ARCHIVE/$PACKAGE ]] ; then
</xsl:text>
|
|
|
|
<xsl:text> cp $SRC_ARCHIVE/$PACKAGE $PACKAGE
 else
</xsl:text>
|
|
|
|
<!-- The FTP_SERVER mirror -->
|
2012-02-22 18:09:47 +01:00
|
|
|
<xsl:text> wget -T 30 -t 5 ${FTP_SERVER}svn/</xsl:text>
|
|
|
|
<xsl:value-of select="$first_letter"/>
|
|
|
|
<xsl:text>/$PACKAGE</xsl:text>
|
|
|
|
<xsl:apply-templates
|
|
|
|
select="following-sibling::itemizedlist[1]/listitem/para"
|
|
|
|
mode="package"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:when test="string()='Additional Downloads'">
|
|
|
|
<xsl:apply-templates
|
|
|
|
select="following-sibling::itemizedlist[1]/listitem/para"
|
|
|
|
mode="additional"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise/>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
<xsl:template match="para" mode="package">
|
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="contains(string(),'HTTP')">
|
2006-07-16 12:29:37 +02:00
|
|
|
<!-- Upstream HTTP URL -->
|
2006-12-04 18:47:37 +01:00
|
|
|
<xsl:if test="string-length(ulink/@url) > '10'">
|
2012-02-22 18:09:47 +01:00
|
|
|
<xsl:text> || \
 wget -T 30 -t 5 </xsl:text>
|
2006-12-04 18:47:37 +01:00
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="contains(ulink/@url,'?')">
|
|
|
|
<xsl:value-of select="substring-before(ulink/@url,'?')"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="ulink/@url"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
2012-02-22 18:09:47 +01:00
|
|
|
<xsl:if test="not(contains(string(parent::listitem/following-sibling::listitem[1]/para),'FTP'))">
|
2012-03-03 21:08:37 +01:00
|
|
|
<xsl:text>
|
|
|
|
cp $PACKAGE $SRC_ARCHIVE
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
</xsl:text>
|
2012-02-22 18:09:47 +01:00
|
|
|
</xsl:if>
|
2006-07-16 12:29:37 +02:00
|
|
|
</xsl:if>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:when test="contains(string(),'FTP')">
|
|
|
|
<!-- Upstream FTP URL -->
|
|
|
|
<xsl:if test="string-length(ulink/@url) > '10'">
|
2012-02-22 18:09:47 +01:00
|
|
|
<xsl:text> || \
 wget -T 30 -t 5 </xsl:text>
|
2006-07-16 12:29:37 +02:00
|
|
|
<xsl:value-of select="ulink/@url"/>
|
|
|
|
</xsl:if>
|
2012-03-03 21:08:37 +01:00
|
|
|
<xsl:text>
|
|
|
|
cp $PACKAGE $SRC_ARCHIVE
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
</xsl:text>
|
2006-07-16 12:29:37 +02:00
|
|
|
</xsl:when>
|
|
|
|
<xsl:when test="contains(string(),'MD5')">
|
2012-03-03 19:41:53 +01:00
|
|
|
<!-- some md5 sums are written with a LF -->
|
|
|
|
<xsl:variable name="md5">
|
|
|
|
<xsl:choose>
|
2012-03-05 18:23:09 +01:00
|
|
|
<xsl:when test="contains(substring-after(string(),'sum: '),'
')">
|
2012-03-03 19:41:53 +01:00
|
|
|
<xsl:value-of select="substring-before(substring-after(string(),'sum: '),'
')"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="substring-after(string(),'sum: ')"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:variable>
|
2006-07-16 12:29:37 +02:00
|
|
|
<xsl:text>echo "</xsl:text>
|
2012-03-03 19:41:53 +01:00
|
|
|
<xsl:value-of select="$md5"/>
|
2006-07-16 12:29:37 +02:00
|
|
|
<xsl:text>  $PACKAGE" | md5sum -c -
</xsl:text>
|
|
|
|
</xsl:when>
|
2012-02-22 18:09:47 +01:00
|
|
|
</xsl:choose>
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
<xsl:template match="para" mode="additional">
|
|
|
|
<xsl:choose>
|
2006-07-16 12:29:37 +02:00
|
|
|
<xsl:when test="contains(string(ulink/@url),'.patch')">
|
2012-02-29 14:16:50 +01:00
|
|
|
<xsl:variable name="patch">
|
|
|
|
<xsl:call-template name="package_name">
|
|
|
|
<xsl:with-param name="url" select="ulink/@url"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:variable>
|
|
|
|
<xsl:text>PATCH=</xsl:text>
|
|
|
|
<xsl:value-of select="$patch"/>
|
|
|
|
<xsl:text>
if [[ ! -f $PATCH ]] ; then
</xsl:text>
|
|
|
|
<!-- SRC_ARCHIVE may have subdirectories or not -->
|
|
|
|
<xsl:text> if [[ -f $SRC_ARCHIVE/$PKG_DIR/$PATCH ]] ; then
</xsl:text>
|
|
|
|
<xsl:text> cp $SRC_ARCHIVE/$PKG_DIR/$PATCH $PATCH
</xsl:text>
|
|
|
|
<xsl:text> elif [[ -f $SRC_ARCHIVE/$PATCH ]] ; then
</xsl:text>
|
|
|
|
<xsl:text> cp $SRC_ARCHIVE/$PATCH $PATCH
 else
</xsl:text>
|
2012-02-22 18:09:47 +01:00
|
|
|
<xsl:text>wget -T 30 -t 5 </xsl:text>
|
2006-07-16 12:29:37 +02:00
|
|
|
<xsl:value-of select="ulink/@url"/>
|
|
|
|
<xsl:text>
</xsl:text>
|
2012-03-03 21:08:37 +01:00
|
|
|
<xsl:text>
|
|
|
|
cp $PATCH $SRC_ARCHIVE
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
</xsl:text>
|
2006-07-16 12:29:37 +02:00
|
|
|
</xsl:when>
|
2012-02-22 18:09:47 +01:00
|
|
|
<xsl:when test="ulink">
|
|
|
|
<xsl:if test="string-length(ulink/@url) > '10'">
|
|
|
|
<xsl:variable name="package">
|
|
|
|
<xsl:call-template name="package_name">
|
|
|
|
<xsl:with-param name="url" select="ulink/@url"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:variable>
|
|
|
|
<xsl:variable
|
|
|
|
name="first_letter"
|
|
|
|
select="translate(substring($package,1,1),
|
|
|
|
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
|
|
|
'abcdefghijklmnopqrstuvwxyz')"/>
|
|
|
|
<xsl:text>PACKAGE1=</xsl:text>
|
|
|
|
<xsl:value-of select="$package"/>
|
|
|
|
<xsl:text>
if [[ ! -f $PACKAGE1 ]] ; then
</xsl:text>
|
|
|
|
<!-- SRC_ARCHIVE may have subdirectories or not -->
|
|
|
|
<xsl:text> if [[ -f $SRC_ARCHIVE/$PKG_DIR/$PACKAGE1 ]] ; then
</xsl:text>
|
|
|
|
<xsl:text> cp $SRC_ARCHIVE/$PKG_DIR/$PACKAGE1 $PACKAGE1
</xsl:text>
|
|
|
|
<xsl:text> elif [[ -f $SRC_ARCHIVE/$PACKAGE1 ]] ; then
</xsl:text>
|
|
|
|
<xsl:text> cp $SRC_ARCHIVE/$PACKAGE1 $PACKAGE1
 else
</xsl:text>
|
|
|
|
<!-- The FTP_SERVER mirror -->
|
2012-02-29 14:16:50 +01:00
|
|
|
<xsl:text> wget -T 30 -t 5 ${FTP_SERVER}svn/</xsl:text>
|
2012-02-22 18:09:47 +01:00
|
|
|
<xsl:value-of select="$first_letter"/>
|
|
|
|
<xsl:text>/$PACKAGE1</xsl:text>
|
|
|
|
<xsl:text> || \
 wget -T 30 -t 5 </xsl:text>
|
|
|
|
<xsl:value-of select="ulink/@url"/>
|
2012-03-03 21:08:37 +01:00
|
|
|
<xsl:text>
|
|
|
|
cp $PACKAGE1 $SRC_ARCHIVE
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
</xsl:text>
|
2012-02-22 18:09:47 +01:00
|
|
|
</xsl:if>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:when test="contains(string(),'MD5')">
|
2012-03-03 21:14:40 +01:00
|
|
|
<!-- some md5 sums are written with a LF -->
|
|
|
|
<xsl:variable name="md5">
|
|
|
|
<xsl:choose>
|
2012-03-05 18:23:09 +01:00
|
|
|
<xsl:when test="contains(substring-after(string(),'sum: '),'
')">
|
2012-03-03 21:14:40 +01:00
|
|
|
<xsl:value-of select="substring-before(substring-after(string(),'sum: '),'
')"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="substring-after(string(),'sum: ')"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:variable>
|
2012-02-22 18:09:47 +01:00
|
|
|
<xsl:text>echo "</xsl:text>
|
2012-03-03 21:14:40 +01:00
|
|
|
<xsl:value-of select="$md5"/>
|
2012-02-22 18:09:47 +01:00
|
|
|
<xsl:text>  $PACKAGE1" | md5sum -c -
</xsl:text>
|
|
|
|
</xsl:when>
|
2006-07-16 12:29:37 +02:00
|
|
|
</xsl:choose>
|
|
|
|
</xsl:template>
|
|
|
|
|
2006-08-15 19:23:39 +02:00
|
|
|
<xsl:template match="itemizedlist/listitem/para" mode="xorg7">
|
2007-07-26 21:07:03 +02:00
|
|
|
<xsl:if test="contains(string(ulink/@url),'.md5') or
|
|
|
|
contains(string(ulink/@url),'.wget')">
|
2012-02-22 18:09:47 +01:00
|
|
|
<xsl:text>wget -T 30 -t 5 </xsl:text>
|
2007-07-26 21:07:03 +02:00
|
|
|
<xsl:value-of select="ulink/@url"/>
|
|
|
|
<xsl:text>
</xsl:text>
|
|
|
|
</xsl:if>
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
<xsl:template match="itemizedlist/listitem/para" mode="xorg7-patch">
|
2006-08-15 19:23:39 +02:00
|
|
|
<xsl:if test="contains(string(ulink/@url),'.patch')">
|
2012-02-22 18:09:47 +01:00
|
|
|
<xsl:text>wget -T 30 -t 5 </xsl:text>
|
2006-08-15 19:23:39 +02:00
|
|
|
<xsl:value-of select="ulink/@url"/>
|
|
|
|
<xsl:text>
</xsl:text>
|
|
|
|
</xsl:if>
|
|
|
|
</xsl:template>
|
|
|
|
|
2006-07-16 12:29:37 +02:00
|
|
|
<!--======================== Commands code ==========================-->
|
|
|
|
|
|
|
|
<xsl:template match="screen">
|
|
|
|
<xsl:if test="child::* = userinput and not(@role = 'nodump')">
|
2012-02-23 18:42:27 +01:00
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="@role = 'root'">
|
|
|
|
<xsl:if test="$sudo = 'y'">
|
2012-03-20 18:12:26 +01:00
|
|
|
<xsl:text>sudo sh << ROOT_EOF
</xsl:text>
|
2012-02-23 18:42:27 +01:00
|
|
|
</xsl:if>
|
|
|
|
<xsl:apply-templates select="userinput" mode="root"/>
|
|
|
|
<xsl:if test="$sudo = 'y'">
|
2012-03-20 18:12:26 +01:00
|
|
|
<xsl:text>
ROOT_EOF</xsl:text>
|
2012-02-23 18:42:27 +01:00
|
|
|
</xsl:if>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:apply-templates select="userinput"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
2006-07-16 12:29:37 +02:00
|
|
|
<xsl:text>
</xsl:text>
|
|
|
|
</xsl:if>
|
|
|
|
</xsl:template>
|
|
|
|
|
2012-02-22 18:09:47 +01:00
|
|
|
<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)
|
|
|
|
[[ ! -f "$BOOTPACKG" ]] && { wget -T 30 -t 5 $URL; rm -f unpacked; }
|
|
|
|
if [[ -e unpacked ]] ; then
|
|
|
|
UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
|
|
|
|
if ! [[ -d $UNPACKDIR ]]; then
|
|
|
|
rm unpacked
|
|
|
|
tar -xvf $BOOTPACKG > unpacked
|
|
|
|
UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
tar -xvf $BOOTPACKG > unpacked
|
|
|
|
UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
|
|
|
|
fi
|
|
|
|
cd $UNPACKDIR
|
|
|
|
</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>
|
|
|
|
|
2007-07-26 21:07:03 +02:00
|
|
|
<xsl:template match="screen" mode="sect-ver">
|
2007-07-27 21:14:48 +02:00
|
|
|
<xsl:text>section=</xsl:text>
|
|
|
|
<xsl:value-of select="substring-before(substring-after(string(),'mkdir '),' &')"/>
|
2007-08-06 20:28:09 +02:00
|
|
|
<xsl:text>
sect_ver=</xsl:text>
|
2007-07-26 21:07:03 +02:00
|
|
|
<xsl:value-of select="substring-before(substring-after(string(),'-c ../'),'.md5')"/>
|
|
|
|
<xsl:text>
</xsl:text>
|
2006-08-15 19:00:43 +02:00
|
|
|
</xsl:template>
|
|
|
|
|
2006-07-16 12:29:37 +02:00
|
|
|
<xsl:template match="para/command">
|
|
|
|
<xsl:if test="(contains(string(),'test') or
|
|
|
|
contains(string(),'check'))">
|
|
|
|
<xsl:text>#</xsl:text>
|
|
|
|
<xsl:value-of select="substring-before(string(),'make')"/>
|
|
|
|
<xsl:text>make -k</xsl:text>
|
|
|
|
<xsl:value-of select="substring-after(string(),'make')"/>
|
|
|
|
<xsl:text> || true
</xsl:text>
|
|
|
|
</xsl:if>
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
<xsl:template match="userinput">
|
|
|
|
<xsl:apply-templates/>
|
|
|
|
</xsl:template>
|
|
|
|
|
2012-02-23 18:42:27 +01:00
|
|
|
<xsl:template match="userinput" mode="root">
|
|
|
|
<xsl:for-each select="child::node()">
|
|
|
|
<xsl:choose>
|
2012-03-20 18:12:26 +01:00
|
|
|
<xsl:when test="self::text()">
|
|
|
|
<xsl:call-template name="output-root">
|
|
|
|
<xsl:with-param name="out-string" select="string()"/>
|
|
|
|
</xsl:call-template>
|
2012-02-23 18:42:27 +01:00
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:apply-templates select="self::node()"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:for-each>
|
|
|
|
</xsl:template>
|
|
|
|
|
2012-03-20 18:12:26 +01:00
|
|
|
<xsl:template name="output-root">
|
|
|
|
<xsl:param name="out-string" select="''"/>
|
2007-07-27 00:12:32 +02:00
|
|
|
<xsl:choose>
|
2012-03-20 18:12:26 +01:00
|
|
|
<xsl:when test="contains($out-string,'make')">
|
|
|
|
<xsl:call-template name="output-root">
|
|
|
|
<xsl:with-param name="out-string"
|
|
|
|
select="substring-before($out-string,'make')"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
<xsl:text>make -j1</xsl:text>
|
|
|
|
<xsl:call-template name="output-root">
|
|
|
|
<xsl:with-param name="out-string"
|
|
|
|
select="substring-after($out-string,'make')"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:when test="contains($out-string,'`')">
|
|
|
|
<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,'\')">
|
|
|
|
<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>
|
2007-07-27 00:12:32 +02:00
|
|
|
</xsl:when>
|
2012-03-20 18:12:26 +01:00
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="$out-string"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
<xsl:template match="replaceable">
|
2007-07-27 00:12:32 +02:00
|
|
|
<xsl:text>**EDITME</xsl:text>
|
|
|
|
<xsl:apply-templates/>
|
|
|
|
<xsl:text>EDITME**</xsl:text>
|
2006-07-16 12:29:37 +02:00
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
</xsl:stylesheet>
|