blob: ed964cbc7fb6e99c6262ca9488f55b3f47123067 [file] [log] [blame]
Miklos Szeredi4003dfa2006-10-01 13:46:02 +00001#! /bin/sh
2#
3# fuse Init script for Filesystem in Userspace
4#
5# Author: Miklos Szeredi <miklos@szeredi.hu>
6
7set -e
8
9PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
10SCRIPTNAME=/etc/init.d/fuse
11DESC="FUSE"
12MOUNTPOINT=/sys/fs/fuse/connections
13
14# Gracefully exit if the package has been removed.
15test -x `which fusermount` || exit 0
16
17error()
18{
19 echo "Error $1" >&2
20 exit 1
21}
22
23case "$1" in
24 start)
25 echo -n "Starting $DESC: "
26 if ! grep -qw fuse /proc/filesystems; then
27 modprobe fuse >/dev/null 2>&1 || error "loading fuse module"
28 fi
29 if grep -qw fusectl /proc/filesystems && \
30 ! grep -qw $MOUNTPOINT /proc/mounts; then
31 mount -t fusectl none $MOUNTPOINT >/dev/null 2>&1 || \
32 error "mounting control filesystem"
33 fi
34 echo "done."
35 ;;
36 stop)
37 echo -n "Stopping $DESC: "
38 if grep -qw $MOUNTPOINT /proc/mounts; then
39 umount $MOUNTPOINT >/dev/null 2>&1 || \
40 error "unmounting control filesystem"
41 fi
42 if grep -qw "^fuse" /proc/modules; then
43 rmmod fuse >/dev/null 2>&1 || error "unloading fuse module"
44 fi
45 echo "done."
46 ;;
47 *)
48 echo "Usage: $SCRIPTNAME {start|stop}" >&2
49 exit 1
50 ;;
51esac
52
53exit 0