tags 462680 + patch
thanks

Roger Leigh <[EMAIL PROTECTED]> writes:

> So, to summarise what I think is going on (though I'd appreciate you
> check what I suggested above):
>
> - your configuration is incorrect; probably the absolute path.
> - if script-config is missing, we are silently not including it, but
>   we should probably either error out with a suitable error, or fall
>   back to reasonable defaults.
> - if copyfiles is not defined, 20copyfiles is giving an error.  We need
>   to add some additional checks here to make sure that doesn't happen.

Attached is a patch to add additional error checking and error
messages to the chroot setup and exec scripts.  If you apply these
changes to /etc/schroot/setup.d, does this help to identify the
problem you are experiencing?


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.
diff --git a/bin/schroot/exec/00check b/bin/schroot/exec/00check
index c6ac95c..91dcdfa 100755
--- a/bin/schroot/exec/00check
+++ b/bin/schroot/exec/00check
@@ -20,7 +20,10 @@
 set -e
 
 if [ -f "$CHROOT_SCRIPT_CONFIG" ]; then
-  . "$CHROOT_SCRIPT_CONFIG"
+    . "$CHROOT_SCRIPT_CONFIG"
+elif [ "$2" = "ok" ]; then
+    echo "script-config file '$CHROOT_SCRIPT_CONFIG' does not exist"
+    exit 1
 fi
 
 if [ $1 = "exec-start" ]; then
diff --git a/bin/schroot/setup/00check b/bin/schroot/setup/00check
index c76ee01..77271be 100755
--- a/bin/schroot/setup/00check
+++ b/bin/schroot/setup/00check
@@ -20,7 +20,10 @@
 set -e
 
 if [ -f "$CHROOT_SCRIPT_CONFIG" ]; then
-  . "$CHROOT_SCRIPT_CONFIG"
+    . "$CHROOT_SCRIPT_CONFIG"
+elif [ "$2" = "ok" ]; then
+    echo "script-config file '$CHROOT_SCRIPT_CONFIG' does not exist"
+    exit 1
 fi
 
 if [ $1 = "setup-start" ] || [ $1 = "setup-recover" ]; then
diff --git a/bin/schroot/setup/05file b/bin/schroot/setup/05file
index d29defd..def9bab 100755
--- a/bin/schroot/setup/05file
+++ b/bin/schroot/setup/05file
@@ -20,7 +20,10 @@
 set -e
 
 if [ -f "$CHROOT_SCRIPT_CONFIG" ]; then
-  . "$CHROOT_SCRIPT_CONFIG"
+    . "$CHROOT_SCRIPT_CONFIG"
+elif [ "$2" = "ok" ]; then
+    echo "script-config file '$CHROOT_SCRIPT_CONFIG' does not exist"
+    exit 1
 fi
 
 # Check file type
diff --git a/bin/schroot/setup/05lvm b/bin/schroot/setup/05lvm
index 1453a0e..46c61af 100755
--- a/bin/schroot/setup/05lvm
+++ b/bin/schroot/setup/05lvm
@@ -20,7 +20,10 @@
 set -e
 
 if [ -f "$CHROOT_SCRIPT_CONFIG" ]; then
-  . "$CHROOT_SCRIPT_CONFIG"
+    . "$CHROOT_SCRIPT_CONFIG"
+elif [ "$2" = "ok" ]; then
+    echo "script-config file '$CHROOT_SCRIPT_CONFIG' does not exist"
+    exit 1
 fi
 
 if [ "$AUTH_VERBOSITY" = "verbose" ]; then
diff --git a/bin/schroot/setup/10mount b/bin/schroot/setup/10mount
index 1b349dd..bfba0cc 100755
--- a/bin/schroot/setup/10mount
+++ b/bin/schroot/setup/10mount
@@ -20,7 +20,10 @@
 set -e
 
 if [ -f "$CHROOT_SCRIPT_CONFIG" ]; then
-  . "$CHROOT_SCRIPT_CONFIG"
+    . "$CHROOT_SCRIPT_CONFIG"
+elif [ "$2" = "ok" ]; then
+    echo "script-config file '$CHROOT_SCRIPT_CONFIG' does not exist"
+    exit 1
 fi
 
 # Mount a filesystem
@@ -48,15 +51,17 @@ do_mount()
 # $1: mount base location
 do_umount_all()
 {
-    mounts="$("$LIBEXEC_DIR/schroot-listmounts" -m "$1")"
-    if [ "x$mounts" != 'x' ]; then
-        echo "$mounts" |
-        while read mountloc; do
-	    if [ "$AUTH_VERBOSITY" = "verbose" ]; then
-                echo "Unmounting $mountloc"
-	    fi
-	    umount "$mountloc" || exit 1
-        done || exit 1
+    if [ -d "$1" ]; then
+	mounts="$("$LIBEXEC_DIR/schroot-listmounts" -m "$1")"
+	if [ "x$mounts" != 'x' ]; then
+            echo "$mounts" |
+            while read mountloc; do
+		if [ "$AUTH_VERBOSITY" = "verbose" ]; then
+                    echo "Unmounting $mountloc"
+		fi
+		umount "$mountloc" || exit 1
+            done || exit 1
+	fi
     fi
 }
 
