integrate-distro.sh: Trying to find and kill processes blocking chroot unmount

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2016-11-21 17:49:34 +00:00
commit 2e3fba5792

View file

@ -818,12 +818,26 @@ mount_devices()
}
}
kill_chroot_processes()
{
local pids=`ls -l /proc/*/root | grep $root | sed "s%.* /proc/\([0-9]\+\)/.*%\1%"`
local wait
local p
for p in $pids; do
echo "killing process $pid (`strings /proc/$p/cmdline | sed ':a;N;$!ba;s/\n/ /g'`)"
kill $p
wait=1
done
[ wait = 1 ] && sleep 1
}
unmount_devices()
{
local devices="$ssh_auth_sock /srv/ftp /proc/fs/nfsd /proc /sys /dev /boot /"
[ "$1" ] && devices="$@"
local sync=/usr/bin/sync
[ -x $root/$sync ] || sync=""
kill_chroot_processes
local d
for d in $devices; do
check_mount $d && {