Re: [PATCH 4/4] 91crypt-loop: use initqueue for cleanup strategy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Excerpts from Leho Kraav's message of 2011-08-30 15:36:31 +0200:
> ---
>  modules.d/90crypt/crypt-lib.sh           |    3 +++
>  modules.d/91crypt-loop/crypt-loop-lib.sh |    5 +++++
>  2 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/modules.d/90crypt/crypt-lib.sh b/modules.d/90crypt/crypt-lib.sh
> index b04512f..3095774 100755
> --- a/modules.d/90crypt/crypt-lib.sh
> +++ b/modules.d/90crypt/crypt-lib.sh
> @@ -225,6 +225,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 63a553c..6774e7d 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

Always a bit better to use built-ins:

basename "$x" == echo "${x#**/}"


-- 
Amadeusz Żołnowski

PGP key fpr: C700 CEDE 0C18 212E 49DA  4653 F013 4531 E1DB FAB5

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux