fuse/boot.fuse

75 lines
1.6 KiB
Bash

#! /bin/sh
### BEGIN INIT INFO
# Provides: boot.fuse
# Required-Start:
# Should-Start: boot.udev $local_fs
# Required-Stop:
# Default-Start: B
# Default-Stop:
# Short-Description: Start and stop fuse.
# Description: Load the fuse module and mount the fuse control
# filesystem.
### END INIT INFO
PATH="/sbin:/bin"
MOUNTPOINT=/sys/fs/fuse/connections
. /etc/rc.status
case "$1" in
start|restart|force-reload)
if ! grep -qw fuse /proc/filesystems; then
echo -n "Loading fuse module "
if ! modprobe fuse >/dev/null 2>&1; then
rc_status -v
rc_exit
fi
else
echo -n "Fuse filesystem already available"
fi
rc_status -v
if grep -qw fusectl /proc/filesystems && \
! grep -qw $MOUNTPOINT /proc/mounts; then
echo -n "Mounting fuse control filesystem"
mount -t fusectl fusectl $MOUNTPOINT >/dev/null 2>&1
else
echo -n "Fuse control filesystem already available"
fi
rc_status -v
;;
stop)
if ! grep -qw fuse /proc/filesystems; then
echo -n "Fuse filesystem not loaded"
rc_failed 7
rc_status -v
rc_exit
fi
if grep -qw $MOUNTPOINT /proc/mounts; then
echo -n "Unmounting fuse control filesystem"
umount $MOUNTPOINT >/dev/null 2>&1
else
echo -n "Fuse control filesystem not mounted"
fi
rc_status -v
;;
reload)
echo -n "Reloading fuse filesystem"
rc_failed 3
rc_status -v
;;
status)
echo -n "Checking fuse filesystem"
rc_reset
if ! grep -qw fuse /proc/filesystems; then
rc_failed 3
fi
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|restart|reload|force-reload|status}"
exit 1
;;
esac
rc_exit