16881f68fSopenharmony_ci#!/bin/sh 26881f68fSopenharmony_ci### BEGIN INIT INFO 36881f68fSopenharmony_ci# Provides: fuse 46881f68fSopenharmony_ci# Required-Start: 56881f68fSopenharmony_ci# Should-Start: udev 66881f68fSopenharmony_ci# Required-Stop: 76881f68fSopenharmony_ci# Default-Start: S 86881f68fSopenharmony_ci# Default-Stop: 96881f68fSopenharmony_ci# Short-Description: Start and stop fuse. 106881f68fSopenharmony_ci# Description: Load the fuse module and mount the fuse control 116881f68fSopenharmony_ci# filesystem. 126881f68fSopenharmony_ci### END INIT INFO 136881f68fSopenharmony_ci 146881f68fSopenharmony_ciset -e 156881f68fSopenharmony_ci 166881f68fSopenharmony_ciPATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 176881f68fSopenharmony_ciMOUNTPOINT=/sys/fs/fuse/connections 186881f68fSopenharmony_ci 196881f68fSopenharmony_ci# Gracefully exit if the package has been removed. 206881f68fSopenharmony_ciwhich fusermount3 &>/dev/null || exit 5 216881f68fSopenharmony_ci 226881f68fSopenharmony_ci# Define LSB log_* functions. 236881f68fSopenharmony_ci. /lib/lsb/init-functions 246881f68fSopenharmony_ci 256881f68fSopenharmony_cicase "$1" in 266881f68fSopenharmony_ci start|restart|force-reload) 276881f68fSopenharmony_ci if ! grep -qw fuse /proc/filesystems; then 286881f68fSopenharmony_ci echo -n "Loading fuse module" 296881f68fSopenharmony_ci if ! modprobe fuse >/dev/null 2>&1; then 306881f68fSopenharmony_ci echo " failed!" 316881f68fSopenharmony_ci exit 1 326881f68fSopenharmony_ci else 336881f68fSopenharmony_ci echo "." 346881f68fSopenharmony_ci fi 356881f68fSopenharmony_ci else 366881f68fSopenharmony_ci echo "Fuse filesystem already available." 376881f68fSopenharmony_ci fi 386881f68fSopenharmony_ci if grep -qw fusectl /proc/filesystems && \ 396881f68fSopenharmony_ci ! grep -qw $MOUNTPOINT /proc/mounts; then 406881f68fSopenharmony_ci echo -n "Mounting fuse control filesystem" 416881f68fSopenharmony_ci if ! mount -t fusectl fusectl $MOUNTPOINT >/dev/null 2>&1; then 426881f68fSopenharmony_ci echo " failed!" 436881f68fSopenharmony_ci exit 1 446881f68fSopenharmony_ci else 456881f68fSopenharmony_ci echo "." 466881f68fSopenharmony_ci fi 476881f68fSopenharmony_ci else 486881f68fSopenharmony_ci echo "Fuse control filesystem already available." 496881f68fSopenharmony_ci fi 506881f68fSopenharmony_ci ;; 516881f68fSopenharmony_ci stop) 526881f68fSopenharmony_ci if ! grep -qw fuse /proc/filesystems; then 536881f68fSopenharmony_ci echo "Fuse filesystem not loaded." 546881f68fSopenharmony_ci exit 7 556881f68fSopenharmony_ci fi 566881f68fSopenharmony_ci if grep -qw $MOUNTPOINT /proc/mounts; then 576881f68fSopenharmony_ci echo -n "Unmounting fuse control filesystem" 586881f68fSopenharmony_ci if ! umount $MOUNTPOINT >/dev/null 2>&1; then 596881f68fSopenharmony_ci echo " failed!" 606881f68fSopenharmony_ci else 616881f68fSopenharmony_ci echo "." 626881f68fSopenharmony_ci fi 636881f68fSopenharmony_ci else 646881f68fSopenharmony_ci echo "Fuse control filesystem not mounted." 656881f68fSopenharmony_ci fi 666881f68fSopenharmony_ci if grep -qw "^fuse" /proc/modules; then 676881f68fSopenharmony_ci echo -n "Unloading fuse module" 686881f68fSopenharmony_ci if ! rmmod fuse >/dev/null 2>&1; then 696881f68fSopenharmony_ci echo " failed!" 706881f68fSopenharmony_ci else 716881f68fSopenharmony_ci echo "." 726881f68fSopenharmony_ci fi 736881f68fSopenharmony_ci else 746881f68fSopenharmony_ci echo "Fuse module not loaded." 756881f68fSopenharmony_ci fi 766881f68fSopenharmony_ci ;; 776881f68fSopenharmony_ci status) 786881f68fSopenharmony_ci echo -n "Checking fuse filesystem" 796881f68fSopenharmony_ci if ! grep -qw fuse /proc/filesystems; then 806881f68fSopenharmony_ci echo " not available." 816881f68fSopenharmony_ci exit 3 826881f68fSopenharmony_ci else 836881f68fSopenharmony_ci echo " ok." 846881f68fSopenharmony_ci fi 856881f68fSopenharmony_ci ;; 866881f68fSopenharmony_ci *) 876881f68fSopenharmony_ci echo "Usage: $0 {start|stop|restart|force-reload|status}" 886881f68fSopenharmony_ci exit 1 896881f68fSopenharmony_ci ;; 906881f68fSopenharmony_ciesac 916881f68fSopenharmony_ci 926881f68fSopenharmony_ciexit 0 93