changeset 1446:6d6b25937be2

Fix setup-chroot when used with relative path, and VERBOSE option
author Rob Landley <rob@landley.net>
date Sat, 17 Sep 2011 00:01:20 -0500
parents dfef5afb664e
children dddb3b85a7a1
files sources/root-filesystem/sbin/setup-chroot
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/sources/root-filesystem/sbin/setup-chroot	Wed Sep 14 13:09:22 2011 -0500
+++ b/sources/root-filesystem/sbin/setup-chroot	Sat Sep 17 00:01:20 2011 -0500
@@ -32,7 +32,7 @@
 # Get mount point list, minus the one our new root filesystem is already in,
 # then mount --bind each remaining mount point (once) into NEWROOT.
 
-ZAP="$NEWROOT"
+ZAP="$(readlink -f "$NEWROOT")"
 
 for i in $(awk '{print $2}' /proc/mounts | tac)
 do
@@ -42,7 +42,7 @@
   # Skip the entry our chroot is under (generally /home)
   if [ "$x" == "${ZAP:0:${#x}}" ] || [ "$x" == '/' ]
   then
-    [ ! -z "$VERBOSE" ] && echo Zapping "$x"
+    [ ! -z "$VERBOSE" ] && echo Zapping "$x" >&2
     ZAP=""
     continue
   fi
@@ -52,16 +52,16 @@
 do
   mountpoint -q "$NEWROOT$i" && continue
 
-  [ ! -z "$VERBOSE" ] && echo "Bind $i to $NEWROOT$i"
+  [ ! -z "$VERBOSE" ] && echo "Bind $i to $NEWROOT$i" >&2
 
   mount --bind "$i" "$NEWROOT$i"
 done
 
-[ ! -z "$VERBOSE" ] && echo "Chrooting to \"$NEWROOT\""
+[ ! -z "$VERBOSE" ] && echo "Chrooting to \"$NEWROOT\"" >&2
 chroot "$NEWROOT" "$@"
 RC=$?
 
-[ ! -z "$VERBOSE" ] && echo "Cleanup chroot"
+[ ! -z "$VERBOSE" ] && echo "Cleanup chroot" >&2
 zapchroot "$NEWROOT"
 
 exit $RC