The LFS and HLFS part should now hopefully be bug-free, and I've included a thin README file.

Preliminary support for paco in BLFS is also included in the patch, although it's mostly for special interest people, as the BLFS part need some (extensive) manual editing to really be useful. But it gives an impression how I would like to incorporate paco for BLFS. I don't really want to edit the blfs.xsl file, but I had to comment out the sudo for the installation commands. I'm trying to learn enough XSL to test if paco is to be used or not, and apply sudo based on that. I think it can be accomplished by editing a template and passing the $USE_PACO to the xsltproc command in the master.sh. If I make that work, paco can be turned on/off with a simple switch in the common/config file.

As always, all comments and reports are very welcome ;)


Tor Olav
diff -Naur jhalfs-X-2405-orig/BLFS/blfs.xsl jhalfs-X-2405-paco/BLFS/blfs.xsl
--- jhalfs-X-2405-orig/BLFS/blfs.xsl    2006-03-25 11:18:34.000000000 +0100
+++ jhalfs-X-2405-paco/BLFS/blfs.xsl    2006-03-25 13:37:48.000000000 +0100
@@ -158,9 +158,11 @@
       <xsl:choose>
         <xsl:when test="@role = 'nodump'"/>
         <xsl:otherwise>
+          <!-- Commented out by paco-patch
           <xsl:if test="@role = 'root'">
             <xsl:text>sudo </xsl:text>
           </xsl:if>
+          -->
           <xsl:apply-templates select="userinput" mode="screen"/>
         </xsl:otherwise>
       </xsl:choose>
diff -Naur jhalfs-X-2405-orig/BLFS/master.sh jhalfs-X-2405-paco/BLFS/master.sh
--- jhalfs-X-2405-orig/BLFS/master.sh   2006-03-25 11:18:34.000000000 +0100
+++ jhalfs-X-2405-paco/BLFS/master.sh   2006-03-25 11:26:38.000000000 +0100
@@ -79,8 +79,21 @@
 EOF
 ) >> $MKFILE
 
+    if [[ $USE_PACO != 0 ]]; then
+(
+    cat << EOF
+       @echo -e "\n\`date\`\n\nKB: \`du -sk --exclude=logs/* /\`\n" 
>logs/$this_script && \\
+       source $JHALFSDIR/pacovars && \\
+       rm -f $PACO_TMPFILE && \\
+       $JHALFSDIR/${PROGNAME}-commands/$file >>logs/$this_script 2>&1 && \\
+       echo -e "\n\`date\`\n\nKB: \`du -sk --exclude=logs/* /\`\n" 
>>logs/$this_script
+EOF
+) >> $MKFILE
+    wrt_paco_log_blfs
+
     # Insert date and disk usage at the top of the log file, the script run
     # and date and disk usage again at the bottom of the log file.
+    else
 (
     cat << EOF
        @echo -e "\n\`date\`\n\nKB: \`du -sk --exclude=logs/* /\`\n" 
>logs/$this_script && \\
diff -Naur jhalfs-X-2405-orig/HLFS/master.sh jhalfs-X-2405-paco/HLFS/master.sh
--- jhalfs-X-2405-orig/HLFS/master.sh   2006-03-25 11:18:35.000000000 +0100
+++ jhalfs-X-2405-paco/HLFS/master.sh   2006-03-25 11:26:33.000000000 +0100
@@ -370,6 +370,10 @@
       wrt_run_as_root "${this_script}" "${file}"
     #
     # The rest of Chapter06
+    elif [ "$vrs" != "" ] && [ $USE_PACO != 0 ]; then
+      wrt_paco_prep
+      wrt_run_as_chroot1 "${this_script}" "${file}"
+      wrt_paco_log "$name" "$vrs"
     else
       wrt_run_as_chroot1 "${this_script}" "${file}"
     fi
@@ -399,6 +403,15 @@
 
     # Keep the script file name for Makefile dependencies.
     PREV=$this_script
+
+    if [[ $USE_PACO != 0 ]] ; then
+      if [[ `_IS_ $this_script devices` ]] ; then
+        wrt_paco_inst "068.5"
+      elif [[ `_IS_ $this_script readjusting` ]] ; then
+        wrt_paco_inst "073.5"
+      fi
+    fi
+
   done # end for file in chapter06/*
 
 }
