+Shutdown safety script - unmounts all the FUSE filesystems.
authorlace <>
Tue, 20 Dec 2005 00:38:42 +0000 (00:38 +0000)
committerlace <>
Tue, 20 Dec 2005 00:38:42 +0000 (00:38 +0000)
src/client/fuse/Makefile.am
src/client/fuse/captive.init [new file with mode: 0755]

index d0d9bde..444a6e4 100644 (file)
@@ -74,6 +74,7 @@ mount_captive_CFLAGS+=-DVARLIBCAPTIVEDIR="$(localstatedir)/lib/$(PACKAGE)"
 if ENABLE_FUSE
 if ENABLE_SBIN_MOUNT
 mount_captive_cond=mount.captive
+initd_SCRIPTS_cond=captive
 
 install-exec-hook:
        $(mkinstalldirs) $(DESTDIR)$(enable_sbin_mountdir)
@@ -109,3 +110,11 @@ endif
 endif
 endif
 man_MANS=$(mount_captive_man_cond)
+
+initddir=$(sysconfdir)/init.d
+initd_SCRIPTS=$(captive_cond)
+EXTRA_DIST+=captive.init
+CLEANFILES+=captive
+captive: captive.init
+       $(LN_S) $< $@
+
diff --git a/src/client/fuse/captive.init b/src/client/fuse/captive.init
new file mode 100755 (executable)
index 0000000..b26498e
--- /dev/null
@@ -0,0 +1,59 @@
+#! /bin/bash
+#
+# captive          Start/Stop the cron clock daemon.
+#
+# chkconfig: 2345 99 01
+# description: Captive allows applications running under the GNU/Linux
+#              operating system to access NTFS drives. File system driver
+#              compatibility with VFAT, ISO9660 and EXT2 is also provided.
+
+# Source function library.
+. /etc/init.d/functions
+
+# Never drop this lock - we need to catch manually mounts on system shutdown.
+touch /var/lock/subsys/captive
+
+
+start() {
+       # In fact this part is done during the boot anyway.
+       grep -q '\<captive-.*\<auto\>' /etc/fstab || return
+
+       fses="$(echo /sbin/mount.captive-*|sed 's#/sbin/mount[.]##g'|tr ' ' ,)"
+       if [ -z "$fses" ]; then
+               return
+       fi
+       action $"Mounting captive filesystems: " mount -a -t "$fses"
+       RETVAL=$?
+       echo
+       return $RETVAL
+}
+
+stop() {
+       # I did not find any way how to identify (or even mark) "captive-*"
+       # filesystems between the mounted ones.
+       # Devicename really must be set to the real devicename as otherwise
+       # mount(8) would try to mount "captive-*" twice during boot.
+       action $"Unmounting captive (FUSE) filesystems: " umount -a -t fuse
+       RETVAL=$?
+       return $RETVAL
+}
+
+restart() {
+       stop
+       start
+}      
+
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
+       ;;
+  restart)
+       restart
+       ;;
+  *)
+       echo $"Usage: $0 {start|stop|restart}"
+       exit 1
+esac