Nimbin[12]?Mirrors & Forks / jhalfs / commits / 24ad4fd

jhalfs git · trunk

jhalfs LFS build automation (mirror)

lfs mirror bash · first commit 2005-09-11 · last commit 2024-02-13 (2 years ago) · synced 3 days ago · upstream: git.linuxfromscratch.org/jhalfs

Python 78.4% Shell 19.8% Makefile 1.8%
git clone https://git.christianimmanuel.de/mirrors-forks/jhalfs.gitwget https://git.christianimmanuel.de/mirrors-forks/jhalfs/archive/jhalfs.tar.gz

Fix outputting too many sh <<ROOT_EOF

Pierre Labastie · 2023-03-18 21:44 · 24ad4fd4f4119781b39eace0d0be78250f7de530

When installing a bootscript or a unit, this sometimes happen
(e.g. samba).
 BLFS/xsl/scripts.xsl | 34 +++++++++++++++++++++++-----------
 1 file changed, 23 insertions(+), 11 deletions(-)

diff --git a/BLFS/xsl/scripts.xsl b/BLFS/xsl/scripts.xsl
index cb0cc70..eb04609 100644
--- a/BLFS/xsl/scripts.xsl
+++ b/BLFS/xsl/scripts.xsl
@@ -722,9 +722,13 @@ cd $BOOTUNPACKDIR</xsl:text>
   <xsl:template match="screen" mode="config">
     <xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts']">
 <!-- if the preceding "screen" tag is role="root", and we are role="root"
-     the end-root has not been called. So do it -->
+     the end-root has not been called, except if the preceding "screen"
+     tag is itself preceded by a <para> containing and <xref> to
+     bootscripts. So close it only if needed -->
       <xsl:if
-           test="preceding-sibling::screen[1][@role='root'] and @role='root'">
+        test="preceding-sibling::screen[1][@role='root'] and
+        @role='root' and
+        not(preceding-sibling::screen[1]/preceding-sibling::para[1]/xref[@linkend='bootscripts'])">
         <xsl:call-template name="end-root"/>
       </xsl:if>
       <xsl:call-template name="set-bootpkg-dir">
@@ -733,17 +737,21 @@ cd $BOOTUNPACKDIR</xsl:text>
                         select="id('bootscripts')//itemizedlist//ulink/@url"/>
       </xsl:call-template>
 <!-- if the preceding "screen" tag is role="root", and we are role="root"
-     the begin-root will not be called. So do it -->
+     the begin-root will not be called. So do it.-->
       <xsl:if
-           test="preceding-sibling::screen[1][@role='root'] and @role='root'">
+        test="preceding-sibling::screen[1][@role='root'] and
+        @role='root'">
         <xsl:call-template name="begin-root"/>
       </xsl:if>
     </xsl:if>
     <xsl:if test="preceding-sibling::para[1]/xref[@linkend='systemd-units']">
 <!-- if the preceding "screen" tag is role="root", and we are role="root"
-     the end-root has not been called. So do it -->
+     the end-root has not been called. So do it, except if it was already a
+     unit install -->
       <xsl:if
-           test="preceding-sibling::screen[1][@role='root'] and @role='root'">
+        test="preceding-sibling::screen[1][@role='root'] and
+        @role='root' and
+        not(preceding-sibling::screen[1]/preceding-sibling::para[1]/xref[@linkend='systemd-units'])">
         <xsl:call-template name="end-root"/>
       </xsl:if>
       <xsl:call-template name="set-bootpkg-dir">
@@ -752,9 +760,10 @@ cd $BOOTUNPACKDIR</xsl:text>
                         select="id('systemd-units')//itemizedlist//ulink/@url"/>
       </xsl:call-template>
 <!-- if the preceding "screen" tag is role="root", and we are role="root"
-     the begin-root will not be called. So do it -->
+     the begin-root will not be called. So do it. -->
       <xsl:if
-           test="preceding-sibling::screen[1][@role='root'] and @role='root'">
+        test="preceding-sibling::screen[1][@role='root'] and
+        @role='root'">
         <xsl:call-template name="begin-root"/>
       </xsl:if>
     </xsl:if>
@@ -762,7 +771,7 @@ cd $BOOTUNPACKDIR</xsl:text>
     <xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts' or
                                                   @linkend='systemd-units']">
 <!-- if the next "screen" tag is role="root", and we are role="root"
-     the end-root has not been called. So do it -->
+     the end-root has not been called. -->
       <xsl:if
            test="following-sibling::screen[1][@role='root'] and @role='root'">
         <xsl:call-template name="end-root"/>
@@ -770,9 +779,12 @@ cd $BOOTUNPACKDIR</xsl:text>
       <xsl:text>
 popd</xsl:text>
 <!-- if the next "screen" tag is role="root", and we are role="root"
-     the begin-root will not be called. So do it -->
+     the begin-root will not be called. So do it, except if the next
+     <screen> is itself a unit or bootscript install -->
       <xsl:if
-           test="following-sibling::screen[1][@role='root'] and @role='root'">
+        test="following-sibling::screen[1][@role='root'] and
+        @role='root' and
+        not(following-sibling::screen[1]/preceding-sibling::para[1]/xref[@linkend='bootscripts' or @linkend='systemd-units'])">
         <xsl:call-template name="begin-root"/>
       </xsl:if>
     </xsl:if>