@@ -102,7 +107,12 @@ if [ "$CHROOT_TYPE" = "plain" ] || [ "$CHROOT_TYPE" = "directory" ] || [ "$CHROO
 	fi
 
 	if [ "$CHROOT_TYPE" != "plain" ]; then
-	    $LIBEXEC_DIR/schroot-mount $VERBOSE -f "$FSTAB" -m "$CHROOT_PATH"
+	    if [ -f "$FSTAB" ]; then
+		$LIBEXEC_DIR/schroot-mount $VERBOSE -f "$FSTAB" -m "$CHROOT_PATH"
+	    else
+		echo "fstab file '$FSTAB' does not exist"
+		exit 1
+	    fi
 	fi
 
     elif [ $1 = "setup-stop" ]; then
diff --git a/bin/schroot/setup/15killprocs b/bin/schroot/setup/15killprocs
index 044eaa7..bb1147f 100755
--- a/bin/schroot/setup/15killprocs
+++ b/bin/schroot/setup/15killprocs
@@ -21,7 +21,10 @@
 set -e
 
 if [ -f "$CHROOT_SCRIPT_CONFIG" ]; then
-  . "$CHROOT_SCRIPT_CONFIG"
+    . "$CHROOT_SCRIPT_CONFIG"
+elif [ "$2" = "ok" ]; then
+    echo "script-config file '$CHROOT_SCRIPT_CONFIG' does not exist"
+    exit 1
 fi
 
 # Kill all processes that were run from within the chroot environment
diff --git a/bin/schroot/setup/20copyfiles b/bin/schroot/setup/20copyfiles
index 0103721..6ce0636 100755
--- a/bin/schroot/setup/20copyfiles
+++ b/bin/schroot/setup/20copyfiles
@@ -20,7 +20,10 @@
 set -e
 
 if [ -f "$CHROOT_SCRIPT_CONFIG" ]; then
-  . "$CHROOT_SCRIPT_CONFIG"
+    . "$CHROOT_SCRIPT_CONFIG"
+elif [ "$2" = "ok" ]; then
+    echo "script-config file '$CHROOT_SCRIPT_CONFIG' does not exist"
+    exit 1
 fi
 
 if [ "$AUTH_VERBOSITY" = "verbose" ]; then
@@ -63,12 +66,19 @@ copy_file()
 }
 
 if [ $1 = "setup-start" ] || [ $1 = "setup-recover" ]; then
-    while read file ; do
-	if echo "$file" | grep -q '^/'; then
-	    copy_file "$file" "${CHROOT_PATH}$file"
-	else
-	    echo "W: Not copying file with relative path: $file"
-	fi
-    done < "$COPYFILES"
+
+    if [ -f "$COPYFILES" ]; then
+	while read file; do
+	    if echo "$file" | grep -q '^/'; then
+		copy_file "$file" "${CHROOT_PATH}$file"
+	    else
+		echo "W: Not copying file with relative path: $file"
+	    fi
+	done < "$COPYFILES"
+    else
+	echo "copyfiles file '$COPYFILES' does not exist"
+	exit 1
+    fi
+
 fi
 
diff --git a/bin/schroot/setup/50chrootname b/bin/schroot/setup/50chrootname
index 8b8355f..6b571de 100755
--- a/bin/schroot/setup/50chrootname
+++ b/bin/schroot/setup/50chrootname
@@ -20,7 +20,10 @@
 set -e
 
 if [ -f "$CHROOT_SCRIPT_CONFIG" ]; then
-  . "$CHROOT_SCRIPT_CONFIG"
+    . "$CHROOT_SCRIPT_CONFIG"
+elif [ "$2" = "ok" ]; then
+    echo "script-config file '$CHROOT_SCRIPT_CONFIG' does not exist"
+    exit 1
 fi
 
 if [ $1 = "setup-start" ] || [ $1 = "setup-recover" ]; then
diff --git a/bin/schroot/setup/50sbuild b/bin/schroot/setup/50sbuild
index be3d39d..8c2d484 100755
--- a/bin/schroot/setup/50sbuild
+++ b/bin/schroot/setup/50sbuild
@@ -20,7 +20,10 @@
 set -e
 
 if [ -f "$CHROOT_SCRIPT_CONFIG" ]; then
-  . "$CHROOT_SCRIPT_CONFIG"
+    . "$CHROOT_SCRIPT_CONFIG"
+elif [ "$2" = "ok" ]; then
+    echo "script-config file '$CHROOT_SCRIPT_CONFIG' does not exist"
+    exit 1
 fi
 
 if [ $1 = "setup-start" ] && [ "$SBUILD" = "true" ]; then

Attachment: pgp5I4t8ftabc.pgp
Description: PGP signature

Reply via email to