[jhalfs] 01/02: Extract chroot and kernfs commands directly from rendered XML

"Git Owner" ([email protected] via alfs-discuss Mailing List) <[email protected]> Mon, 09 Mar 2026 17:01:24 +0000
Newsgroups gmane.linux.lfs.automated
Message-ID <[email protected]>
This is a multi-part message in MIME format...

------------=_1773075692-25150-14358
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch trunk
in repository jhalfs.

commit 4ac5510146f602846cc6524c67e2adba01302dc4
Author: Kevin M. Buckley <[email protected]>
AuthorDate: Wed Feb 25 08:33:26 2026 +0800

    Extract chroot and kernfs commands directly from rendered XML
    
        Even though JHALFS has created a fully rendered XML Book,
         in prbook.xml, by the time the chroot and kernfs commands
         were extracted, extraction was performed on original source
         files
        This patch allows for the commands to be extracted from the
         rendered XML Book.
---
 common/chroot.xsl                          | 16 ++++++++++++-
 common/{kernfs.xsl => kernfs-devices.xsl}  | 36 +++++++++++++++++++++++++++++-
 common/{kernfs.xsl => kernfs-teardown.xsl} | 32 ++++++++++++++++++++++----
 common/libs/func_book_parser               | 10 ++++-----
 4 files changed, 83 insertions(+), 11 deletions(-)

diff --git a/common/chroot.xsl b/common/chroot.xsl
index 54e8601..cb80f40 100644
--- a/common/chroot.xsl
+++ b/common/chroot.xsl
@@ -6,10 +6,23 @@
       extension-element-prefixes="exsl"
       version="1.0">
 
+<!-- Parameters -->
+
   <xsl:param name="jobs_2" select="1"/>
 
+<!-- End parameters -->
+
+<!-- Start of templates -->
   <xsl:template match="/">
-    <xsl:apply-templates select="//sect1"/>
+    <xsl:apply-templates select="//chapter[
+                                @id='chapter-chroot-temporary-tools']"/>
+  </xsl:template>
+
+  <xsl:template match="chapter">
+    <xsl:apply-templates select="./sect1[
+                                @id='ch-tools-chroot']">
+      <xsl:with-param name="chap-num" select="position()+3"/>
+    </xsl:apply-templates>
   </xsl:template>
 
   <xsl:template match="sect1">
@@ -94,4 +107,5 @@
       </xsl:otherwise>
     </xsl:choose>
   </xsl:template>
+
 </xsl:stylesheet>
diff --git a/common/kernfs.xsl b/common/kernfs-devices.xsl
similarity index 74%
copy from common/kernfs.xsl
copy to common/kernfs-devices.xsl
index d7043a0..212e108 100644
--- a/common/kernfs.xsl
+++ b/common/kernfs-devices.xsl
@@ -2,14 +2,47 @@
 
 <xsl:stylesheet
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+      xmlns:exsl="http://exslt.org/common"
+      extension-element-prefixes="exsl"
       version="1.0">
 
+<!-- Parameters -->
+
+  <xsl:param name="jobs_2" select="1"/>
+
+<!-- End parameters -->
+
   <xsl:output method="text"/>
 
+<!-- Start of templates -->
   <xsl:template match="/">
     <xsl:text>#!/bin/bash
 </xsl:text>
-    <xsl:apply-templates select="//userinput[contains(string(),'--bind') or
+    <xsl:apply-templates select="//chapter[
+	@id='chapter-chroot-temporary-tools']"/>
+  </xsl:template>
+
+  <xsl:template match="chapter">
+	  <xsl:apply-templates select="./sect1[
+                                @id='ch-tools-kernfs']">
+      <xsl:with-param name="chap-num" select="position()+3"/>
+    </xsl:apply-templates>
+  </xsl:template>
+
+  <xsl:template match="sect1">
+	  <xsl:apply-templates select="./sect2[
+                                @id='ch-tools-bindmount' or
+                                @id='ch-tools-kernfsmount']">
+    </xsl:apply-templates>
+  </xsl:template>
+
+  <xsl:template match="sect2">
+    <xsl:apply-templates select="./screen">
+    </xsl:apply-templates>
+  </xsl:template>
+
+  <xsl:template match="screen">
+    <xsl:apply-templates select="./userinput[contains(string(),'--bind') or
                                              contains(string(),'/proc') or
                                              contains(string(),'readlink') or
                                              contains(string(),'-Rv')]"/>
