4
# Petr Klima <qaxi@seznam.cz>
5
# Thanks to Miklos Szeredi <miklos@szeredi.hu>
6
# to kick me to the right way
12
if [ -z "$HOME" ]; then
17
USAGE="${PRGNAME} version ${VERSION}
18
usage: ${PRGNAME} fusefs_type#[mountpath] mountpoint [FUSE options]
20
example: ${PRGNAME} sshfs#root@tux:/ /mnt/tuxssh -o rw
24
echo "$PRGNAME# $1" >&2
25
[ -z "$2" ] && exit 128
29
[ "$#" -ge 2 ] || die "${USAGE}"
31
# for now i have to be same as FUSE mount binary
32
# should be configurable
33
eval `echo "$1" | sed -n 's,\(^[^#][^#]*\)\(#\(.*\)\)*,FSTYPE="\1" MOUNTPATH="\3",p'`
36
FSBIN=`which ${FSTYPE} 2>/dev/null` \
37
|| die "Can not find FUSE mount binary for FS ${FSTYPE}" 1
39
# was there an # in $1
40
[ "$1" = "$MOUNTPATH" ] && MOUNTPATH=""
43
[ -d "${MOUNTPOINT}" ] || die "Directory ${MOUNTPOINT} does not exist"
48
# loop over each mount option and skip all that should be ignored
51
OPT=`echo $OPT | sed "s/^\(-o\|user\|nouser\|users\|auto\|noauto\|_netdev\)$/IGNORE/"`
52
if [ "$OPT" == "IGNORE" ]; then continue; fi
53
OPTIONS="$OPTIONS$OPT,"
57
# add "-o " and remove trailing comma
58
OPTIONS="-o `echo $OPTIONS | sed "s/,$//"`"
60
if test -z "$MOUNTPATH"; then
61
"${FSTYPE}" "${MOUNTPOINT}" ${OPTIONS}
63
"${FSTYPE}" "${MOUNTPATH}" "${MOUNTPOINT}" ${OPTIONS}