FUSE patch from Jeremy Stribling.
authorDaniel Hokka Zakrisson <dhokka@cs.princeton.edu>
Wed, 13 Aug 2008 15:42:13 +0000 (15:42 +0000)
committerDaniel Hokka Zakrisson <dhokka@cs.princeton.edu>
Wed, 13 Aug 2008 15:42:13 +0000 (15:42 +0000)
NodeManager.spec
fuse-pl.init [new file with mode: 0644]

index 93efb46..f9997fb 100644 (file)
@@ -62,6 +62,7 @@ rm -rf $RPM_BUILD_ROOT
 %{__make} %{?_smp_mflags} install DESTDIR="$RPM_BUILD_ROOT"
 
 install -D -m 755 conf_files.init $RPM_BUILD_ROOT/%{_initrddir}/conf_files
+install -D -m 755 fuse-pl.init $RPM_BUILD_ROOT/%{_initrddir}/fuse-pl
 install -D -m 755 nm.init $RPM_BUILD_ROOT/%{_initrddir}/nm
 install -D -m 644 nm.logrotate $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/nm
 
@@ -70,14 +71,19 @@ chkconfig --add conf_files
 chkconfig conf_files on
 chkconfig --add nm
 chkconfig nm on
+chkconfig --add fuse-pl
+chkconfig fuse-pl on
 if [ "$PL_BOOTCD" != "1" ] ; then
        service nm restart
+       service fuse-pl restart
 fi
 
 
 %preun
 # 0 = erase, 1 = upgrade
 if [ $1 -eq 0 ] ; then
+    chkconfig fuse-pl off
+    chkconfig --del fuse-pl
     chkconfig nm off
     chkconfig --del nm
     chkconfig conf_files off
diff --git a/fuse-pl.init b/fuse-pl.init
new file mode 100644 (file)
index 0000000..669df29
--- /dev/null
@@ -0,0 +1,66 @@
+#!/bin/bash
+#
+# fuse-pl      Start FUSE support on PlanetLab
+#
+# chkconfig: 3 87 27
+# description: Updates node configuration files at startup
+#
+# $Id$
+
+# Source function library.
+. /etc/init.d/functions
+
+: ${UTIL_VSERVER_VARS:=/usr/lib*/util-vserver/util-vserver-vars}
+test -e "$UTIL_VSERVER_VARS" || {
+    echo "Can not find util-vserver installation; aborting..."
+    exit 1
+}
+. "$UTIL_VSERVER_VARS"
+
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+MOUNTPOINT=/sys/fs/fuse/connections
+
+case "$1" in
+    start|restart|reload)
+       shift
+       # stolen from the /etc/init.d/fuse that comes with the fuse source
+        if ! grep -qw fuse /proc/filesystems; then
+                echo -n "Loading fuse module"
+                if ! modprobe fuse >/dev/null 2>&1; then
+                        echo " failed!"
+                        exit 1
+                else
+                        echo "."
+                fi
+        fi
+        if grep -qw fusectl /proc/filesystems && \
+           ! grep -qw $MOUNTPOINT /proc/mounts; then
+                echo -n "Mounting fuse control filesystem"
+                if ! mount -t fusectl fusectl $MOUNTPOINT >/dev/null 2>&1; then
+                        echo " failed!"
+                        exit 1
+                else
+                        echo "."
+                fi
+        fi
+        # end stolen code
+       #
+        # To enable FUSE for existing slices, copy the FUSE device
+       # node into the slice
+        if [ ! -e /dev/fuse ]; then
+           echo "No FUSE device!  Exiting."
+           exit -1
+       fi
+       for slice in `ls $__CONFDIR`; do
+           cp -a /dev/fuse $__DEFAULT_VSERVERDIR/$slice/dev/ > /dev/null 2>&1
+       done
+       ;;
+    stop)
+       ;;
+    *)
+       echo $"Usage: $0 {start|restart|stop}"
+       exit 1
+esac
+
+exit 0