Refactor cleanup.sh

This commit is contained in:
timoxa0 2024-08-11 16:00:00 +05:00
parent f9a39959cb
commit 563466c887

View file

@ -8,8 +8,14 @@ fi
source common.sh
# Begin script
# shellcheck disable=SC2162
if find ./tmp/ -mindepth 1 -maxdepth 1 | read; then
find ./tmp/ -mindepth 1 -maxdepth 1 | read || {
log_err "Nothing to clean"
exit 1
}
for d in ./tmp/*/; do
log "Unmounting $d"
detach_chroot "$d"
@ -18,6 +24,3 @@ if find ./tmp/ -mindepth 1 -maxdepth 1 | read; then
umount ./tmp/tmp.* 2> /dev/null
rm -d "$d"
done
else
log_err "Nothing to clean"
fi