File vbox-vboxdrv-init-script.diff of Package virtualbox-ose

Index: src/VBox/Installer/linux/vboxdrv.sh.in
===================================================================
--- src/VBox/Installer/linux/vboxdrv.sh.in.orig
+++ src/VBox/Installer/linux/vboxdrv.sh.in
@@ -23,19 +23,18 @@
 #
 ### BEGIN INIT INFO
 # Provides:       vboxdrv
-# Required-Start: $syslog
-# Required-Stop:
+# Required-Start: $syslog $remote_fs
+# Required-Stop:  $syslog $remote_fs
 # Default-Start:  2 3 4 5
 # Default-Stop:   0 1 6
 # Short-Description: VirtualBox Linux kernel module
+# Description: VirtualBox Linux kernel module
 ### END INIT INFO
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin:$PATH
 DEVICE=/dev/vboxdrv
 GROUPNAME=vboxusers
 LOG="/var/log/vbox-install.log"
-NOLSB=%NOLSB%
-DEBIAN=%DEBIAN%
 MODPROBE=/sbin/modprobe
 
 if $MODPROBE -c | grep -q '^allow_unsupported_modules  *0'; then
@@ -45,109 +44,30 @@ fi
 [ -f /lib/lsb/init-functions ] || NOLSB=yes
 [ -f /etc/vbox/vbox.cfg ] && . /etc/vbox/vbox.cfg
 
-if [ -n "$INSTALL_DIR" ]; then
-    VBOXMANAGE="$INSTALL_DIR/VBoxManage"
-    BUILDVBOXDRV="$INSTALL_DIR/src/vboxdrv/build_in_tmp"
-    BUILDVBOXNETFLT="$INSTALL_DIR/src/vboxnetflt/build_in_tmp"
-    BUILDVBOXNETADP="$INSTALL_DIR/src/vboxnetadp/build_in_tmp"
-else
-    VBOXMANAGE="/usr/lib/%PACKAGE%/VBoxManage"
-    BUILDVBOXDRV="/usr/share/%PACKAGE%/src/vboxdrv/build_in_tmp"
-    BUILDVBOXNETFLT="/usr/share/%PACKAGE%/src/vboxnetflt/build_in_tmp"
-    BUILDVBOXNETADP="/usr/share/%PACKAGE%/src/vboxnetadp/build_in_tmp"
-fi
+VBOXMANAGE="$INSTALL_DIR/VBoxManage"
 
