From f992b13b0e020e75dd4d6592f8d18f0ccafe9e5f Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Tue, 10 Mar 2015 14:49:41 +0100 Subject: [PATCH] Do not stop hosts' SSH + mdadm services in cleanup procedure The init script uses start-stop-daemon with the pidfile /var/run/sshd.pid. We can't just stop the service from outside the chroot because this terminates the process of the host system instead of the process *inside* the chroot. Thanks: Sebastian Pipping for debugging and bug report Fixes #63 (GH-37, PR 71) --- grml-debootstrap | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/grml-debootstrap b/grml-debootstrap index a97f5ec..739fd86 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -205,8 +205,11 @@ cleanup() { if [ -n "$MNTPOINT" ] ; then if grep -q "$MNTPOINT" /proc/mounts ; then # make sure nothing is left inside chroot so we can unmount it - [ -x "$MNTPOINT"/etc/init.d/ssh ] && "$MNTPOINT"/etc/init.d/ssh stop - [ -x "$MNTPOINT"/etc/init.d/mdadm ] && "$MNTPOINT"/etc/init.d/mdadm stop + for service in ssh mdadm ; do + if [ -x "${MNTPOINT}/etc/init.d/${service}" ] ; then + chroot "$MNTPOINT" "/etc/init.d/${service}" stop + fi + done [ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount -a >/dev/null 2>&1 -- 2.1.4