2017-02-15 23:02:01 +01:00
|
|
|
#!/bin/bash -eu
|
|
|
|
#
|
2018-12-27 12:03:00 +01:00
|
|
|
# Compatibility wrapper around "fusermount" on Linux and "umount" on
|
2017-02-15 23:02:01 +01:00
|
|
|
# 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
|