aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorGravatar Miklos Szeredi <miklos@szeredi.hu>2005-06-27 13:05:49 +0000
committerGravatar Miklos Szeredi <miklos@szeredi.hu>2005-06-27 13:05:49 +0000
commitea18d11c3a563afa2ce68c5d056575a3db445500 (patch)
treec43117ef34e88836112b9caf5f106de91bcab8d3 /util
parent129ef8f625a538a03444e2cce269c6eea03d50af (diff)
added mount.fuse by Petr Klima
Diffstat (limited to 'util')
-rw-r--r--util/mount.fuse49
1 files changed, 49 insertions, 0 deletions
diff --git a/util/mount.fuse b/util/mount.fuse
new file mode 100644
index 0000000..a81e5bc
--- /dev/null
+++ b/util/mount.fuse
@@ -0,0 +1,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="$@"
+
+export PATH
+${FSTYPE} ${MOUNTPATH} ${MOUNTPOINT} ${OPTIONS}
+
+
+