Refactor cleanup.sh
This commit is contained in:
parent
f9a39959cb
commit
563466c887
11
cleanup.sh
11
cleanup.sh
|
@ -8,8 +8,14 @@ fi
|
||||||
|
|
||||||
source common.sh
|
source common.sh
|
||||||
|
|
||||||
|
# Begin script
|
||||||
|
|
||||||
# shellcheck disable=SC2162
|
# 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
|
for d in ./tmp/*/; do
|
||||||
log "Unmounting $d"
|
log "Unmounting $d"
|
||||||
detach_chroot "$d"
|
detach_chroot "$d"
|
||||||
|
@ -18,6 +24,3 @@ if find ./tmp/ -mindepth 1 -maxdepth 1 | read; then
|
||||||
umount ./tmp/tmp.* 2> /dev/null
|
umount ./tmp/tmp.* 2> /dev/null
|
||||||
rm -d "$d"
|
rm -d "$d"
|
||||||
done
|
done
|
||||||
else
|
|
||||||
log_err "Nothing to clean"
|
|
||||||
fi
|
|
Loading…
Reference in a new issue