@@ -458,6 +471,15 @@
     # Check if we have a real /etc/fstab file
     if [[ `_IS_ $this_script fstab` ]] && [[ -n "$FSTAB" ]] ; then
       wrt_copy_fstab "$this_script"
+    elif [[ $USE_PACO != 0 ]] && [[ `_IS_ $this_script kernel` ]] ; then
+      vrs=`grep "^linux-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 
's/"//g'`
+      wrt_paco_prep
+      wrt_run_as_chroot2 "${this_script}" "${file}"
+      wrt_paco_log "linux-kernel" "$vrs"
+    elif [[ $USE_PACO != 0 ]] && [[ `_IS_ $this_script bootscripts` ]]; then
+      wrt_paco_prep
+      wrt_run_as_chroot2 "${this_script}" "${file}"
+      wrt_paco_log "hlfs-bootscripts"
     else
       # Initialize the log and run the script
       wrt_run_as_chroot2 "${this_script}" "${file}"
diff -Naur jhalfs-X-2405-orig/LFS/master.sh jhalfs-X-2405-paco/LFS/master.sh
--- jhalfs-X-2405-orig/LFS/master.sh    2006-03-25 11:18:34.000000000 +0100
+++ jhalfs-X-2405-paco/LFS/master.sh    2006-03-25 11:26:33.000000000 +0100
@@ -188,7 +188,13 @@
     # and not to use chroot.
     if [[ `_IS_ ${this_script} kernfs` ]] ; then
       wrt_run_as_root "${this_script}" "$file"
-    else   # The rest of Chapter06
+
+    # The rest of Chapter06
+    elif [ "$vrs" != "" ] && [ $USE_PACO != 0 ]; then
+      wrt_paco_prep
+      wrt_run_as_chroot1 "${this_script}" "${file}"
+      wrt_paco_log "${name}" "${vrs}"
+    else
       wrt_run_as_chroot1 "${this_script}" "$file"
     fi
 
@@ -207,6 +213,15 @@
 
     # Keep the script file name for Makefile dependencies.
     PREV=${this_script}
+
+    if [[ $USE_PACO != 0 ]] ; then
+      if [[ `_IS_ $this_script devices` ]] ; then
+        wrt_paco_inst "065.5"
+      elif [[ `_IS_ $this_script readjusting` ]] ; then
+        wrt_paco_inst "069.5"
+      fi
+    fi
+
   done # end for file in chapter06/*
 }
 
@@ -259,6 +274,14 @@
       # Check if we have a real /etc/fstab file
     if [[ `_IS_ ${this_script} fstab` ]] && [[ -n "$FSTAB" ]] ; then
       wrt_copy_fstab "${this_script}"
+    elif [[ $USE_PACO != 0 ]] && [[ `_IS_ $this_script kernel` ]] ; then
+      wrt_paco_prep
+      wrt_run_as_chroot2 "${this_script}" "${file}"
+      wrt_paco_log "linux-kernel" "${vrs}"
+    elif [[ $USE_PACO != 0 ]] && [[ `_IS_ $this_script bootscripts` ]]; then
+      wrt_paco_prep
+      wrt_run_as_chroot2 "${this_script}" "${file}"
+      wrt_paco_log "lfs-bootscripts" "${vrs}"
     else
       # Initialize the log and run the script
       wrt_run_as_chroot2 "$this_script" "$file"
diff -Naur jhalfs-X-2405-orig/common/config jhalfs-X-2405-paco/common/config
--- jhalfs-X-2405-orig/common/config    2006-03-25 11:18:35.000000000 +0100
+++ jhalfs-X-2405-paco/common/config    2006-03-25 11:36:26.000000000 +0100
@@ -66,3 +66,18 @@
 #--- Working directories
 JHALFSDIR=$BUILDDIR/jhalfs
    LOGDIR=$JHALFSDIR/logs
