From 563466c88768272ba4df30214b6bf6760382ce8e Mon Sep 17 00:00:00 2001 From: timoxa0 Date: Sun, 11 Aug 2024 16:00:00 +0500 Subject: [PATCH] Refactor cleanup.sh --- cleanup.sh | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/cleanup.sh b/cleanup.sh index 5b68eb6..66ef80c 100755 --- a/cleanup.sh +++ b/cleanup.sh @@ -8,16 +8,19 @@ fi source common.sh +# Begin script + # shellcheck disable=SC2162 -if find ./tmp/ -mindepth 1 -maxdepth 1 | read; then - for d in ./tmp/*/; do - log "Unmounting $d" - detach_chroot "$d" - umount "$d/boot/simpleinit" 2> /dev/null - umount "$d/boot/efi" 2> /dev/null - umount ./tmp/tmp.* 2> /dev/null - rm -d "$d" - done -else +find ./tmp/ -mindepth 1 -maxdepth 1 | read || { log_err "Nothing to clean" -fi \ No newline at end of file + exit 1 +} + +for d in ./tmp/*/; do + log "Unmounting $d" + detach_chroot "$d" + umount "$d/boot/simpleinit" 2> /dev/null + umount "$d/boot/efi" 2> /dev/null + umount ./tmp/tmp.* 2> /dev/null + rm -d "$d" +done \ No newline at end of file