@@ -81,4 +114,5 @@
       </xsl:otherwise>
     </xsl:choose>
   </xsl:template>
+
 </xsl:stylesheet>
diff --git a/common/kernfs.xsl b/common/kernfs-teardown.xsl
similarity index 76%
rename from common/kernfs.xsl
rename to common/kernfs-teardown.xsl
index d7043a0..b130d07 100644
--- a/common/kernfs.xsl
+++ b/common/kernfs-teardown.xsl
@@ -2,17 +2,40 @@
 
 <xsl:stylesheet
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+      xmlns:exsl="http://exslt.org/common"
+      extension-element-prefixes="exsl"
       version="1.0">
 
+<!-- Parameters -->
+
+  <xsl:param name="jobs_2" select="1"/>
+
+<!-- End parameters -->
+
   <xsl:output method="text"/>
 
+<!-- Start of templates -->
   <xsl:template match="/">
     <xsl:text>#!/bin/bash
 </xsl:text>
-    <xsl:apply-templates select="//userinput[contains(string(),'--bind') or
-                                             contains(string(),'/proc') or
-                                             contains(string(),'readlink') or
-                                             contains(string(),'-Rv')]"/>
+    <xsl:apply-templates select="//chapter[
+	@id='chapter-finalizing']"/>
+  </xsl:template>
+
+  <xsl:template match="chapter">
+	  <xsl:apply-templates select="./sect1[
+                                @id='ch-finish-reboot']">
+      <xsl:with-param name="chap-num" select="position()+3"/>
+    </xsl:apply-templates>
+  </xsl:template>
+
+  <xsl:template match="sect1">
+    <xsl:apply-templates select="./screen[not(@role) or @role != 'nodump']">
+    </xsl:apply-templates>
+  </xsl:template>
+
+  <xsl:template match="screen">
+    <xsl:apply-templates select="./userinput[contains(string(),'umount')]"/>
   </xsl:template>
 
   <xsl:template match="userinput">
@@ -81,4 +104,5 @@
       </xsl:otherwise>
     </xsl:choose>
   </xsl:template>
+
 </xsl:stylesheet>
diff --git a/common/libs/func_book_parser b/common/libs/func_book_parser
index f2bd3c7..9514bc0 100644
--- a/common/libs/func_book_parser
+++ b/common/libs/func_book_parser
@@ -157,7 +157,7 @@ create_chroot_scripts() {    #
   xsltproc --nonet --xinclude \
            --stringparam jobs_2 "$JOBS_2" \
            -o chroot-scripts/ chroot.xsl  \
-           $BOOK/chapter0?/*chroot*.xml >> $LOGDIR/$LOG 2>&1
+           prbook.xml >> $LOGDIR/$LOG 2>&1
   echo "done"
 
 }
@@ -172,12 +172,12 @@ create_kernfs_scripts() {    #
   if [ ! -z $ARCH ] ; then echo -n " $ARCH" ; fi
   echo -n "... "
   xsltproc --nonet \
-           -o kernfs-scripts/devices.sh kernfs.xsl \
-           $BOOK/*/kernfs.xml >> $LOGDIR/$LOG 2>&1
+           -o kernfs-scripts/devices.sh kernfs-devices.xsl \
+           prbook.xml >> $LOGDIR/$LOG 2>&1
   chmod +x kernfs-scripts/devices.sh
   xsltproc --nonet \
-           -o kernfs-scripts/teardown.sh kernfs.xsl \
-           $BOOK/chapter??/reboot.xml >> $LOGDIR/$LOG 2>&1
+           -o kernfs-scripts/teardown.sh kernfs-teardown.xsl \
+           prbook.xml >> $LOGDIR/$LOG 2>&1
   chmod +x kernfs-scripts/teardown.sh
 
   echo "done"

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

------------=_1773075692-25150-14358
Content-Type: text/plain; charset="UTF-8"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0

-- 
http://lists.linuxfromscratch.org/sympa/info/alfs-discuss
Unsubscribe: See the above information page
------------=_1773075692-25150-14358--