From: Leho Kraav Date: Tue, 24 Jul 2012 12:08:54 +0000 (+0300) Subject: 91crypt-loop: use initqueue for cleanup strategy X-Git-Tag: 023~104 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df68781fca048de2f880be37ab9e1ede9bea5051;p=thirdparty%2Fdracut.git 91crypt-loop: use initqueue for cleanup strategy --- diff --git a/modules.d/90crypt/crypt-lib.sh b/modules.d/90crypt/crypt-lib.sh index 5f7567e35..d5caa8596 100755 --- a/modules.d/90crypt/crypt-lib.sh +++ b/modules.d/90crypt/crypt-lib.sh @@ -188,6 +188,9 @@ readkey() { if [ -f /lib/dracut-crypt-loop-lib.sh ]; then . /lib/dracut-crypt-loop-lib.sh loop_decrypt "$mntp" "$keypath" "$keydev" "$device" + initqueue --onetime --finished --unique --name "crypt-loop-cleanup-99-$(basename $mntp)" \ + $(command -v umount) "$mntp; " $(command -v rmdir) "$mntp" + return 0 else die "No loop file support to decrypt '$keypath' on '$keydev'." fi diff --git a/modules.d/91crypt-loop/crypt-loop-lib.sh b/modules.d/91crypt-loop/crypt-loop-lib.sh index 63a553c26..6774e7d85 100644 --- a/modules.d/91crypt-loop/crypt-loop-lib.sh +++ b/modules.d/91crypt-loop/crypt-loop-lib.sh @@ -32,6 +32,11 @@ loop_decrypt() { --tty-echo-off [ -b $key ] || die "Tried setting it up, but keyfile block device was still not found!" + + initqueue --onetime --finished --unique --name "crypt-loop-cleanup-10-$(basename $key)" \ + $(command -v cryptsetup) "luksClose $key" + initqueue --onetime --finished --unique --name "crypt-loop-cleanup-20-$(basename $loopdev)" \ + $(command -v losetup) "-d $loopdev" else info "Existing keyfile found, re-using it for $device" fi