Fixed name of the 'captive' init script.
[captive.git] / src / client / fuse / captive.init
1 #! /bin/bash
2 #
3 # captive          mount/unmount the captive-* (FUSE) filesystems.
4 #
5 # chkconfig: 2345 99 01
6 # description: Captive allows applications running under the GNU/Linux
7 #              operating system to access NTFS drives. File system driver
8 #              compatibility with VFAT, ISO9660 and EXT2 is also provided.
9
10 # Source function library.
11 . /etc/init.d/functions
12
13 # Never drop this lock - we need to catch manually mounts on system shutdown.
14 touch /var/lock/subsys/captive
15
16
17 start() {
18         # In fact this part is done during the boot anyway.
19         grep -q '\<captive-.*\<auto\>' /etc/fstab || return
20
21         fses="$(echo /sbin/mount.captive-*|sed 's#/sbin/mount[.]##g'|tr ' ' ,)"
22         if [ -z "$fses" ]; then
23                 return
24         fi
25         action $"Mounting captive filesystems: " mount -a -t "$fses"
26         RETVAL=$?
27         echo
28         return $RETVAL
29 }
30
31 stop() {
32         # I did not find any way how to identify (or even mark) "captive-*"
33         # filesystems between the mounted ones.
34         # Devicename really must be set to the real devicename as otherwise
35         # mount(8) would try to mount "captive-*" twice during boot.
36         action $"Unmounting captive (FUSE) filesystems: " umount -a -t fuse
37         RETVAL=$?
38         return $RETVAL
39 }
40
41 restart() {
42         stop
43         start
44 }       
45
46 case "$1" in
47   start)
48         start
49         ;;
50   stop)
51         stop
52         ;;
53   restart)
54         restart
55         ;;
56   *)
57         echo $"Usage: $0 {start|stop|restart}"
58         exit 1
59 esac