grml-chroot is commonly used with fresh installations which might not
have the shell of the current user, or it may be badly configured.
default to the shell of the target's root user, in the hope that it
will be more useful.
around plain chroot with integrated proc/sys/pts/dev filesystem handling.
After _COMMAND_ exits, mounts are cleaned up properly.
+If _COMMAND_ is omitted, the shell of user *root* of the target filesystem is used.
+
OPTIONS
-------
mountit "sysfs" "sys"
mountit "/dev" "dev" "--bind"
if (( $# < 1 )); then
- chroot "$DEST_"
+ shell=$(awk '/^root:/{ split($0,a,":"); print a[7] }' < "$DEST_/etc/passwd")
+ chroot "$DEST_" "$shell"
RC=$?
else
chroot "$DEST_" "$@"