From: Michael Gebetsroither Date: Fri, 29 Aug 2008 11:42:45 +0000 (+0200) Subject: grml-chroot: do not mess with the command X-Git-Tag: 1.1.10~3 X-Git-Url: http://git.grml.org/?p=grml-scripts.git;a=commitdiff_plain;h=18f85c7883a8fccadf4292c693388e73f866d1b6 grml-chroot: do not mess with the command --- diff --git a/doc/grml-chroot.8.txt b/doc/grml-chroot.8.txt index 8815674..193ed33 100644 --- a/doc/grml-chroot.8.txt +++ b/doc/grml-chroot.8.txt @@ -5,20 +5,19 @@ Michael Gebetsroither NAME ---- -grml-chroot - Wrapper arround chroot with proc/sys/pts/dev fs handling +grml-chroot - Wrapper around chroot with proc/sys/pts/dev filesystem handling SYNOPSIS -------- -*grml-chroot* <'CHROOT TARGET'> +*grml-chroot* 'NEWROOT' ['COMMAND'....] DESCRIPTION ----------- *grml-kerneltest* is a wrapper arround plain chroot with integrated proc/sys/pts/dev filesystem handling. -grml-chroot mounts the filesystems mentiont above and makes the chroot into the given chroot target. -After exiting the shell the mounts are cleand up properly. +After _COMMAND_ exits, mounts are cleand up properly. OPTIONS diff --git a/usr_sbin/grml-chroot b/usr_sbin/grml-chroot index 7e5f503..4277c34 100755 --- a/usr_sbin/grml-chroot +++ b/usr_sbin/grml-chroot @@ -9,6 +9,7 @@ PROG_NAME_=$(basename $0) DEST_="" MOUNTED_="" # all mounted destinations +COMMAND_="" # command to start in chroot function die @@ -20,9 +21,9 @@ function die function printUsage { cat < +Usage: "$PROG_NAME_" NEWROOT [COMMAND....] -$PROG_NAME__ is a chroot wrapper with proc/sys/pts/dev fs handling +$PROG_NAME__ is a chroot wrapper with proc/sys/pts/dev filesystem handling EOT } @@ -78,6 +79,7 @@ if (( $# < 1 )); then fi DEST_="$1" +COMMAND_="${2}" if [ ! -d "$DEST_" ]; then die "Target chroot does not exist: $DEST_" @@ -87,5 +89,6 @@ fi mountit "proc" "proc" mountit "sysfs" "sys" mountit "/dev" "dev" "--bind" -chroot "$DEST_" /bin/bash +chroot "$DEST_" $COMMAND_ umount_all +