]> git.pld-linux.org Git - packages/VirtualBox.git/blob - VirtualBox-vboxsf.init
- really use system xorg headers
[packages/VirtualBox.git] / VirtualBox-vboxsf.init
1 #!/bin/sh
2 #
3 # virtualbox    VirtualBox virtualizer for x86 hardware
4 # chkconfig:    345 84 16
5 # description:  Oracle VirtualBox is a general-purpose full virtualizer for x86 \
6 #               hardware. Targeted at server, desktop and embedded use.
7
8 # Source function library
9 . /etc/rc.d/init.d/functions
10
11 VBOX_MODULE="vboxsf"
12
13 # Get service config - may override defaults
14 [ -f /etc/sysconfig/virtualbox ] && . /etc/sysconfig/virtualbox
15
16 start() {
17         if [ -f /var/lock/subsys/vboxsf ]; then
18                 return
19         fi
20
21         modprobe -s $VBOX_MODULE
22         touch /var/lock/subsys/vboxsf
23 }
24
25 stop() {
26         # umount vboxsf mounts, no retry, just don't stack them :)
27         local mount errors out rc=0
28         show "Unmounting vboxsf file systems"; busy
29         awk '$3 == "vboxsf" {print $2}' /proc/mounts | while read mount; do
30                 if ! umount "$mount"; then
31                         rc=$?
32                 fi
33         done
34         if [ $rc = 0 ]; then
35                 ok
36         else
37                 fail
38         fi
39
40         # NOTE: rmmod will say module in use if there are remaining mounts
41         /sbin/rmmod $VBOX_MODULE
42
43         rm -f /var/lock/subsys/vboxsf
44 }
45
46 RETVAL=0
47 # See how we were called.
48 case "$1" in
49   start)
50         start
51         ;;
52   stop)
53         stop
54         ;;
55   restart)
56         stop
57         start
58         ;;
59   status)
60         if ! is_module $VBOX_MODULE; then
61                 echo "$VBOX_MODULE module is loaded"
62         else
63                 echo "$VBOX_MODULE module is not loaded"
64                 RETVAL=3
65         fi
66         ;;
67   *)
68         msg_usage "$0 {start|stop|restart|status}"
69         exit 3
70 esac
71
72 exit $RETVAL
This page took 0.038759 seconds and 3 git commands to generate.