make getpeername() return the original socket address which before it was intercepted
[hband-tools.git] / user-tools / override / umount
blob47e7ba66492e531288fc6ada8f9db6091e362ba5
1 #!/bin/bash
3 if [ "$UID" = 0 ]
4 then
5 exec /bin/umount "$@"
6 fi
8 declare -a umount_args
9 declare -a fusermount_args
10 umount_args=()
11 fusermount_args=()
12 prm1=''
14 while [ -n "$1" ]
16 umount_args+=("$1")
17 case "$1" in
18 -l) fusermount_args+=(-z);;
19 -*) true;;
20 *) if [ -z "$prm1" ]
21 then
22 prm1=$1
23 fi;;
24 esac
25 shift
26 done
28 fusermount -u "${fusermount_args[@]}" "$prm1"
29 err=$?
30 if [ $err != 0 ]
31 then
32 echo "trying umount ${umount_args[@]}" >&2
33 /bin/umount "${umount_args[@]}"
34 err=$?
35 if [ $err != 0 ]
36 then
37 echo "Mountpoint is possibly used by:" >&2
38 echo "===============================" >&2
39 #fuser -v "$prm1" >&2
40 lsof -nPw "$prm1" >&2
43 exit $err