r3895 - jhalfs/branches/new_features/BLFS/xsl

pierre at higgs.linuxfromscratch.org pierre at higgs.linuxfromscratch.org
Wed Mar 1 08:07:26 PST 2017


Author: pierre
Date: Wed Mar  1 08:07:26 2017
New Revision: 3895

Log:
Install units rather than bootscripts when REV=systemd

Modified:
   jhalfs/branches/new_features/BLFS/xsl/make_book.xsl
   jhalfs/branches/new_features/BLFS/xsl/scripts.xsl

Modified: jhalfs/branches/new_features/BLFS/xsl/make_book.xsl
==============================================================================
--- jhalfs/branches/new_features/BLFS/xsl/make_book.xsl	Wed Mar  1 07:54:16 2017	(r3894)
+++ jhalfs/branches/new_features/BLFS/xsl/make_book.xsl	Wed Mar  1 08:07:26 2017	(r3895)
@@ -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>

Modified: jhalfs/branches/new_features/BLFS/xsl/scripts.xsl
==============================================================================
--- jhalfs/branches/new_features/BLFS/xsl/scripts.xsl	Wed Mar  1 07:54:16 2017	(r3894)
+++ jhalfs/branches/new_features/BLFS/xsl/scripts.xsl	Wed Mar  1 08:07:26 2017	(r3895)
@@ -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 @@
     </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
+  <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> ]] && 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 @@
 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>


More information about the alfs-log mailing list