X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=usr_sbin%2Fgrml-chroot;h=17f3d3c234905d1e20190eaa1811acd78679bc99;hb=268a5ea6bbd52622bd5d20e176395c8c6094b68c;hp=b3d118487a399f0cc277229aed2fe91ae62460a7;hpb=3b069a494fe989e75be26e5bc50efd8bb35d3109;p=grml-scripts.git diff --git a/usr_sbin/grml-chroot b/usr_sbin/grml-chroot index b3d1184..17f3d3c 100755 --- a/usr_sbin/grml-chroot +++ b/usr_sbin/grml-chroot @@ -45,8 +45,8 @@ function mountit local all_options_="" - if [[ $options_ == "--bind" ]]; then - all_options_="--bind $type_" + if [[ $options_ == "--rbind" ]]; then + all_options_="--rbind $type_" else all_options_="-t $type_ none" fi @@ -56,7 +56,7 @@ function mountit function umount_all { for i in $MOUNTED_; do - umount "${DEST_}/$i" + umount --recursive "${DEST_}/$i" done } @@ -87,7 +87,15 @@ fi mountit "proc" "proc" mountit "sysfs" "sys" -mountit "/dev" "dev" "--bind" +mountit "/dev" "dev" "--rbind" + +WROTE_DEBIAN_CHROOT="" +if [ ! -f "$DEST_"/etc/debian_chroot ]; then + WROTE_DEBIAN_CHROOT="yes" + echo "Writing /etc/debian_chroot ..." + cat "$DEST_"/etc/hostname > "$DEST_"/etc/debian_chroot +fi + if (( $# < 1 )); then chroot "$DEST_" RC=$? @@ -97,4 +105,8 @@ else fi umount_all +if [ ! -z "$WROTE_DEBIAN_CHROOT" ]; then + rm "$DEST_"/etc/debian_chroot +fi + exit $RC