From 4c9bb36d3368a114bdef573d7f05bf4d777d7057 Mon Sep 17 00:00:00 2001 From: druckdev Date: Sun, 30 Jan 2022 00:34:50 +0100 Subject: [PATCH] zsh:funcs:crypt-umount: Fix `$mount_point` Get `$mount_point` before unmounting making it then disappear naturally. --- .config/zsh/zshrc.d/40-functions.zsh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.config/zsh/zshrc.d/40-functions.zsh b/.config/zsh/zshrc.d/40-functions.zsh index a6fa094..8b2da87 100644 --- a/.config/zsh/zshrc.d/40-functions.zsh +++ b/.config/zsh/zshrc.d/40-functions.zsh @@ -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" }