diff --git a/tomb b/tomb index 7b87e50..06cb40b 100755 --- a/tomb +++ b/tomb @@ -2942,22 +2942,18 @@ umount_tomb() { # posing a security risk. # See https://github.com/dyne/Tomb/issues/273 - # checking for tombs - mount | grep -w "$tombmount" >/dev/null - mount_status=$? - # return value of 0 for grep means it found at least one entry - # return value of 1 means nothing was found, implying, the tomb - # mount was already umounted. - if [ $mount_status = 0 ]; then - # Tomb was not umounted through the above command - # Will do so now - _verbose "Performing umount of ::1 mount point::" $tombmount - _sudo umount ${tombmount} - [[ $? = 0 ]] || { _failure "Tomb is busy, cannot umount!" } - else - # Tomb was already umounted, will not do it again - _warning "Tomb was already umounted, possibly through a binded directory" - fi + # checking for tombs still mounted + mounted_tombs=(`list_tomb_mounts`) + for t in ${mounted_tombs}; do + usedmount=${t[(ws:;:)2]} + [[ "$usedmount" == "$tombmount" ]] && { + # Tomb was not umounted through the above command + # Will do so now + _verbose "Performing umount of ::1 mount point::" $tombmount + _sudo umount ${tombmount} + [[ $? = 0 ]] || { _failure "Tomb is busy, cannot umount!" } + } + done # If we used a default mountpoint and is now empty, delete it tombname_regex=${tombname//\[/}