[SM-Commit] GIT changes to test cauldron by Justin Boffemmyer (997a37d7b680411b30b05f2f734d4199bfffa256)

Justin Boffemmyer scm at sourcemage.org
Tue Oct 7 13:09:12 EDT 2008


GIT changes to test cauldron by Justin Boffemmyer <flux at sourcemage.org>:

 iso/usr/share/smgl.install/smgl-chroot |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)

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.

diff --git a/iso/usr/share/smgl.install/smgl-chroot b/iso/usr/share/smgl.install/smgl-chroot
index 717fcd9..6744361 100755
--- a/iso/usr/share/smgl.install/smgl-chroot
+++ b/iso/usr/share/smgl.install/smgl-chroot
@@ -1,16 +1,25 @@
 #!/bin/bash
 
+# 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 exit 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
 



More information about the SM-Commit mailing list