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
PROG_NAME_=$(basename $0)
DEST_=""
MOUNTED_="" # all mounted destinations
+COMMAND_="" # command to start in chroot
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
}
fi
DEST_="$1"
+COMMAND_="${2}"
if [ ! -d "$DEST_" ]; then
die "Target chroot does not exist: $DEST_"
mountit "proc" "proc"
mountit "sysfs" "sys"
mountit "/dev" "dev" "--bind"
-chroot "$DEST_" /bin/bash
+chroot "$DEST_" $COMMAND_
umount_all
+