~ubuntu-branches/ubuntu/hardy/fuse/hardy-security

« back to all changes in this revision

Viewing changes to util/mount.fuse

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2007-08-04 08:09:00 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20070804080900-m1e9xpk5eitzmelg
Tags: 2.7.0-1ubuntu1
* Resynchronise with Debian (LP: #128292). Remaining changes:
  - Don't install the init script; install the udev rule and the module
    configuration file instead.
  - debian/45-fuse.rules: set /dev/fuse group to fuse.
  - debian/fuse-utils.modprobe: module configuration file that mounts the
    control filesystem when fuse is loaded and unmounts it when fuse is
    unloaded, along with checking that the control FS is mounting before
    unmounting it.
  - debian/fuse-utils.install: add the udev rule, the module configuration
    file, and ulockmgr_server.
  - Load fuse on install, and set it so it gets loaded on reboot.
  - Move fusermount and ulockmgr_server to /bin and associated libraries
    to /lib.
* Use dpkg-query to fetch conffile md5sums rather than parsing
  /var/lib/dpkg/status directly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
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
 
 
9
 
VERSION="0.0.2"
10
 
PRGNAME=`basename $0`
11
 
 
12
 
if [ -z "$HOME" ]; then
13
 
    HOME=/root
14
 
fi
15
 
export HOME
16
 
 
17
 
USAGE="${PRGNAME} version ${VERSION}
18
 
usage: ${PRGNAME} fusefs_type#[mountpath] mountpoint [FUSE options]
19
 
 
20
 
        example: ${PRGNAME} sshfs#root@tux:/ /mnt/tuxssh -o rw
21
 
"
22
 
 
23
 
die() {
24
 
        echo "$PRGNAME# $1" >&2
25
 
        [ -z "$2" ] && exit 128
26
 
        exit "$2"
27
 
}
28
 
 
29
 
[ "$#" -ge 2 ] || die "${USAGE}"
30
 
 
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'`
34
 
 
35
 
export PATH
36
 
FSBIN=`which ${FSTYPE} 2>/dev/null` \
37
 
        || die "Can not find FUSE mount binary for FS ${FSTYPE}" 1
38
 
 
39
 
# was there an # in $1
40
 
[ "$1" = "$MOUNTPATH" ] && MOUNTPATH=""
41
 
 
42
 
MOUNTPOINT="$2"
43
 
[ -d "${MOUNTPOINT}" ] || die "Directory ${MOUNTPOINT} does not exist"
44
 
 
45
 
shift
46
 
shift
47
 
 
48
 
# loop over each mount option and skip all that should be ignored
49
 
IFS=","
50
 
for OPT in $@; do
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,"
54
 
done
55
 
IFS=" "
56
 
 
57
 
# add "-o " and remove trailing comma
58
 
OPTIONS="-o `echo $OPTIONS | sed "s/,$//"`"
59
 
 
60
 
if test -z "$MOUNTPATH"; then
61
 
    "${FSTYPE}" "${MOUNTPOINT}" ${OPTIONS}
62
 
else
63
 
    "${FSTYPE}" "${MOUNTPATH}" "${MOUNTPOINT}" ${OPTIONS}
64
 
fi