libfuse: add store request
[fuse.git] / util / init_script
blob331b33addb049de173bbf70712df7a33c3c57e7e
1 #! /bin/sh
2 ### BEGIN INIT INFO
3 # Provides: fuse
4 # Required-Start:
5 # Should-Start: udev
6 # Required-Stop:
7 # Default-Start: S
8 # Default-Stop:
9 # Short-Description: Start and stop fuse.
10 # Description: Load the fuse module and mount the fuse control
11 # filesystem.
12 ### END INIT INFO
14 set -e
16 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
17 MOUNTPOINT=/sys/fs/fuse/connections
19 # Gracefully exit if the package has been removed.
20 which fusermount &>/dev/null || exit 5
22 case "$1" in
23 start|restart|force-reload)
24 if ! grep -qw fuse /proc/filesystems; then
25 echo -n "Loading fuse module"
26 if ! modprobe fuse >/dev/null 2>&1; then
27 echo " failed!"
28 exit 1
29 else
30 echo "."
32 else
33 echo "Fuse filesystem already available."
35 if grep -qw fusectl /proc/filesystems && \
36 ! grep -qw $MOUNTPOINT /proc/mounts; then
37 echo -n "Mounting fuse control filesystem"
38 if ! mount -t fusectl fusectl $MOUNTPOINT >/dev/null 2>&1; then
39 echo " failed!"
40 exit 1
41 else
42 echo "."
44 else
45 echo "Fuse control filesystem already available."
48 stop)
49 if ! grep -qw fuse /proc/filesystems; then
50 echo "Fuse filesystem not loaded."
51 exit 7
53 if grep -qw $MOUNTPOINT /proc/mounts; then
54 echo -n "Unmounting fuse control filesystem"
55 if ! umount $MOUNTPOINT >/dev/null 2>&1; then
56 echo " failed!"
57 else
58 echo "."
60 else
61 echo "Fuse control filesystem not mounted."
63 if grep -qw "^fuse" /proc/modules; then
64 echo -n "Unloading fuse module"
65 if ! rmmod fuse >/dev/null 2>&1; then
66 echo " failed!"
67 else
68 echo "."
70 else
71 echo "Fuse module not loaded."
74 status)
75 echo -n "Checking fuse filesystem"
76 if ! grep -qw fuse /proc/filesystems; then
77 echo " not available."
78 exit 3
79 else
80 echo " ok."
84 echo "Usage: $0 {start|stop|restart|force-reload|status}"
85 exit 1
87 esac
89 exit 0