From 29ff943b7dcc489ba6e6b8d12936390e77270a39 Mon Sep 17 00:00:00 2001 From: Zeev Diukman Date: Sun, 18 Jan 2026 08:57:16 +0200 Subject: [PATCH] refactor: Reorder /mnt unmount logic to execute earlier in the script. --- z.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/z.sh b/z.sh index 273d812..b1f03a9 100755 --- a/z.sh +++ b/z.sh @@ -104,6 +104,11 @@ if [[ "$response" != "yes" && "$response" != "y" && "$response" != "Y" && "$resp echo "Aborting." exit 1 fi +if mountpoint -q /mnt; then + echo "/mnt is already mounted. Unmounting..." + umount -R /mnt +fi + if [[ "$response" == "skip" ]]; then echo "Skipping formatting" else @@ -115,10 +120,6 @@ fi -if mountpoint -q /mnt; then - echo "/mnt is already mounted. Unmounting..." - umount -R /mnt -fi mount -o subvol=/ "$seed_device" /mnt # if subvolume @ exists remove and create new one