Author: pierre
Date: Sun Mar 29 08:13:15 2020
New Revision: 4143

Log:
Set the correct #! executable in creat* scriptlets

Those scriptlets need to use a temporary bash, which is in /tools/bin
for current LFS. But if we use a new method (cross-compiling + sysroot)
it ends into /bin. So we have to set the correct `#!' header
in both cases.
We rely on the pesence of a "creatingtoolsdir" sect1 to know that
bash is in /tools

Modified:
   jhalfs/trunk/LFS/lfs.xsl

Modified: jhalfs/trunk/LFS/lfs.xsl
==============================================================================
--- jhalfs/trunk/LFS/lfs.xsl    Sun Mar 29 07:06:41 2020        (r4142)
+++ jhalfs/trunk/LFS/lfs.xsl    Sun Mar 29 08:13:15 2020        (r4143)
@@ -89,6 +89,19 @@
 
 <!-- End parameters -->
 
+<!-- bashdir is used at the beginning of chapter 6, for the #! line.
+  If we created a /tools directory in chapter 4, bash is in /tools/bin,
+otherwise it is in /bin.-->
+  <xsl:variable name="bashdir">
+    <xsl:choose>
+      <xsl:when test="//sect1[@id='ch-tools-creatingtoolsdir']">
+        <xsl:text>/tools</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text></xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
   <xsl:template match="/">
     <xsl:apply-templates select="//sect1[not(@revision) or
                                          @revision=$revision]"/>
@@ -158,16 +171,13 @@
     </xsl:if>
     <!-- Creating dirs and files -->
     <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
-      <xsl:choose>
-        <xsl:when test="@id='ch-system-creatingdirs' or
-                        @id='ch-system-createfiles' or
-                        @id='ch-system-strippingagain'">
-          <xsl:text>#!/tools/bin/bash&#xA;set +h&#xA;</xsl:text>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
-        </xsl:otherwise>
-      </xsl:choose>
+      <xsl:text>#!</xsl:text>
+      <xsl:if test="@id='ch-system-creatingdirs' or
+                    @id='ch-system-createfiles' or
+                    @id='ch-system-strippingagain'">
+        <xsl:copy-of select="$bashdir"/>
+      </xsl:if>
+      <xsl:text>/bin/bash&#xA;set +h&#xA;</xsl:text>
       <xsl:if test="not(@id='ch-tools-stripping') and
                     not(@id='ch-system-strippingagain')">
         <xsl:text>set -e&#xA;</xsl:text>
-- 
http://lists.linuxfromscratch.org/listinfo/alfs-log
Unsubscribe: See the above information page

Reply via email to