Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to test cauldron by Justin Boffemmyer (936967645bf0cc8a8460d3d7eed0f190f4fadfe8)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Justin Boffemmyer <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to test cauldron by Justin Boffemmyer (936967645bf0cc8a8460d3d7eed0f190f4fadfe8)
  • Date: Wed, 8 Oct 2008 21:24:25 -0500

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

scripts/cauldronchr.sh | 39 +++++++++++++++++++++++++++++++++++++++
1 files changed, 39 insertions(+)

New commits:
commit 936967645bf0cc8a8460d3d7eed0f190f4fadfe8
Author: Justin Boffemmyer <flux AT sourcemage.org>
Commit: Justin Boffemmyer <flux AT sourcemage.org>

scripts/cauldronchr.sh: new script for chrooting

Makes chrooting much easier and more convenient. It takes care of
doing the mount --bind calls on the necessary mount points, as well as
the subsequent umount calls. It also has reasonable defaults so you
can just run 'cauldronchr.sh' by itself and get a chroot.

diff --git a/scripts/cauldronchr.sh b/scripts/cauldronchr.sh
new file mode 100755
index 0000000..b519507
--- /dev/null
+++ b/scripts/cauldronchr.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+#
+# Usage: cauldronchr.sh [-d /path/to/chroot] [CHROOT_CMD]
+# assumes $CWD as chroot path and /bin/bash -l as CHROOT_CMD
+# if not specified
+
+SELF=$0
+
+[[ $UID -eq 0 ]] || {
+ echo "Enter the root password, please."
+ exec su -c "$SELF $*" root
+}
+
+CHROOT_DIR=
+CHROOT_CMD=
+
+# dir to chroot to is either $1 or $CWD
+while getopts ":d:" Option
+do
+ case $Option in
+ d ) CHROOT_DIR="$OPTARG" ;;
+ * ) ;;
+ esac
+done
+shift $(($OPTIND - 1))
+
+CHROOT_DIR="${CHROOT_DIR:-.}"
+[[ $# -gt 0 ]] && CHROOT_CMD="$@"
+CHROOT_CMD="${CHROOT_CMD:-/bin/bash -l}"
+
+mount --bind /dev "$CHROOT_DIR"/dev
+mount --bind /dev/pts "$CHROOT_DIR"/dev/pts
+mount --bind /proc "$CHROOT_DIR"/proc
+
+chroot "$CHROOT_DIR" $CHROOT_CMD
+
+umount "$CHROOT_DIR"/proc
+umount "$CHROOT_DIR"/dev/pts
+umount "$CHROOT_DIR"/dev



  • [SM-Commit] GIT changes to test cauldron by Justin Boffemmyer (936967645bf0cc8a8460d3d7eed0f190f4fadfe8), Justin Boffemmyer, 10/08/2008

Archive powered by MHonArc 2.6.24.

Top of Page