zsh:funcs:crypt-umount: Define $name variable

This commit is contained in:
2022-01-29 23:36:35 +01:00
parent cb7263e77d
commit f37afc9400

View File

@@ -272,15 +272,17 @@ crypt-umount() {
[[ -e "$1" ]] || return 1 [[ -e "$1" ]] || return 1
sync sync
local name=crypt_"${1##*/}"
if if
mount | grep -q /dev/mapper/crypt_"${1##*/}" \ mount | grep -q /dev/mapper/"$name" \
&& ! udisksctl unmount -b /dev/mapper/crypt_"${1##*/}" && ! udisksctl unmount -b /dev/mapper/"$name"
then then
lsof /dev/mapper/crypt_"${1##*/}" lsof /dev/mapper/"$name"
return 1 return 1
fi fi
if ! sudo cryptsetup close crypt_"${1##*/}"; then if ! sudo cryptsetup close "$name"; then
sudo cryptsetup status crypt_"${1##*/}" sudo cryptsetup status "$name"
return 1 return 1
fi fi
udisksctl power-off -b "$1" udisksctl power-off -b "$1"