umount without sleep, as umount -l detaches inmediately

This commit is contained in:
Alberto Salvia Novella 2024-02-16 18:14:23 +01:00
parent 46a69d58e7
commit c2065454b4

16
common
View File

@ -39,22 +39,10 @@ chroot_setup() {
chroot_teardown() {
if (( ${#CHROOT_ACTIVE_MOUNTS[@]} )); then
local mount
local attempt
umount -l "${CHROOT_ACTIVE_MOUNTS[@]}"
for mount in "${CHROOT_ACTIVE_MOUNTS[@]}"; do
attempt=1
while grep --quiet "${mount}" "/proc/mounts" && [[ "${attempt}" -le 50 ]]; do
sleep 0.1
attempt="$((attempt + 1))"
done
done
unset CHROOT_ACTIVE_MOUNTS
fi
unset CHROOT_ACTIVE_MOUNTS
}
chroot_add_mount_lazy() {