-# silently exit if the package was uninstalled but not purged,
-# applies to Debian packages only
-[ -z "$DEBIAN" -o -x $VBOXMANAGE -a -x $BUILDVBOXDRV ] || exit 0
-
-if [ -n "$NOLSB" ]; then
-    if [ -f /etc/redhat-release ]; then
-        system=redhat
-    elif [ -f /etc/SuSE-release ]; then
-        system=suse
-    elif [ -f /etc/gentoo-release ]; then
-        system=gentoo
-    fi
-fi
+[ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
 
-[ -r /etc/default/%PACKAGE% ] && . /etc/default/%PACKAGE%
+. /etc/rc.status
 
-if [ -z "$NOLSB" ]; then
-    . /lib/lsb/init-functions
-    fail_msg() {
-        echo ""
-        log_failure_msg "$1"
-    }
-    succ_msg() {
-        log_success_msg " done."
-    }
-    begin_msg() {
-        log_daemon_msg "$@"
-    }
-else
-    if [ "$system" = "redhat" ]; then
-        . /etc/init.d/functions
-        fail_msg() {
-            echo -n " "
-            echo_failure
-            echo
-            echo "  ($1)"
-        }
-        succ_msg() {
-            echo -n " "
-            echo_success
-            echo
-        }
-    elif [ "$system" = "suse" ]; then
-        . /etc/rc.status
-        fail_msg() {
-            rc_failed 1
-            rc_status -v
-            echo "  ($1)"
-        }
-        succ_msg() {
-            rc_reset
-            rc_status -v
-        }
-    elif [ "$system" = "gentoo" ]; then
-        if [ -f /sbin/functions.sh ]; then
-            . /sbin/functions.sh
-        elif [ -f /etc/init.d/functions.sh ]; then
-            . /etc/init.d/functions.sh
-        fi
-        fail_msg() {
-            eerror "$1"
-        }
-        succ_msg() {
-            eend "$?"
-        }
-        begin_msg() {
-            ebegin "$1"
-        }
-        if [ "`which $0`" = "/sbin/rc" ]; then
-            shift
-        fi
-    else
-        fail_msg() {
-            echo " ...failed!"
-            echo "  ($1)"
-        }
-        succ_msg() {
-            echo " ...done."
-        }
-    fi
-    if [ "$system" != "gentoo" ]; then
-        begin_msg() {
-            [ -z "${1:-}" ] && return 1
-            if [ -z "${2:-}" ]; then
-                echo -n "$1"
-            else
-                echo -n "$1: $2"
-            fi
-        }
-    fi
-fi
+fail_msg() {
+    rc_failed 1
+    rc_status -v
+    echo "  ($1)"
+}
+succ_msg() {
+    rc_reset
+    rc_status -v
+}
+begin_msg() {
+    [ -z "${1:-}" ] && return 1
+    if [ -z "${2:-}" ]; then
+        echo -n "$1"
+     else
+
+        echo -n "$1: $2"
+     fi
+}
 
 failure()
 {
@@ -196,13 +116,6 @@ start()
             failure "Cannot create device $DEVICE with major $MAJOR and minor $MINOR"
         fi
     fi
-    # ensure permissions
-    if ! chown :$GROUPNAME $DEVICE 2>/dev/null; then
-        rmmod vboxnetadp 2>/dev/null
-        rmmod vboxnetflt 2>/dev/null
-        rmmod vboxdrv 2>/dev/null
-        failure "Cannot change owner $GROUPNAME for device $DEVICE"
-    fi
     if ! $MODPROBE vboxnetflt > /dev/null 2>&1; then
         failure "modprobe vboxnetflt failed. Please use 'dmesg' to find out why"
     fi
@@ -236,7 +149,7 @@ stop()
     succ_msg
 }
 
-# enter the following variables in /etc/default/%PACKAGE%:
+# enter the following variables in /etc/default/virtualbox:
 #   SHUTDOWN_USERS="foo bar"  
 #     check for running VMs of user foo and user bar
 #   SHUTDOWN=poweroff
@@ -285,41 +198,8 @@ stop_vms()
 
 setup()
 {
-    stop
-    if find /lib/modules/`uname -r` -name "vboxnetadp\.*" 2>/dev/null|grep -q vboxnetadp; then
-        begin_msg "Removing old VirtualBox netadp kernel module"
-        find /lib/modules/`uname -r` -name "vboxnetadp\.*" 2>/dev/null|xargs rm -f 2>/dev/null
-        succ_msg
-    fi  
-    if find /lib/modules/`uname -r` -name "vboxnetflt\.*" 2>/dev/null|grep -q vboxnetflt; then
-        begin_msg "Removing old VirtualBox netflt kernel module"
-        find /lib/modules/`uname -r` -name "vboxnetflt\.*" 2>/dev/null|xargs rm -f 2>/dev/null
-        succ_msg
-    fi  
-    if find /lib/modules/`uname -r` -name "vboxdrv\.*" 2>/dev/null|grep -q vboxdrv; then
-        begin_msg "Removing old VirtualBox kernel module"
-        find /lib/modules/`uname -r` -name "vboxdrv\.*" 2>/dev/null|xargs rm -f 2>/dev/null
-        succ_msg
-    fi
-    begin_msg "Recompiling VirtualBox kernel module"
-    if ! $BUILDVBOXDRV \
-        --save-module-symvers /tmp/vboxdrv-Module.symvers \
-        --no-print-directory install > $LOG 2>&1; then
-        failure "Look at $LOG to find out what went wrong"
-    fi
-    if ! $BUILDVBOXNETFLT \
-        --use-module-symvers /tmp/vboxdrv-Module.symvers \
-        --no-print-directory install >> $LOG 2>&1; then
-        failure "Look at $LOG to find out what went wrong"
-    fi
-    if ! $BUILDVBOXNETADP \
-        --use-module-symvers /tmp/vboxdrv-Module.symvers \
-        --no-print-directory install >> $LOG 2>&1; then
-        failure "Look at $LOG to find out what went wrong"
-    fi
-    rm -f /etc/vbox/module_not_compiled
+    begin_msg "Recompiling VirtualBox kernel modules, NOT. It has been packaged."
     succ_msg
-    start
 }
 
 dmnstatus()