[jhalfs] 03/03: Customize the as_root function for PM:

"Git Owner" ([email protected] via alfs-discuss Mailing List) <[email protected]> Wed, 18 Feb 2026 08:44:23 +0000
Newsgroups gmane.linux.lfs.automated
Message-ID <[email protected]>
This is a multi-part message in MIME format...

------------=_1771404273-16563-8539
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 1f546c6b98dcd0c50fc9691e6dbc81d1dece6523
Author: Pierre Labastie <[email protected]>
AuthorDate: Tue Feb 17 16:00:26 2026 +0100

    Customize the as_root function for PM:
    
    Now that the linearized book contains an as_root functions for
    packages coming from a compound page, we can customize it so that
    the code is similar to what would be done for a one-page package.
    We just have to treat the special case of the instruction
    containing "as_root()". We replace it with the custom function.
---
 BLFS/xsl/process-install.xsl | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/BLFS/xsl/process-install.xsl b/BLFS/xsl/process-install.xsl
index 75cd3ab..87841eb 100644
--- a/BLFS/xsl/process-install.xsl
+++ b/BLFS/xsl/process-install.xsl
@@ -333,7 +333,15 @@ echo Size after install: $(sudo du -skx --exclude home $BUILD_DIR) >> $INFOLOG
             <xsl:with-param name="want-stats" select="$want-stats"/>
           </xsl:call-template>
         </xsl:if>
-        <xsl:apply-templates select="$current-instr"/>
+        <!-- we have a special case for the "as_root" function -->
+        <xsl:choose>
+          <xsl:when test="contains(string($current-instr),'as_root()')">
+            <xsl:call-template name="custom_as_root"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:apply-templates select="$current-instr"/>
+          </xsl:otherwise>
+        </xsl:choose>
         <xsl:call-template name="process-install">
           <xsl:with-param
              name="instruction-tree"
@@ -588,4 +596,17 @@ ROOT_EOF</xsl:text>
     </xsl:choose>
   </xsl:template>
 
+  <xsl:template name="custom_as_root">
+    <xsl:text>
+as_root() {</xsl:text>
+    <xsl:call-template name="begin-root"/>
+    <xsl:call-template name="begin-install"/>
+    <xsl:text>
+$*</xsl:text>
+    <xsl:call-template name="end-install"/>
+    <xsl:call-template name="end-root"/>
+    <xsl:text>
+}
+</xsl:text>
+  </xsl:template>
 </xsl:stylesheet>

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

------------=_1771404273-16563-8539
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
------------=_1771404273-16563-8539--