]> git.pld-linux.org Git - packages/VirtualBox.git/commitdiff
- sync with vboxdrv.init
authorElan Ruusamäe <glen@pld-linux.org>
Sat, 24 Mar 2012 16:38:58 +0000 (16:38 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    VirtualBox-vboxguest.init -> 1.5

VirtualBox-vboxguest.init

index b014a45ab75d88c837ea29d1b8723a9efe4cd329..ae3445605bf2daadcd305adf41463c396463a06c 100644 (file)
@@ -21,18 +21,19 @@ VBOX_MODULE="vboxguest"
 setup() {
        modprobe -s $VBOX_MODULE
        RETVAL=$?
-       if [ -d /dev/.udev ]; then
+
+       if [ -d /dev/.udev ] || [ -d /run/udev/rules.d ]; then
                return $RETVAL
        fi
 
        # set proper $VBOX_DEVICE for systems with static dev
        show "Setting $VBOX_DEVICE entry"; busy
        rm -f $VBOX_DEVICE
-       VBOX_MAJOR=$(awk '$2 == "vboxdrv" {print $1}' /proc/devices)
+       VBOX_MAJOR=$(awk -vdevice="${VBOX_DEVICE#/dev/}" '$2 == device {print $1}' /proc/devices)
        if [ -n "$VBOX_MAJOR" ]; then
                VBOX_MINOR=0
        else
-               VBOX_MINOR=$(awk '$2 == "vboxdrv" {print $1}' /proc/misc)
+               VBOX_MINOR=$(awk -vdevice="${VBOX_DEVICE#/dev/}" '$2 == device {print $1}' /proc/misc)
                if [ -n "$VBOX_MINOR" ]; then
                        VBOX_MAJOR=$(awk '$2 == "misc" {print $1}' /proc/devices)
                fi
@@ -55,17 +56,27 @@ setup() {
 }
 
 start() {
-       if [ -f /var/lock/subsys/vboxguest ]; then
+       if [ -f /var/lock/subsys/$VBOX_MODULE ]; then
                return
        fi
+
        setup || exit $?
-       touch /var/lock/subsys/vboxguest
+       touch /var/lock/subsys/$VBOX_MODULE
 }
 
 stop() {
        # NOTE: rmmod will wait if device is in use, so automatic rmmod probably is not the best idea
        /sbin/rmmod $VBOX_MODULE
-       rm -f /var/lock/subsys/vboxguest
+       rm -f /var/lock/subsys/$VBOX_MODULE
+}
+
+condrestart() {
+       if [ -f /var/lock/subsys/$VBOX_MODULE ]; then
+               stop
+               start
+       else
+               RETVAL=$1
+       fi
 }
 
 RETVAL=0
@@ -81,6 +92,12 @@ case "$1" in
        stop
        start
        ;;
+  try-restart)
+       condrestart 0
+       ;;
+  force-reload)
+       condrestart 7
+       ;;
   setup)
        setup
        ;;
@@ -99,7 +116,7 @@ case "$1" in
        fi
        ;;
   *)
-       msg_usage "$0 {start|stop|restart|setup|status}"
+       msg_usage "$0 {start|stop|restart|try-restart|force-reload|setup|status}"
        exit 3
 esac
 
This page took 0.052211 seconds and 4 git commands to generate.