]> git.pld-linux.org Git - packages/VirtualBox.git/blob - VirtualBox-vboxnetflt.init
- identify our build as _PLD, see http://www.virtualbox.org/wiki/Editions
[packages/VirtualBox.git] / VirtualBox-vboxnetflt.init
1 #!/bin/sh
2 #
3 # virtualbox    VirtualBox virtualizer for x86 hardware
4 #
5 # chkconfig:    345 84 25
6 #
7 # description:  InnoTek VirtualBox is a general-purpose full virtualizer for x86 
8 #               hardware. Targeted at server, desktop and embedded use.
9 #
10 # $Id$
11
12 # Source function library
13 . /etc/rc.d/init.d/functions
14
15 VBOX_DEVICE="/dev/vboxnetflt"
16 VBOX_MODULE="vboxnetflt"
17
18 # Get service config - may override defaults
19 [ -f /etc/sysconfig/virtualbox ] && . /etc/sysconfig/virtualbox
20
21 start() {
22         if [ -f /var/lock/subsys/vboxnetflt ]; then
23                 return
24         fi
25
26         modprobe -s $VBOX_MODULE
27         touch /var/lock/subsys/vboxnetflt
28 }
29
30 stop() {
31         # NOTE: rmmod will wait if device is in use, so automatic rmmod probably is not the best idea
32         /sbin/rmmod $VBOX_MODULE
33         rm -f /var/lock/subsys/vboxnetflt
34 }
35
36 condrestart() {
37         if [ ! -f /var/lock/subsys/vboxnetflt ]; then
38                 RETVAL=$1
39                 return
40         fi
41
42         stop
43         start
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   try-restart)
60         condrestart 0
61         ;;
62   force-reload)
63         condrestart 7
64         ;;
65   status)
66         if ! is_module $VBOX_MODULE; then
67                 echo "$VBOX_MODULE module is loaded"
68         else
69                 echo "$VBOX_MODULE module is not loaded"
70                 RETVAL=3
71         fi
72         ;;
73   *)
74         msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
75         exit 3
76 esac
77
78 exit $RETVAL
This page took 0.038 seconds and 3 git commands to generate.