]> git.pld-linux.org Git - packages/VirtualBox-bin.git/commitdiff
- init script for loading vboxadd module on guest system using static /dev auto/th/VirtualBox-1_6_0-4 auto/th/VirtualBox-1_6_0-5 auto/th/VirtualBox-1_6_2-12 auto/th/VirtualBox-1_6_2-3 auto/th/VirtualBox-1_6_2-6 auto/th/VirtualBox-1_6_2-7 auto/th/VirtualBox-1_6_2-8 auto/th/VirtualBox-1_6_4-2 auto/th/VirtualBox-1_6_4-3 auto/th/VirtualBox-1_6_4-4 auto/th/VirtualBox-1_6_4-5 auto/th/VirtualBox-1_6_4-6 auto/th/VirtualBox-1_6_6-1 auto/th/VirtualBox-2_0_0-1 auto/th/VirtualBox-2_0_0-2 auto/th/VirtualBox-2_0_2-1 auto/th/VirtualBox-2_0_2-2 auto/th/VirtualBox-2_0_2-3 auto/th/VirtualBox-2_0_2-4 auto/th/VirtualBox-2_0_2-5 auto/th/VirtualBox-2_0_4-1 auto/th/VirtualBox-2_0_4-2 auto/th/VirtualBox-2_0_4-3 auto/th/VirtualBox-2_0_4-4 auto/th/VirtualBox-2_0_4-5 auto/ti/VirtualBox-1_6_0-3 auto/ti/VirtualBox-1_6_2-1 auto/ti/VirtualBox-1_6_2-10 auto/ti/VirtualBox-1_6_2-11 auto/ti/VirtualBox-1_6_2-12 auto/ti/VirtualBox-1_6_2-2 auto/ti/VirtualBox-1_6_2-3 auto/ti/VirtualBox-1_6_2-4 auto/ti/VirtualBox-1_6_2-5 auto/ti/VirtualBox-1_6_2-8 auto/ti/VirtualBox-1_6_2-9 auto/ti/VirtualBox-1_6_4-1 auto/ti/VirtualBox-1_6_4-2 auto/ti/VirtualBox-1_6_4-5 auto/ti/VirtualBox-1_6_6-1 auto/ti/VirtualBox-2_0_0-1 auto/ti/VirtualBox-2_0_0-2 auto/ti/VirtualBox-2_0_0-3 auto/ti/VirtualBox-2_0_2-1 auto/ti/VirtualBox-2_0_2-5 auto/ti/VirtualBox-2_0_4-1 auto/ti/VirtualBox-2_0_4-3 auto/ti/VirtualBox-2_0_4-4
authorhawk <hawk@pld-linux.org>
Fri, 16 May 2008 13:20:19 +0000 (13:20 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    VirtualBox-vboxadd.init -> 1.1

VirtualBox-vboxadd.init [new file with mode: 0644]

diff --git a/VirtualBox-vboxadd.init b/VirtualBox-vboxadd.init
new file mode 100644 (file)
index 0000000..2c59284
--- /dev/null
@@ -0,0 +1,93 @@
+#!/bin/sh
+#
+# virtualbox   VirtualBox virtualizer for x86 hardware
+#
+# chkconfig:   345 84 25
+#
+# description: InnoTek VirtualBox is a general-purpose full virtualizer for x86 
+#              hardware. Targeted at server, desktop and embedded use.
+#
+# $Id$
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+VBOX_DEVICE="/dev/vboxadd"
+VBOX_MODULE="vboxadd"
+
+# Get service config - may override defaults
+[ -f /etc/sysconfig/virtualbox ] && . /etc/sysconfig/virtualbox
+
+start() {
+       if [ ! -f /var/lock/subsys/virtualbox ]; then
+               modprobe -s $VBOX_MODULE
+               # set proper /dev/vboxdrv for systems with static dev
+               if ! [ -d /dev/.udev/ ]; then
+                       show "Setting $VBOX_DEVICE entry"
+                       busy
+                       rm -f $VBOX_DEVICE
+                       VBOX_MAJOR=$(awk '$2 == "vboxdrv" {print $1}' /proc/devices)
+                       if [ -n "$VBOX_MAJOR" ]; then
+                               VBOX_MINOR=0
+                       else
+                               VBOX_MINOR=$(awk '$2 == "vboxdrv" {print $1}' /proc/misc)
+                               if [ -n "$VBOX_MINOR" ]; then
+                                       VBOX_MAJOR=$(awk '$2 == "misc" {print $1}' /proc/devices)
+                               fi
+                       fi
+                       if [ -z "$VBOX_MAJOR" ]; then
+                               /sbin/rmmod $VBOX_MODULE
+                               fail
+                       elif ! mknod -m 0660 $VBOX_DEVICE c $VBOX_MAJOR $VBOX_MINOR; then
+                               rmmod $VBOX_MODNAME
+                               fail
+                       elif ! chown root:vbox $VBOX_DEVICE; then
+                               fail
+                       else
+                               ok
+                       fi
+               fi
+
+               touch /var/lock/subsys/virtualbox
+       fi
+}
+
+stop() {
+       # NOTE: rmmod will wait if device is in use, so automatic rmmod probably not the best idea
+       /sbin/rmmod $VBOX_MODULE
+       rm -f /var/lock/subsys/virtualbox
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
+       ;;
+  restart)
+       stop
+       start
+       ;;
+  status)
+       if ! is_module $VBOX_MODULE; then
+               echo "$VBOX_MODULE module is loaded"
+       else
+               echo "$VBOX_MODULE module is not loaded"
+               RETVAL=3
+       fi
+       if [ ! -c $VBOX_DEVICE ]; then
+               echo "$VBOX_DEVICE does not exist"
+               RETVAL=3
+       else
+               echo "$VBOX_DEVICE exists with major/minor $(ls -l $VBOX_DEVICE | awk '{print $5 $6}')"
+       fi
+       ;;
+  *)
+       msg_usage "$0 {start|stop|restart|status}"
+       exit 3
+esac
+
+exit $RETVAL
This page took 0.068736 seconds and 4 git commands to generate.