# HG changeset patch # User Rob Landley # Date 1316235680 18000 # Node ID 6d6b25937be2ea30a0cdffba92f7bff9e9c3751a # Parent dfef5afb664e56f7e7ee4b6626609097f976ff12 Fix setup-chroot when used with relative path, and VERBOSE option diff -r dfef5afb664e -r 6d6b25937be2 sources/root-filesystem/sbin/setup-chroot --- 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