Hi,

When you tick 'rebuild files' and the build dir is empty, jhalfs exits
with an error. In the attached patch, I modify this logic.
The behavior remains the same if the directory is not empty.
When it is empty (or just contains "lost+found"),
the clean stage is skipped.

The patch contains also some cosmetic and corrects a typo.

Regards,
Pierre

Index: jhalfs-trunk/common/common-functions
===================================================================
--- jhalfs-trunk.orig/common/common-functions	2012-02-09 17:01:17.903066871 +0100
+++ jhalfs-trunk/common/common-functions	2012-02-09 17:27:18.567142403 +0100
@@ -46,21 +46,25 @@
 #----------------------------#
 clean_builddir() {           #
 #----------------------------#
-  # Test if the clean must be done.
-  if [ "${CLEAN}" = "y" ]; then
+# Test if the clean must be done.
+if [ "${CLEAN}" = "y" ]; then
+  # If empty (i.e. could contain lost+found), do not do anything
+  if $(ls $BUILDDIR/* > /dev/null 2>&1) &&
+       [ "$(ls $BUILDDIR)" != "lost+found" ]; then
     # Test to make sure that the build directory was populated by jhalfs
     if [ ! -d $JHALFSDIR ] || [ ! -d $BUILDDIR/sources ] ; then
       echo "Looks like $BUILDDIR was not populated by a previous jhalfs run."
       exit 1
     # Test that dev filesystems are not mounted in $BUILDDIR
     elif mount | grep $BUILDDIR/dev > /dev/null ; then
-      echo "Looks like kernel fylesystems are yet mounted on $BUILDDIR."
+      echo "Looks like kernel filesystems are yet mounted on $BUILDDIR."
       exit 1
     else
       # Clean the build directory
       echo -n "Cleaning $BUILDDIR ..."
       # First delete proc and sys directories, if exist.
-      # Both should be empty. If not, be sure to exit.
+      # Both should be empty. If not, we exit, and the rmdir command
+      # has generated an error message
       if [ -d $BUILDDIR/proc ] ; then
         sudo rmdir $BUILDDIR/proc || exit 1
       fi
@@ -77,6 +81,7 @@
       echo "done"
     fi
   fi
+fi
 }
 
 VERBOSITY2=$VERBOSITY
@@ -106,4 +111,4 @@
 [[ $? > 0 ]] && echo "file libs/func_blfs_deps did not load.." && exit 1
 [[ $VERBOSITY2 > 0 ]] && echo "OK"
 
-[[ $VERBOSITY2 > 0 ]] && echo -n "    ..."
\ No newline at end of file
+[[ $VERBOSITY2 > 0 ]] && echo -n "    ..."
-- 
http://linuxfromscratch.org/mailman/listinfo/alfs-discuss
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to