New commits:
commit 997a37d7b680411b30b05f2f734d4199bfffa256
Author: Justin Boffemmyer <flux AT sourcemage.org>
Commit: Justin Boffemmyer <flux AT sourcemage.org>
smgl-chroot: added selectable root path
You can now pass the root path (instead of forcing it to /mnt/root) as
the first argument to smgl-chroot. If there is no argument passed on
the command-line, then it defaults to /mnt/root. Thanks to Robert
Figura for this. Fixes bug #14662.
+# Check if called with optional argument,
+# If yes then R00T=$1, else ROOT=/mnt/root
+ROOT=${"$1":-/mnt/root}
+
# Note: don't use --rbind: It creates several mounts, and we wouldn't be able
# to figure out easily what to umount.
-mount --bind /dev /mnt/root/dev &&
-mount --bind /dev/pts /mnt/root/dev/pts &&
-mount --bind /proc /mnt/root/proc &&
+mount --bind /dev "$ROOT"/dev &&
+mount --bind /dev/pts "$ROOT"/dev/pts &&
+mount --bind /proc "$ROOT"/proc &&
+
+# set the prompt for inside the chroot to reflect the fact that the user is
chrooted
export PS1="[inside chroot, type [1mexit[m to return to installer]\n\u
\w\$ " &&
-chroot /mnt/root "$@"
+
+chroot "$ROOT" "$@"
rc=$?
-umount /mnt/root/proc
-umount /mnt/root/dev/pts
-umount /mnt/root/dev
+
+# clean up the chroot mounts
+umount "$ROOT"/proc
+umount "$ROOT"/dev/pts
+umount "$ROOT"/dev
exit $rc
[SM-Commit] GIT changes to test cauldron by Justin Boffemmyer (997a37d7b680411b30b05f2f734d4199bfffa256),
Justin Boffemmyer, 10/07/2008