Browse Source

check if mount point exists prior to the attempt to delete it

Toastie 6 months ago
parent
commit
340198694f
1 changed files with 2 additions and 2 deletions
  1. 2 2
      bootstrap-bookworm.sh

+ 2 - 2
bootstrap-bookworm.sh

@@ -313,8 +313,8 @@ unmount(){
 ! mountpoint -q $mnt/boot/efi || umount $mnt/boot/efi
 ! mountpoint -q $mnt          || umount $mnt
 # Delete mount-point if empty and not mounted
-[ -z "$(ls -A $mnt)"          ] &&  ! mountpoint -q $mnt           && rm -R $mnt
-[ -z "$(ls -A $mnt/boot/efi)" ] &&  ! mountpoint -q $mnt/boot/efi  && rm -R $mnt/boot/efi
+[ -d $mnt ]          && [ -z "$(ls -A $mnt)"          ] &&  ! mountpoint -q $mnt           && rm -R $mnt
+[ -d $mnt/boot/efi ] && [ -z "$(ls -A $mnt/boot/efi)" ] &&  ! mountpoint -q $mnt/boot/efi  && rm -R $mnt/boot/efi
 }