diff options
author | Jakob Unterwurzacher | 2017-02-15 23:02:01 +0100 |
---|---|---|
committer | Jakob Unterwurzacher | 2017-02-15 23:02:01 +0100 |
commit | ce2e610428c940c2bd5ca1790e7375117b1f6015 (patch) | |
tree | 08563c5e36b8d285390f897cd122e7e1aa8f6fc4 /tests/fuse-unmount.bash | |
parent | 6be7808992a1d9562b113b13831cd6d6a40114d6 (diff) |
OSX compat: replace fusermount calls with fuse-unmount.bash
Mac OS X does not have fusermount and uses umount instead.
The fuse-unmount.bash calls the appropriate command.
Diffstat (limited to 'tests/fuse-unmount.bash')
-rwxr-xr-x | tests/fuse-unmount.bash | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/fuse-unmount.bash b/tests/fuse-unmount.bash new file mode 100755 index 0000000..087b6fe --- /dev/null +++ b/tests/fuse-unmount.bash @@ -0,0 +1,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 |