blob: 7eec6e0eef51c6c1a5919494e30ee8dd259b9917 [file] [log] [blame]
Miklos Szerediea18d112005-06-27 13:05:49 +00001#!/bin/bash
2#
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
7#
8
9VERSION="0.0.1"
10PRGNAME=`basename $0`
11
12USAGE="${PRGNAME} version ${VERSION}
13usage: ${PRGNAME} fusefs_type#[mountpath] mountpoint [FUSE options]
14
15 example: ${PRGNAME} sshfs#root@tux:/ /mnt/tuxssh -o rw
16"
17
18function die {
19 echo -e "$PRGNAME# $1" >&2
20 [ -z "$2" ] && exit 128
21 exit "$2"
22}
23
24[ "$#" -ge 2 ] || die "${USAGE}"
25
26FSTYPE=${1%%\#*} # for now i have to be same as FUSE mount binary
27 # should be configurable
28
Miklos Szeredif1941472006-01-02 16:27:48 +000029export PATH
Miklos Szerediea18d112005-06-27 13:05:49 +000030FSBIN=`which ${FSTYPE} 2>/dev/null` \
31 || die "Can not find FUSE mount binary for FS ${FSTYPE}" 1
32
33MOUNTPATH=${1#*#}
34
35# was there an # in $1
36[ "$1" = "$MOUNTPATH" ] && MOUNTPATH=""
37
38MOUNTPOINT="$2"
39[ -d "${MOUNTPOINT}" ] || die "Directory ${MOUNTPOINT} does not exist"
40
41shift
42shift
43
Miklos Szeredib32c79b2006-01-09 11:14:29 +000044ignore_opts="(user|nouser|users|auto|noauto|_netdev)"
45
46OPTIONS=`echo $@ | sed -r "s/(,${ignore_opts}|${ignore_opts},)//g"`
Miklos Szerediea18d112005-06-27 13:05:49 +000047
Miklos Szerediea18d112005-06-27 13:05:49 +000048${FSTYPE} ${MOUNTPATH} ${MOUNTPOINT} ${OPTIONS}