free attached loop devices

pull/5/head
Tomas M 2012-10-12 20:18:54 -05:00
parent 141d6d6b75
commit 4aa6efead7
1 changed files with 4 additions and 0 deletions

View File

@ -64,6 +64,10 @@ if [ "$1" = "--init" ]; then
setsid sh -c 'exec sh < /dev/tty1 >/dev/tty1 2>&1' setsid sh -c 'exec sh < /dev/tty1 >/dev/tty1 2>&1'
fi fi
# make sure to detach loop devices which can be detached at this moment,
# else they would block unmounting later.
losetup | cut -d : -f 1 | xargs -n 1 losetup -d
# next, unmount everything from union, backwards # next, unmount everything from union, backwards
tac /proc/mounts | grep union | cut -d " " -f 2 | while read LINE; do tac /proc/mounts | grep union | cut -d " " -f 2 | while read LINE; do
umount $LINE >/dev/console 2>&1 umount $LINE >/dev/console 2>&1