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