fix
[fuse.git] / util / mount.fuse
blob7eec6e0eef51c6c1a5919494e30ee8dd259b9917
1 #!/bin/bash
3 # FUSE mount helper
4 # Petr Klima <qaxi@seznam.cz>
5 # Thanks to Miklos Szeredi <miklos@szeredi.hu>
6 # to kick me to the right way
9 VERSION="0.0.1"
10 PRGNAME=`basename $0`
12 USAGE="${PRGNAME} version ${VERSION}
13 usage: ${PRGNAME} fusefs_type#[mountpath] mountpoint [FUSE options]
15 example: ${PRGNAME} sshfs#root@tux:/ /mnt/tuxssh -o rw
18 function die {
19 echo -e "$PRGNAME# $1" >&2
20 [ -z "$2" ] && exit 128
21 exit "$2"
24 [ "$#" -ge 2 ] || die "${USAGE}"
26 FSTYPE=${1%%\#*} # for now i have to be same as FUSE mount binary
27 # should be configurable
29 export PATH
30 FSBIN=`which ${FSTYPE} 2>/dev/null` \
31 || die "Can not find FUSE mount binary for FS ${FSTYPE}" 1
33 MOUNTPATH=${1#*#}
35 # was there an # in $1
36 [ "$1" = "$MOUNTPATH" ] && MOUNTPATH=""
38 MOUNTPOINT="$2"
39 [ -d "${MOUNTPOINT}" ] || die "Directory ${MOUNTPOINT} does not exist"
41 shift
42 shift
44 ignore_opts="(user|nouser|users|auto|noauto|_netdev)"
46 OPTIONS=`echo $@ | sed -r "s/(,${ignore_opts}|${ignore_opts},)//g"`
48 ${FSTYPE} ${MOUNTPATH} ${MOUNTPOINT} ${OPTIONS}