"Fossies" - the Fresh Open Source Software Archive

Member "fuse-3.2.3/util/init_script" (11 May 2018, 1894 Bytes) of package /linux/misc/fuse-3.2.3.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    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
   13 
   14 set -e
   15 
   16 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
   17 MOUNTPOINT=/sys/fs/fuse/connections
   18 
   19 # Gracefully exit if the package has been removed.
   20 which fusermount3 &>/dev/null || exit 5
   21 
   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 "."
   31         fi
   32     else
   33         echo "Fuse filesystem already available."
   34     fi
   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 "."
   43         fi
   44     else
   45         echo "Fuse control filesystem already available."
   46     fi
   47     ;;
   48     stop)
   49     if ! grep -qw fuse /proc/filesystems; then
   50         echo "Fuse filesystem not loaded."
   51         exit 7
   52     fi
   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 "."
   59         fi
   60     else
   61         echo "Fuse control filesystem not mounted."
   62     fi
   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 "."
   69         fi
   70     else
   71         echo "Fuse module not loaded."
   72     fi
   73     ;;
   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."
   81     fi
   82     ;;
   83   *)
   84     echo "Usage: $0 {start|stop|restart|force-reload|status}"
   85     exit 1
   86     ;;
   87 esac
   88 
   89 exit 0