/[packages]/cauldron/virtualbox/current/SOURCES/virtualbox.init
ViewVC logotype

Contents of /cauldron/virtualbox/current/SOURCES/virtualbox.init

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1459 - (show annotations) (download)
Sun Jan 9 02:00:20 2011 UTC (13 years, 2 months ago) by ahmad
File size: 2085 byte(s)
imported package virtualbox
1 #! /bin/sh
2 #
3 # virtualbox: Starts the VirtualBox kernel module
4 #
5 # chkconfig: 35 30 60
6 # description: VirtualBox Linux kernel module
7 #
8 ### BEGIN INIT INFO
9 # Provides: vboxdrv
10 # Required-Start: $syslog
11 # Required-Stop:
12 # Default-Start: 3 5
13 # Default-Stop:
14 # Description: VirtualBox Linux kernel module
15 # Should-Start: dkms
16 ### END INIT INFO
17
18 # Source function library.
19 . /etc/init.d/functions
20
21 DAEMON=virtualbox
22 PROGNAME=VBoxSVC
23
24 RETVAL=0
25
26 running() {
27 grep -q "^$1 " /proc/modules
28 }
29
30 start() {
31 # Check if it is already running
32 if ! running vboxdrv; then
33 gprintf "Starting %s daemon: " "$DAEMON"
34 if ! modprobe vboxdrv > /dev/null 2>&1; then
35 failure "Loading vboxdrv module:"
36 return
37 fi
38 if ! modprobe vboxnetflt > /dev/null 2>&1; then
39 failure "Loading vboxnetflt module:"
40 return
41 fi
42 if ! modprobe vboxnetadp > /dev/null 2>&1; then
43 failure "Loading vboxnetadp module:"
44 return
45 fi
46 touch /var/lock/subsys/$PROGNAME
47 success
48 fi
49 echo
50 }
51
52 stop() {
53 gprintf "Stopping %s daemon: " "$DAEMON"
54 if running vboxdrv; then
55 if running vboxnetflt; then
56 if ! rmmod vboxnetflt 2>/dev/null; then
57 failure "Remove module vboxnetflt:"
58 return
59 fi
60 fi
61 if running vboxnetadp; then
62 if ! rmmod vboxnetadp 2>/dev/null; then
63 failure "Remove module vboxnetadp:"
64 return
65 fi
66 fi
67 if ! rmmod vboxdrv 2>/dev/null; then
68 failure "Remove module vboxdrv:"
69 return
70 fi
71 fi
72 success
73 echo
74 }
75
76 restart() {
77 stop
78 start
79 }
80
81 status() {
82 if running vboxdrv; then
83 STATUS="loaded"
84 else
85 STATUS="not loaded"
86 fi
87 gprintf "%s kernel module is %s\n" $DAEMON "$STATUS"
88 }
89
90 case "$1" in
91 start)
92 start
93 ;;
94 stop)
95 stop
96 ;;
97 restart)
98 restart
99 ;;
100 condrestart)
101 if [ -f /var/lock/subsys/$PROGNAME ]; then
102 restart
103 fi
104 ;;
105 status)
106 status
107 ;;
108 *)
109 INITNAME=`basename $0`
110 gprintf "Usage: %s {start|stop|restart|condrestart|status}\n" "$INITNAME"
111 exit 1
112 ;;
113 esac
114 exit $RETVAL

  ViewVC Help
Powered by ViewVC 1.1.30