From d0d52e5940b21fccec06d3e2707bfcc529ed7f28 Mon Sep 17 00:00:00 2001 From: Christian Hofstaedtler Date: Mon, 6 Dec 2010 18:35:50 +0100 Subject: [PATCH] grml-chroot: use shell of target's root user 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. --- doc/grml-chroot.8.txt | 2 ++ usr_sbin/grml-chroot | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/grml-chroot.8.txt b/doc/grml-chroot.8.txt index 2c6ec0d..659ab44 100644 --- a/doc/grml-chroot.8.txt +++ b/doc/grml-chroot.8.txt @@ -19,6 +19,8 @@ DESCRIPTION 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 ------- diff --git a/usr_sbin/grml-chroot b/usr_sbin/grml-chroot index b3d1184..bdd6bc9 100755 --- a/usr_sbin/grml-chroot +++ b/usr_sbin/grml-chroot @@ -89,7 +89,8 @@ mountit "proc" "proc" 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_" "$@" -- 2.1.4