3 # Load the fuse module (if exists) and mount the fuse control file system
5 # Copyright (c) 2019 Matias Fonzo, <selk@dragora.org>.
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
22 if ! type fusermount
> /dev
/null
2>&1
24 echo "${0}: Error: fusermount(1) is not available." 1>&2
32 if modinfo fuse
> /dev
/null
2>&1
34 echo "${PROGRAM}: Loading fuse (kernel) module ..."
38 if ! mountpoint
-q /sys
/fs
/fuse
/connections
40 echo "${PROGRAM}: Mounting fusectl filesystem ..."
41 mount
-v -t fusectl fusectl
/sys
/fs
/fuse
/connections
43 echo "${PROGRAM}: FUSE filesystem already mounted at /sys/fs/fuse/connections" 1>&2
49 if mountpoint
-q /sys
/fs
/fuse
/connections
51 echo "${PROGRAM}: Unmounting FUSE filesystem ..."
52 umount
-v /sys
/fs
/fuse
/connections
54 echo "${PROGRAM}: FUSE filesystem not mounted." 1>&2
57 if grep -q -w ^fuse
/proc
/modules
59 echo "${PROGRAM}: Unloading fuse (kernel) module ..."
64 # Command line arguments
78 echo "Usage: $0 (start|stop|restart)" 1>&2