FIX (tries) #77: slam wasn't slamming

That's because fuser behaves differently on debian.
(Why, debian, why???)
This commit is contained in:
boyska 2012-02-02 00:31:44 +01:00
parent 86fc6e67a8
commit d57994fcc3
2 changed files with 21 additions and 5 deletions

1
.gitignore vendored
View File

@ -28,3 +28,4 @@ tags
doc/web/public doc/web/public
doc/web/dyne doc/web/dyne
share/gtkrc share/gtkrc
.*.sw?

View File

@ -949,9 +949,25 @@ mount_tomb() {
# Kill all processes using the tomb # Kill all processes using the tomb
slam_tomb() { slam_tomb() {
# $1 = tomb mount point # $1 = tomb mount point
for s in INT TERM HUP KILL; do if [[ -z `fuser -m "$1" 2> /dev/null` ]]; then
fuser -s -m "$1" || return 0 return 0
fuser -s -m "$1" -k -M -$s && { option_is_set -f || sleep 3 } fi
#Note: shells are NOT killed by INT or TERM, but they are killed by HUP
for s in TERM HUP KILL; do
xxx "Sending $s to processes inside the tomb:"
if option_is_set -D; then
ps -fp `fuser -m /media/a.tomb 2> /dev/null`|
while read line; do
xxx $line
done
fi
fuser -s -m "$1" -k -M -$s
if [[ -z `fuser -m "$1" 2> /dev/null` ]]; then
return 0
fi
if ! option_is_set -f; then
sleep 3
fi
done done
return 1 return 1
} }
@ -1030,8 +1046,7 @@ umount_tomb() {
if [ $SLAM ]; then if [ $SLAM ]; then
_success "Slamming tomb $tombname mounted on $tombmount" _success "Slamming tomb $tombname mounted on $tombmount"
_message "Kill all processes busy inside the tomb" _message "Kill all processes busy inside the tomb"
slam_tomb "$tombmount" if ! slam_tomb "$tombmount"; then
if [[ $? == 1 ]]; then
_warning "Cannot slam the tomb $tombname" _warning "Cannot slam the tomb $tombname"
return 1 return 1
fi fi