pam_mount/pam_mount-0.45-umount-home-dir.dif

26 lines
760 B
Plaintext

Index: scripts/umount.crypt
===================================================================
--- scripts/umount.crypt.orig
+++ scripts/umount.crypt
@@ -46,6 +46,7 @@ fi;
# ask cryptsetup about the underlying device
#
REALDEVICE=`cryptsetup status "$DMDEVICE" | sed -n '/device/s/[ ]*device:[ ]*//p'`;
+IMGDEVICE=`losetup -a | grep "$REALDEVICE" | awk -F\( '{ print $2 }' | sed 's/)//'`
for ((x = 5; x >= 0; --x)); do
fuser -m "$1" || break;
@@ -73,3 +83,12 @@ if echo "$REALDEVICE" | grep ^/dev/loop
exit 1
fi
fi
+
+if echo "$IMGDEVICE" | grep ^/dev/loop >/dev/null; then
+ losetup -d "$IMGDEVICE";
+ if [ $? -ne 0 ]; then
+ echo "${0##*/}: error removing $IMGDEVICE" >&2
+ exit 1
+ fi
+fi
+