+
+#==== PACO VARIABLES ====
+#--- Use paco? 0/1 0(no)/1(yes)
+USE_PACO=1
+PACO_VERSION=20060325
+
+#--- Name of the Paco source package
+PACO_FILE=paco-$PACO_VERSION.tar.*
+
+#--- Variables needed
+# Don't change unless you know what you're doing
+PACO_INCLUDE=/
+PACO_EXCLUDE=/sys:/dev:/proc:/tmp:/usr/src:/usr/share/info/dir
+PACO_TMPFILE=/tmp/paco.tmp
+LD_PRELOAD=/usr/lib/libpaco-log.so
diff -Naur jhalfs-X-2405-orig/common/paco-build.sh 
jhalfs-X-2405-paco/common/paco-build.sh
--- jhalfs-X-2405-orig/common/paco-build.sh     1970-01-01 01:00:00.000000000 
+0100
+++ jhalfs-X-2405-paco/common/paco-build.sh     2006-03-25 11:26:33.000000000 
+0100
@@ -0,0 +1,9 @@
+#!/bin/sh
+set -e
+
+cd $PKGDIR
+./configure --prefix=/usr \
+       --disable-gpaco \
+       --sysconfdir=/etc &&
+make &&
+make install
diff -Naur jhalfs-X-2405-orig/common/paco-functions 
jhalfs-X-2405-paco/common/paco-functions
--- jhalfs-X-2405-orig/common/paco-functions    1970-01-01 01:00:00.000000000 
+0100
+++ jhalfs-X-2405-paco/common/paco-functions    2006-03-25 11:26:33.000000000 
+0100
@@ -0,0 +1,83 @@
+#!/bin/bash
+
+
+#----------------------------#
+wrt_paco_inst() {            #
+#----------------------------#
+  name="paco"
+  this_script="$1-$name"
+  file="chapter06/$this_script"
+  chapter6="$chapter6 $this_script"
+
+  # Write target, dependency and unpack
+  wrt_target "$this_script" "$PREV"
+  wrt_unpack2 "$PACO_FILE"
+
+  # Copy the Paco build script to the correct directory and make it executable
+  echo -e "[EMAIL PROTECTED] $JHALFSDIR/paco-build.sh 
$JHALFSDIR/${PROGNAME}-commands/$file && \\" >> $MKFILE.tmp
+  echo -e "\tchmod +x $JHALFSDIR/${PROGNAME}-commands/$file" >> $MKFILE.tmp
+
+  # Run the script
+  wrt_run_as_chroot1 "${this_script}" "${file}"
+
+  # Clean up
+  wrt_remove_build_dirs "$name"
+  echo -e '[EMAIL PROTECTED] $@' >> $MKFILE.tmp
+
+  # Override the PREV variable
+  PREV="$this_script"
+}
+
+
+#----------------------------------#
+wrt_paco_prep() {                  # Export Paco variables
+#----------------------------------# and remove tmpfile
+(
+cat  << EOF
+       @echo "export PACO_INCLUDE=$PACO_INCLUDE" >> envars && \\
+       echo "export PACO_EXCLUDE=\$(SRC):$JHALFSDIR:$PACO_EXCLUDE" >> envars 
&& \\
+       echo "export PACO_TMPFILE=$PACO_TMPFILE" >> envars && \\
+       echo "export LD_PRELOAD=$LD_PRELOAD" >> envars && \\
+       rm -f \$(MOUNT_PT)$PACO_TMPFILE
+EOF
+) >> $MKFILE.tmp
+}
+
+
+#----------------------------------#
+wrt_paco_log() {                   # If the tmpfile exist, then log the 
current package
+#----------------------------------# and remove tempfile
+  local PACKAGE
+
+  if [[ $2 != "" ]] ; then
+    PACKAGE="$1-$2";
+  else
+    PACKAGE="$1"
+  fi
+
+(
+cat << EOF
+       @if [ -e \$(MOUNT_PT)$PACO_TMPFILE ]; then \\
+               \$(CHROOT1) 'paco -lp $PACKAGE < $PACO_TMPFILE' && \\
+               rm -f \$(MOUNT_PT)$PACO_TMPFILE; \\
+       fi && \\
+EOF
+) >> $MKFILE.tmp
+}
+
+
+#----------------------------------#
+wrt_paco_log_blfs() {              # If the tmpfile exist, then log the 
current package
+#----------------------------------# and remove tempfile
+(
+cat << EOF
+       @PACKAGE=\`head -n1 /tmp/unpacked | sed '[EMAIL 
PROTECTED]/@@;s@/.*@@'\` && \\
+       if [ -e $PACO_TMPFILE ]; then \\
+               paco -E ~/sources:$JHALFSDIR:$PACO_EXCLUDE \\
+               -lp \$\$PACKAGE < $PACO_TMPFILE && \\
+               rm -f $PACO_TMPFILE; \\
+       fi;
+EOF
+) >> $MKFILE
+}
+
diff -Naur jhalfs-X-2405-orig/master.sh jhalfs-X-2405-paco/master.sh
--- jhalfs-X-2405-orig/master.sh        2006-03-25 11:18:35.000000000 +0100
+++ jhalfs-X-2405-paco/master.sh        2006-03-25 11:26:33.000000000 +0100
@@ -67,6 +67,14 @@
 [[ $? > 0 ]] && echo "$MODULE did not load.." && exit 2
 echo "OK"
 #
+# If Paco is requested, then source the paco-functions file
+if [ $USE_PACO != 0 ] ; then
+  echo -n "Loading paco-functions module..."
+  source $COMMON_DIR/paco-functions
+  [[ $? > 0 ]] && echo "$COMMON_DIR/paco-functions did not load.." && exit
+  echo "OK"
+fi
+#
 echo "---------------${nl_}"
 
 
@@ -312,6 +320,14 @@
 
 if [[ "$PWD" != "$JHALFSDIR" ]]; then
   cp -v $COMMON_DIR/makefile-functions $JHALFSDIR/
+  if [[ USE_PACO != 0 ]] && [[ $PROGNAME != "blfs" ]]; then
+    cp -v $COMMON_DIR/paco-build.sh $JHALFSDIR/
+  elif [[ USE_PACO != 0 ]] && [[ $PROGNAME = "blfs" ]]; then
+    echo -e "export PACO_INCLUDE=$PACO_INCLUDE" > $JHALFSDIR/pacovars
+    echo -e "export PACO_EXCLUDE=~/sources:$JHALFSDIR:$PACO_EXCLUDE" >> 
$JHALFSDIR/pacovars
+    echo -e "export PACO_TMPFILE=$PACO_TMPFILE" >> $JHALFSDIR/pacovars
+    echo -e "export LD_PRELOAD=$LD_PRELOAD" >> $JHALFSDIR/pacovars
+  fi
   if [[ -n "$FILES" ]]; then
     # pushd/popd necessary to deal with mulitiple files
     pushd $PACKAGE_DIR
###########################################
#                                         #
#    README FILE FOR JHALFS PACO PATCH    #
#                                         #
###########################################


##### NOTES #####

Patch author: Tor Olav Stava ([EMAIL PROTECTED])
Any comments directly regarding the patch should be directed to the author or 
the ALFS mailing list.
The patch author is not a member of the JHALFS team, and all work is done on a 
voluntary basis.


##### GENERAL DESCRIPTION #####

This patch will enable the paco pacKAGE oRGANIZER to be used with JHALFS.
At the moment only the LFS and HLFS part of JHALFS is supported.


##### PREREQUISITES #####

Before using JHALFS you should have some experience with LFS.
If you don't know what LFS is about, then head over to 
http://www.linuxfromscratch.org/lfs and start from there.


##### QUICK START #####

1. Apply the paco.patch.
   (patch -Np1 -i jhalfs-paco.patch)

2. Edit the configuration files to your preferences.
   (common/config, LFS/config, HLFS/config)

3. Run the wanted script.
   (Only ./lfs or ./hlfs if you want to use paco)

4. Download the paco source package to the ${H}LFS/sources dir.
   (paco-svn-20060325 or later is recommended)

5. Run make.


##### LINKS #####

Linux From Scratch homepage:
http://www.linuxfromscratch.org

paco homepage:
http://paco.sourceforge.net/index.html

nALFS + paco hint by David Rosal:
http://www.linuxfromscratch.org/hints/downloads/files/alfs_paco.txt


##### SUPPORT #####

Linux From Scratch Mailing Lists:
http://www.linuxfromscratch.org/mail.html

paco Mailing List:
http://lists.sourceforge.net/lists/listinfo/paco-general
-- 
http://linuxfromscratch.org/mailman/listinfo/alfs-discuss
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to