3 # virtualbox VirtualBox virtualizer for x86 hardware
7 # description: InnoTek VirtualBox is a general-purpose full virtualizer for x86
8 # hardware. Targeted at server, desktop and embedded use.
12 # Source function library
13 . /etc/rc.d/init.d/functions
15 VBOX_DEVICE="/dev/vboxdrv"
18 # Get service config - may override defaults
19 [ -f /etc/sysconfig/virtualbox ] && . /etc/sysconfig/virtualbox
22 if [ ! -f /var/lock/subsys/virtualbox ]; then
23 modprobe -s $VBOX_MODULE
24 # set proper /dev/vboxdrv for systems with static dev
25 if ! [ -d /dev/.udev/ ]; then
26 show "Setting $VBOX_DEVICE entry"
29 VBOX_MAJOR=$(awk '$2 == "vboxdrv" {print $1}' /proc/devices)
30 if [ -n "$VBOX_MAJOR" ]; then
33 VBOX_MINOR=$(awk '$2 == "vboxdrv" {print $1}' /proc/misc)
34 if [ -n "$VBOX_MINOR" ]; then
35 VBOX_MAJOR=$(awk '$2 == "misc" {print $1}' /proc/devices)
38 if [ -z "$VBOX_MAJOR" ]; then
39 /sbin/rmmod $VBOX_MODULE
41 elif ! mknod -m 0660 $VBOX_DEVICE c $VBOX_MAJOR $VBOX_MINOR; then
44 elif ! chown root:vbox $VBOX_DEVICE; then
51 touch /var/lock/subsys/virtualbox
56 # NOTE: rmmod will wait if device is in use, so automatic rmmod probably not the best idea
57 /sbin/rmmod $VBOX_MODULE
58 rm -f /var/lock/subsys/virtualbox
62 # See how we were called.
75 if ! is_module $VBOX_MODULE; then
76 echo "$VBOX_MODULE module is loaded"
78 echo "$VBOX_MODULE module is not loaded"
81 if [ ! -c $VBOX_DEVICE ]; then
82 echo "$VBOX_DEVICE does not exist"
85 echo "$VBOX_DEVICE exists with major/minor $(ls -l $VBOX_DEVICE | awk '{print $5 $6}')"
89 msg_usage "$0 {start|stop|restart|status}"