Install units rather than bootscripts when REV=systemd

This commit is contained in:
Pierre Labastie 2017-03-01 16:07:26 +00:00
parent 50a8ed0de7
commit eb8667a45d
2 changed files with 66 additions and 9 deletions

View file

@ -8,6 +8,18 @@
<xsl:param name="list" select="''"/>
<xsl:param name="MTA" select="'sendmail'"/>
<!-- Check whether the book is sysv or systemd -->
<xsl:variable name="rev">
<xsl:choose>
<xsl:when test="//bookinfo/title/phrase[@revision='systemd']">
<xsl:text>systemd</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>sysv</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:output
method="xml"
encoding="ISO-8859-1"
@ -19,7 +31,14 @@
<preface>
<?dbhtml filename="preface.html"?>
<title>Preface</title>
<xsl:copy-of select="id('bootscripts')"/>
<xsl:choose>
<xsl:when test="$rev='sysv'">
<xsl:copy-of select="id('bootscripts')"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="id('systemd-units')"/>
</xsl:otherwise>
</xsl:choose>
</preface>
<chapter>
<?dbhtml filename="chapter.html"?>
@ -112,7 +131,8 @@
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="@linkend='bootscripts'">
<xsl:when test="@linkend='bootscripts' or
@linkend='systemd-units'">
<xsl:copy-of select="."/>
</xsl:when>
<xsl:otherwise>

View file

@ -9,6 +9,18 @@
<!-- XSLT stylesheet to create shell scripts from "linear build" BLFS books. -->
<!-- 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>
<!-- Wrap "root" commands inside a wrapper function, allowing
"porg style" package management -->
<xsl:param name="wrap-install" select="'n'"/>
@ -24,7 +36,7 @@
<xsl:template match="sect1">
<xsl:if test="@id != 'bootscripts'">
<xsl:if test="@id != 'bootscripts' and @id != 'systemd-units'">
<!-- The file names -->
<xsl:variable name="filename" select="@id"/>
@ -427,12 +439,20 @@ wrapInstall '
</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 ]] &amp;&amp; mkdir $SRC_DIR/blfs-bootscripts
pushd $SRC_DIR/blfs-bootscripts
<xsl:template name="set-bootpkg-dir">
<xsl:param name="bootpkg" select="'bootscripts'"/>
<xsl:param name="url" select="''"/>
<xsl:text>[[ ! -d $SRC_DIR/blfs-</xsl:text>
<xsl:copy-of select="$bootpkg"/>
<xsl:text> ]] &amp;&amp; mkdir $SRC_DIR/blfs-</xsl:text>
<xsl:copy-of select="$bootpkg"/>
<xsl:text>
pushd $SRC_DIR/blfs-</xsl:text>
<xsl:copy-of select="$bootpkg"/>
<xsl:text>
URL=</xsl:text>
<xsl:value-of select="id('bootscripts')//itemizedlist//ulink/@url"/><xsl:text>
<xsl:value-of select="$url"/>
<xsl:text>
BOOTPACKG=$(basename $URL)
if [[ ! -f $BOOTPACKG ]] ; then
if [[ -f $SRC_ARCHIVE/$PKG_DIR/$BOOTPACKG ]] ; then
@ -459,9 +479,26 @@ else
fi
cd $BOOTUNPACKDIR
</xsl:text>
</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>
</xsl:if>
<xsl:apply-templates select='.'/>
<xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts']">
<xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts' or
@linkend='systemd-units']">
<xsl:text>
popd</xsl:text>
</xsl:if>