zsh:funcs:crypt-umount: Fix $mount_point

Get `$mount_point` before unmounting making it then disappear naturally.
This commit is contained in:
2022-01-30 00:34:50 +01:00
parent 4623688fa8
commit 4c9bb36d33

View File

@@ -286,6 +286,11 @@ crypt-umount() {
local name mount_point
name=crypt_"${1##*/}"
mount_point="$(
findmnt -lo SOURCE,TARGET \
| grep -F /dev/mapper/"$name" \
| awk '{ print $2; }'
)"
if
mount | grep -q /dev/mapper/"$name" \
@@ -300,11 +305,6 @@ crypt-umount() {
fi
udisksctl power-off -b "$1"
mount_point="$(
findmnt -lo SOURCE,TARGET \
| grep -F /dev/mapper/"$name" \
| awk '{ print $2; }'
)"
rm ~/mounts/"${mount_point:t}" && rmdir --ignore-fail-on-non-empty ~/mounts/ \
|| echo "~/mounts/${mount_point:t} did not exist"
}