blob: 087b6fefd9f01e8a005c0a5bbe357a8f6818a208 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#!/bin/bash -eu
#
# Compatability wrapper around "fusermount" on Linux and "umount" on
# Mac OS X and friends.
#
# This script can be sourced or executed directly.
#
function fuse-unmount {
local MYNAME=$(basename "$BASH_SOURCE")
if [[ $# -eq 0 ]] ; then
echo "$MYNAME: missing argument"
exit 1
fi
if [[ $OSTYPE == linux* ]] ; then
fusermount -u "$@"
else
# Mountpoint is in last argument, ignore anything else
# (like additional flags for fusermount).
local MNT=${@:$#}
umount "$MNT"
fi
}
# If the process name and the source file name is identical
# we have been executed, not sourced.
if [[ $(basename "$0") == $(basename "$BASH_SOURCE") ]] ; then
fuse-unmount "$@"
fi
|