functions: Use recursize umount

This commit is contained in:
timoxa0 2024-11-03 14:09:50 +05:00
parent 7f5f41575e
commit 3719046056

View file

@ -27,7 +27,7 @@ umount_if_mouted()
{ {
[ ! -d "$1" ] && return 1 [ ! -d "$1" ] && return 1
if grep -qs "$(realpath "$1")" /proc/mounts; then if grep -qs "$(realpath "$1")" /proc/mounts; then
umount "$1" umount -R "$1"
return $? return $?
else else
return 0 return 0
@ -38,7 +38,7 @@ umount_force()
{ {
[ ! -d "$1" ] && return 1 [ ! -d "$1" ] && return 1
for run in {1..5}; do for run in {1..5}; do
umount_if_mouted "$1" && break umount -R "$1" && break
log "Failed to umount $1. Trying again after 3 seconds" ierror log "Failed to umount $1. Trying again after 3 seconds" ierror
sleep 3 sleep 3
done done