r2020 - jhalfs/trunk

manuel at linuxfromscratch.org manuel at linuxfromscratch.org
Mon Sep 26 15:36:40 PDT 2005


Author: manuel
Date: 2005-09-26 16:36:40 -0600 (Mon, 26 Sep 2005)
New Revision: 2020

Modified:
   jhalfs/trunk/dump-commands.xsl
   jhalfs/trunk/jhalfs
Log:
Starting the move of some features to the XSL code.
First try to manage chapter05.

Modified: jhalfs/trunk/dump-commands.xsl
===================================================================
--- jhalfs/trunk/dump-commands.xsl	2005-09-26 18:11:48 UTC (rev 2019)
+++ jhalfs/trunk/dump-commands.xsl	2005-09-26 22:36:40 UTC (rev 2020)
@@ -4,7 +4,7 @@
     extension-element-prefixes="exsl"
     version="1.0">
 
-<!-- XSLT stylesheet to extract commands from [B,H]LFS books. -->
+<!-- XSLT stylesheet to create shell scripts from LFS books. -->
 
   <xsl:template match="/">
     <xsl:apply-templates select="//sect1"/>
@@ -39,6 +39,7 @@
     </xsl:variable>
       <!-- Creating dirs and files -->
     <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
+      <xsl:text>#!/bin/sh&#xA;&#xA;</xsl:text>
       <xsl:apply-templates select=".//screen"/>
     </exsl:document>
   </xsl:template>
@@ -47,13 +48,6 @@
     <xsl:if test="child::* = userinput">
       <xsl:choose>
         <xsl:when test="@role = 'nodump'"/>
-        <xsl:when test="@role = 'root'">
-          <xsl:text>&#xA;</xsl:text>
-          <xsl:text># Run this as root</xsl:text>
-          <xsl:apply-templates select="userinput"/>
-          <xsl:text># End root commands</xsl:text>
-          <xsl:text>&#xA;</xsl:text>
-        </xsl:when>
         <xsl:otherwise>
           <xsl:apply-templates select="userinput"/>
         </xsl:otherwise>
@@ -62,17 +56,8 @@
   </xsl:template>
 
   <xsl:template match="userinput">
-    <xsl:text>&#xA;</xsl:text>
-    <xsl:if test=".//replaceable">
-      <xsl:text># This block must be edited to suit your needs.</xsl:text>
-    </xsl:if>
-    <xsl:text>&#xA;</xsl:text>
     <xsl:apply-templates/>
-    <xsl:text>&#xA;</xsl:text>
-    <xsl:if test=".//replaceable">
-      <xsl:text># End of editable block.</xsl:text>
-    </xsl:if>
-    <xsl:text>&#xA;</xsl:text>
+    <xsl:text> &&&#xA;</xsl:text>
   </xsl:template>
 
   <xsl:template match="replaceable">

Modified: jhalfs/trunk/jhalfs
===================================================================
--- jhalfs/trunk/jhalfs	2005-09-26 18:11:48 UTC (rev 2019)
+++ jhalfs/trunk/jhalfs	2005-09-26 22:36:40 UTC (rev 2020)
@@ -1,7 +1,8 @@
 #!/bin/sh
 
 version="
-jhalfs 0.2
+jhalfs development
+
 Written by Jeremy Huntwork.
 Maintained by Manuel Canales Esparcia.
 
@@ -158,17 +159,6 @@
   xsltproc --nonet --xinclude -o ./commands/ $XSL \
   lfs-$LFSVRS/index.xml >>$JHALFSDIR/$LOG 2>&1
 
-  # Move the text files out from the chapter directories, and dump them
-  # all into the 'commands' directory.
-  cd commands
-  find ./* -xtype f -exec mv '{}' . \;
-  find ./* -maxdepth 0 -xtype d -exec rm -rf '{}' \;
-
-  # Remove all the blank lines from the commands
-  for i in $JHALFSDIR/commands/* ; do
-    sed -i '/^$/d' $i
-  done
-
   # Grab the patches and package names.
   cd $JHALFSDIR
   for i in patches packages ; do rm -f $i ; done
@@ -263,8 +253,11 @@
   # Start with a clean Makefile.tmp file
   >$MKFILE.tmp
 
-  for i in * ; do
-  # First append each name of the command files to a list (this will become
+  for file in chapter0{4,5}/* ; do
+  # Keep the script file name
+  i=`basename $file`
+
+  # First append each name of the script files to a list (this will become
   # the names of the targets in the Makefile
   list="$list $i"
 
@@ -293,14 +286,17 @@
     echo -e "\tcd \$(SRC)/\$\$ROOT && \\" >> $MKFILE.tmp
   fi
 
-  # Drop in the actual commands that were parsed from the book
-  # These seds add an extra $ to each variable so make doesn't break,
-  # add tabs to the beginning of each line, and add ' && \' to the end
-  # of each line except for those that end in '\'.
-  cat $i | sed -e 's:\$:&&:g' -e 's:^:\t:' -e 's:[^\\]$:& \&\& \\:' >> $MKFILE.tmp
-  # This sed removes the ' && \' from the last command of each target
-  sed -i '$s: \&\& \\::' $MKFILE.tmp
+#   # Drop in the actual commands that were parsed from the book
+#   # These seds add an extra $ to each variable so make doesn't break,
+#   # add tabs to the beginning of each line, and add ' && \' to the end
+#   # of each line except for those that end in '\'.
+#   cat $i | sed -e 's:\$:&&:g' -e 's:^:\t:' -e 's:[^\\]$:& \&\& \\:' >> $MKFILE.tmp
+#   # This sed removes the ' && \' from the last command of each target
+#   sed -i '$s: \&\& \\::' $MKFILE.tmp
 
+  # Run the script
+  echo -e "\tsu - lfs -c \"/bin/bash $file\"" >> $MKFILE.tmp
+
   # Include a touch of the target name so make can check if it's already been made.
   echo -e "\ttouch \$@" >> $MKFILE.tmp
   done




More information about the alfs-log mailing list