]> git.pld-linux.org Git - packages/VirtualBox.git/blame - virtualbox.init
- improved module build,
[packages/VirtualBox.git] / virtualbox.init
CommitLineData
cef028c5 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# Get service config - may override defaults
16[ -f /etc/sysconfig/virtualbox ] && . /etc/sysconfig/virtualbox
17
18start() {
19 # Check if the service is already running?
20 if [ ! -f /var/lock/subsys/virtualbox ]; then
18105b79
ER
21 msg_starting virtualbox
22
cef028c5 23 _modprobe single die vboxdrv
30e1a246 24 # XXX: include %dev in virtualbox.spec (+udev rule?)
35926d9a 25 chown root:vbox /dev/vboxdrv
18105b79 26
cef028c5 27 daemon --fork VBoxSVC
28 RETVAL=$?
29 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/virtualbox
30 else
31 msg_already_running virtualbox
32 fi
33}
34
35stop() {
36 if [ -f /var/lock/subsys/virtualbox ]; then
cef028c5 37 # Stop daemons.
38 msg_stopping virtualbox
18105b79
ER
39
40 # NOTE: rmmod will wait if device is in use, so automatic rmmod probably not the best idea
41 /sbin/rmmod vboxdrv >/dev/null 2>&1
42
cef028c5 43 killproc VBoxSVC
44 rm -f /var/lock/subsys/virtualbox
45 else
46 msg_not_running virtualbox
47 fi
48}
49
50RETVAL=0
51# See how we were called.
52case "$1" in
53 start)
54 start
55 ;;
56 stop)
57 stop
58 ;;
59 restart)
60 stop
61 start
cef028c5 62 ;;
63 status)
64 status virtualbox
65 RETVAL=$?
66 ;;
67 *)
68 msg_usage "$0 {start|stop|restart|status}"
69 exit 3
70esac
71
72exit $RETVAL
This page took 0.041452 seconds and 4 git commands to generate.