grml-chroot: do not mess with the command
authorMichael Gebetsroither <michael.geb@gmx.at>
Fri, 29 Aug 2008 11:42:45 +0000 (13:42 +0200)
committerMichael Gebetsroither <michael.geb@gmx.at>
Fri, 29 Aug 2008 11:42:45 +0000 (13:42 +0200)
doc/grml-chroot.8.txt
usr_sbin/grml-chroot

index 8815674..193ed33 100644 (file)
@@ -5,20 +5,19 @@ Michael Gebetsroither <gebi@grml.org>
 
 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
index 7e5f503..4277c34 100755 (executable)
@@ -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 <<EOT
-Usage: "$PROG_NAME_" <chroot target>
+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
+