X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=usr_sbin%2Fgrml-chroot;h=098592494dd42d2ec9e8d2b51a0e7e0ce45699bc;hb=3bfbb79eef6cca9c40a63a8ea0ab86b421b72eee;hp=7e5f50358ec4b0fde35fa80e12a5d7e935402b99;hpb=6f3191ec8e502a461cd26b6deffc9aa4c0451acc;p=grml-scripts-core.git diff --git a/usr_sbin/grml-chroot b/usr_sbin/grml-chroot index 7e5f503..0985924 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 } @@ -74,10 +75,12 @@ done shift $(($OPTIND - 1)) if (( $# < 1 )); then + printUsage die "Wrong number of arguments." fi DEST_="$1" +COMMAND_="${2}" if [ ! -d "$DEST_" ]; then die "Target chroot does not exist: $DEST_" @@ -87,5 +90,6 @@ fi mountit "proc" "proc" mountit "sysfs" "sys" mountit "/dev" "dev" "--bind" -chroot "$DEST_" /bin/bash +chroot "$DEST_" $COMMAND_ umount_all +