fuse/fuse-initscript

84 lines
2.0 KiB
Bash

#! /bin/sh
#
# fuse -- Init script for Filesystem in Userspace
#
# chkconfig: 345 26 76
# description: Filesystem in Userspace
#
# Copyright (c) 2007 by Stefano Cotta Ramusino <stefano.cotta@openmamba.org>
. /etc/sysconfig/rc
. $rc_functions
NAME=fuse
LOCKFILE=/var/lock/subsys/$NAME
MOUNTPOINT=/sys/fs/$NAME/connections
[ -x /usr/bin/fusermount ] || exit 0
# See how we were called.
case "$1" in
start)
echo -n $"Starting $NAME: "
if ! grep -qw fuse /proc/filesystems; then
modprobe fuse >/dev/null 2>&1
fi
if grep -qw fusectl /proc/filesystems && \
! grep -qw $MOUNTPOINT /proc/mounts; then
mount -t fusectl none $MOUNTPOINT >/dev/null 2>&1
fi
evaluate_retval
[ $? -eq 0 ] && touch $LOCKFILE
echo
;;
stop)
echo -n $"Stopping $NAME: "
if grep -qw $MOUNTPOINT /proc/mounts; then
umount $MOUNTPOINT >/dev/null 2>&1
fi
if grep -qw "^fuse" /proc/modules; then
rmmod fuse >/dev/null 2>&1
fi
evaluate_retval
[ $? -eq 0 ] && rm -f $LOCKFILE
echo
;;
restart)
$0 stop
$0 start
;;
condstop)
[ -e $LOCKFILE ] && $0 stop || :
;;
condrestart)
[ -e $LOCKFILE ] && $0 restart || :
;;
status)
if [ -e $LOCKFILE ]; then
echo $"$NAME is running"
else
echo $"$NAME is not running"
fi
if grep -qw fuse /proc/filesystems; then
echo $"$NAME filesystem is supported"
else
echo $"$NAME filesystem is not supported"
fi
if grep -qw fusectl /proc/filesystems; then
echo $"fusectl filesystem is supported"
else
echo $"fusectl filesystem is not supported"
fi
if grep -qw $MOUNTPOINT /proc/mounts; then
echo $"mount point $MOUNTPOINT exists"
else
echo $"mount point $MOUNTPOINT does not exist"
fi
;;
*)
echo $"Usage: ""$0 {start|stop|status|restart|condstop|condrestart}"
exit 1
esac
: