Setting tag nodemanager-1.8-39
[nodemanager.git] / fuse-pl.init
1 #!/bin/bash
2 #
3 # fuse-pl      Start FUSE support on PlanetLab
4 #
5 # chkconfig: 3 87 27
6 # description: Updates node configuration files at startup
7 #
8 # $Id$
9
10 # Source function library.
11 . /etc/init.d/functions
12
13 : ${UTIL_VSERVER_VARS:=`echo /usr/lib*/util-vserver/util-vserver-vars`}
14 test -e "$UTIL_VSERVER_VARS" || {
15     echo "Can not find util-vserver installation; aborting..."
16     exit 1
17 }
18 . "$UTIL_VSERVER_VARS"
19
20
21 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
22 MOUNTPOINT=/sys/fs/fuse/connections
23
24 case "$1" in
25     start|restart|reload)
26         shift
27         # stolen from the /etc/init.d/fuse that comes with the fuse source
28         if ! grep -qw fuse /proc/filesystems; then
29                 echo -n "Loading fuse module"
30                 if ! modprobe fuse >/dev/null 2>&1; then
31                         echo " failed!"
32                         exit 0
33                 else
34                         echo "."
35                 fi
36         fi
37         if grep -qw fusectl /proc/filesystems && \
38            ! grep -qw $MOUNTPOINT /proc/mounts; then
39                 echo -n "Mounting fuse control filesystem"
40                 if ! mount -t fusectl fusectl $MOUNTPOINT >/dev/null 2>&1; then
41                         echo " failed!"
42                         exit 1
43                 else
44                         echo "."
45                 fi
46         fi
47         # end stolen code
48         #
49         # To enable FUSE for existing slices, copy the FUSE device
50         # node into the slice
51         if [ ! -e /dev/fuse ]; then
52             echo "No FUSE device!  Exiting."
53             exit -1
54         fi
55         for slice in `ls $__CONFDIR`; do
56             cp -a /dev/fuse $__DEFAULT_VSERVERDIR/$slice/dev/ > /dev/null 2>&1
57         done
58         ;;
59     stop)
60         ;;
61     *)
62         echo $"Usage: $0 {start|restart|stop}"
63         exit 1
64 esac
65
66 exit 0