]> git.pld-linux.org Git - packages/VirtualBox-bin.git/blob - VirtualBox-vboxnetadp.init
- fix NoSource0-md5 lines
[packages/VirtualBox-bin.git] / VirtualBox-vboxnetadp.init
1 #!/bin/sh
2 #
3 # vboxnetadp    Virtual Network Adapter Driver
4 #
5 # chkconfig:    345 86 23
6 #
7 # description:  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_MODULE="vboxnetadp"
16
17 # Get service config - may override defaults
18 [ -f /etc/sysconfig/virtualbox ] && . /etc/sysconfig/virtualbox
19
20 start() {
21         if [ ! -f /var/lock/subsys/vboxnetadp ]; then
22                 modprobe -s $VBOX_MODULE
23                 # set proper /dev/vboxdrv for systems with static dev
24                 touch /var/lock/subsys/vboxnetadp
25         fi
26 }
27
28 stop() {
29         # NOTE: rmmod will wait if device is in use, so automatic rmmod probably is not the best idea
30         /sbin/rmmod $VBOX_MODULE
31         rm -f /var/lock/subsys/vboxnetadp
32 }
33
34 condrestart() {
35         if [ -f /var/lock/subsys/vboxnetadp ]; then
36                 stop
37                 start
38         else
39                 RETVAL=$1
40         fi
41 }
42
43 RETVAL=0
44 # See how we were called.
45 case "$1" in
46   start)
47         start
48         ;;
49   stop)
50         stop
51         ;;
52   restart)
53         stop
54         start
55         ;;
56   try-restart)
57         condrestart 0
58         ;;
59   force-reload)
60         condrestart 7
61         ;;
62   status)
63         if ! is_module $VBOX_MODULE; then
64                 echo "$VBOX_MODULE module is loaded"
65         else
66                 echo "$VBOX_MODULE module is not loaded"
67                 RETVAL=3
68         fi
69         ;;
70   *)
71         msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
72         exit 3
73 esac
74
75 exit $RETVAL
This page took 0.091114 seconds and 3 git commands to generate.