]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
crypt-loop: cleanup cleanup procedures 260/head
authorHarald Hoyer <harald@redhat.com>
Fri, 28 Jul 2017 08:43:39 +0000 (10:43 +0200)
committerHarald Hoyer <harald@redhat.com>
Fri, 28 Jul 2017 08:43:39 +0000 (10:43 +0200)
Using initqueue --finished to cleanup stuff is not what the
initqueue/finished hook was meant for.

Move stuff to the real cleanup hook.

modules.d/90crypt/crypt-lib.sh
modules.d/91crypt-loop/crypt-loop-lib.sh

index 9a5a3e30007c02a6ee0b3cc5502f747db42dc617..90b681e4910fae125327183d060df686642b4d8e 100755 (executable)
@@ -218,8 +218,7 @@ 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-${mntp##*/}" \
-                    $(command -v umount) "$mntp; " $(command -v rmdir) "$mntp"
+                printf "%s\n" "umount \"$mntp\"; rmdir \"$mntp\";" > ${hookdir}/cleanup/"crypt-loop-cleanup-99-${mntp##*/}".sh
                 return 0
             else
                 die "No loop file support to decrypt '$keypath' on '$keydev'."
index fcaa44bf158a95c1a3c1cb1914b0da0465185562..dc9d24b58d95ce7cdc2680f9b5798844b68dfe15 100755 (executable)
@@ -29,10 +29,8 @@ loop_decrypt() {
 
         [ -b $key ] || die "Failed to unlock $keypath on $keydev for $device."
 
-        initqueue --onetime --finished --unique --name "crypt-loop-cleanup-10-${key##*/}" \
-            $(command -v cryptsetup) "luksClose $key"
-        initqueue --onetime --finished --unique --name "crypt-loop-cleanup-20-${loopdev##*/}" \
-            $(command -v losetup) "-d $loopdev"
+        printf "%s\n" "cryptsetup luksClose \"$key\"" > ${hookdir}/cleanup/"crypt-loop-cleanup-10-${key##*/}".sh
+        printf "%s\n" "losetup -d \"$loopdev\"" > ${hookdir}/cleanup/"crypt-loop-cleanup-20-${loopdev##*/}".sh
     fi
 
     cat $key