diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2006-10-01 13:46:02 +0000 |
---|---|---|
committer | Miklos Szeredi <miklos@szeredi.hu> | 2006-10-01 13:46:02 +0000 |
commit | 4003dfa31341e5584375c1423d223f099a6049c7 (patch) | |
tree | 7cd8a42bc1666788a7f2c8b29265a4f8b7c585e1 /util/init_script | |
parent | 0740785ee4ecd3edf07b0f311017ea00cb63698b (diff) |
Add init script
Diffstat (limited to 'util/init_script')
-rwxr-xr-x | util/init_script | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/util/init_script b/util/init_script new file mode 100755 index 0000000..ed964cb --- /dev/null +++ b/util/init_script @@ -0,0 +1,53 @@ +#! /bin/sh +# +# fuse Init script for Filesystem in Userspace +# +# Author: Miklos Szeredi <miklos@szeredi.hu> + +set -e + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +SCRIPTNAME=/etc/init.d/fuse +DESC="FUSE" +MOUNTPOINT=/sys/fs/fuse/connections + +# Gracefully exit if the package has been removed. +test -x `which fusermount` || exit 0 + +error() +{ + echo "Error $1" >&2 + exit 1 +} + +case "$1" in + start) + echo -n "Starting $DESC: " + if ! grep -qw fuse /proc/filesystems; then + modprobe fuse >/dev/null 2>&1 || error "loading fuse module" + fi + if grep -qw fusectl /proc/filesystems && \ + ! grep -qw $MOUNTPOINT /proc/mounts; then + mount -t fusectl none $MOUNTPOINT >/dev/null 2>&1 || \ + error "mounting control filesystem" + fi + echo "done." + ;; + stop) + echo -n "Stopping $DESC: " + if grep -qw $MOUNTPOINT /proc/mounts; then + umount $MOUNTPOINT >/dev/null 2>&1 || \ + error "unmounting control filesystem" + fi + if grep -qw "^fuse" /proc/modules; then + rmmod fuse >/dev/null 2>&1 || error "unloading fuse module" + fi + echo "done." + ;; + *) + echo "Usage: $SCRIPTNAME {start|stop}" >&2 + exit 1 + ;; +esac + +exit 0 |