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

Index: src/VBox/Additions/linux/installer/vboxadd.sh
===================================================================
--- src/VBox/Additions/linux/installer/vboxadd.sh.orig
+++ src/VBox/Additions/linux/installer/vboxadd.sh
@@ -26,6 +26,7 @@
 # Default-Start:  2 3 4 5
 # Default-Stop:   0 1 6
 # Description:    VirtualBox Linux Additions kernel modules
+# Short-Description: VirtualBox Linux Additions kernel modules
 ### END INIT INFO
 
 PATH=$PATH:/bin:/sbin:/usr/sbin
@@ -164,8 +165,6 @@ fi
 
 dev=/dev/vboxguest
 userdev=/dev/vboxuser
-owner=vboxadd
-group=1
 
 fail()
 {
@@ -230,12 +229,6 @@ start()
             fail "Cannot create device $dev with major $maj and minor $min"
         }
     fi
-    chown $owner:$group $dev 2>/dev/null || {
-        rm -f $dev 2>/dev/null
-        rm -f $userdev 2>/dev/null
-        rmmod vboxguest 2>/dev/null
-        fail "Cannot change owner $owner:$group for device $dev"
-    }
 
     if [ ! -c $userdev ]; then
         maj=10
@@ -246,17 +239,10 @@ start()
                 rmmod vboxguest 2>/dev/null
                 fail "Cannot create device $userdev with major $maj and minor $min"
             }
-            chown $owner:$group $userdev 2>/dev/null || {
-                rm -f $dev 2>/dev/null
-                rm -f $userdev 2>/dev/null
-                rmmod vboxguest 2>/dev/null
-                fail "Cannot change owner $owner:$group for device $userdev"
-            }
         fi
     fi
 
-    if [ -n "$BUILDVBOXSF" ]; then
-        running_vboxsf || {
+    running_vboxsf || {
             $MODPROBE vboxsf > /dev/null 2>&1 || {
                 if dmesg | grep "vboxConnect failed" > /dev/null 2>&1; then
                     fail_msg
@@ -266,8 +252,7 @@ start()
                 fi
                 fail "modprobe vboxsf failed"
             }
-        }
-    fi
+    }
 
     # Mount all shared folders from /etc/fstab. Normally this is done by some
     # other startup script but this requires the vboxdrv kernel module loaded.
@@ -284,10 +269,8 @@ stop()
     if ! umount -a -t vboxsf 2>/dev/null; then
         fail "Cannot unmount vboxsf folders"
     fi
-    if [ -n "$BUILDVBOXSF" ]; then
-        if running_vboxsf; then
-            rmmod vboxsf 2>/dev/null || fail "Cannot unload module vboxsf"
-        fi
+    if running_vboxsf; then
+    	rmmod vboxsf 2>/dev/null || fail "Cannot unload module vboxsf"
     fi
     if running_vboxguest; then
         rmmod vboxguest 2>/dev/null || fail "Cannot unload module vboxguest"
@@ -307,115 +290,8 @@ restart()
 # setup_script
 setup()
 {
-    # don't stop the old modules here -- they might be in use
-    if find /lib/modules/`uname -r` -name "vboxvideo\.*" 2>/dev/null|grep -q vboxvideo; then
-        begin "Removing old VirtualBox vboxvideo kernel module"
-        find /lib/modules/`uname -r` -name "vboxvideo\.*" 2>/dev/null|xargs rm -f 2>/dev/null
-        succ_msg
-    fi
-    if find /lib/modules/`uname -r` -name "vboxsf\.*" 2>/dev/null|grep -q vboxsf; then
-        begin "Removing old VirtualBox vboxsf kernel module"
-        find /lib/modules/`uname -r` -name "vboxsf\.*" 2>/dev/null|xargs rm -f 2>/dev/null
-        succ_msg
-    fi
-    if find /lib/modules/`uname -r` -name "vboxguest\.*" 2>/dev/null|grep -q vboxguest; then
-        begin "Removing old VirtualBox vboxguest kernel module"
-        find /lib/modules/`uname -r` -name "vboxguest\.*" 2>/dev/null|xargs rm -f 2>/dev/null
-        succ_msg
-    fi
-    begin "Building the VirtualBox Guest Additions kernel modules"
-    if ! sh /usr/share/$PACKAGE/test/build_in_tmp \
-        --no-dkms --no-print-directory > $LOG 2>&1; then
-        fail_msg
-        printf "Your system does not seem to be set up to build kernel modules.\nLook at $LOG to find out what went wrong.  Once you have corrected it, you can\nrun\n\n  /etc/init.d/vboxadd setup\n\nto build them."
-        BUILDVBOXGUEST=""
-        BUILDVBOXSF=""
-        BUILDVBOXVIDEO=""
-    else
-        if ! sh /usr/share/$PACKAGE/test_drm/build_in_tmp \
-            --no-dkms --no-print-directory >> $LOG 2>&1; then
-            printf "\nYour guest system does not seem to have sufficient OpenGL support to enable\naccelerated 3D effects (this requires Linux 2.6.27 or later in the guest\nsystem).  This Guest Additions feature will be disabled.\n\n"
-            BUILDVBOXVIDEO=""
-        fi
-    fi
-    echo
-    if [ -n "$BUILDVBOXGUEST" ]; then
-        begin "Building the main Guest Additions module"
-        if ! $BUILDVBOXGUEST \
-            --save-module-symvers /tmp/vboxguest-Module.symvers \
-            --no-print-directory install >> $LOG 2>&1; then
-            fail "Look at $LOG to find out what went wrong"
-        fi
-        succ_msg
-    fi
-    if [ -n "$BUILDVBOXSF" ]; then
-        begin "Building the shared folder support module"
-        if ! $BUILDVBOXSF \
-            --use-module-symvers /tmp/vboxguest-Module.symvers \
-            --no-print-directory install >> $LOG 2>&1; then
-            fail "Look at $LOG to find out what went wrong"
-        fi
-        succ_msg
-    fi
-    if [ -n "$BUILDVBOXVIDEO" ]; then
-        begin "Building the OpenGL support module"
-        if ! $BUILDVBOXVIDEO \
-            --use-module-symvers /tmp/vboxguest-Module.symvers \
-            --no-print-directory install >> $LOG 2>&1; then
-            fail "Look at $LOG to find out what went wrong"
-        fi
-        succ_msg
-    fi
-    depmod
-
-    begin "Doing non-kernel setup of the Guest Additions"
-    echo "Creating user for the Guest Additions." >> $LOG
-    # This is the LSB version of useradd and should work on recent
-    # distributions
-    useradd -d /var/run/vboxadd -g 1 -r -s /bin/false vboxadd >/dev/null 2>&1
-    # And for the others, we choose a UID ourselves
-    useradd -d /var/run/vboxadd -g 1 -u 501 -o -s /bin/false vboxadd >/dev/null 2>&1
-
-    # Create udev description file
-    if [ -d /etc/udev/rules.d ]; then
-        echo "Creating udev rule for the Guest Additions kernel module." >> $LOG
-        udev_call=""
-        udev_app=`which udevadm 2> /dev/null`
-        if [ $? -eq 0 ]; then
-            udev_call="${udev_app} version 2> /dev/null"
-        else
-            udev_app=`which udevinfo 2> /dev/null`
-            if [ $? -eq 0 ]; then
-                udev_call="${udev_app} -V 2> /dev/null"
-            fi
-        fi
-        udev_fix="="
-        if [ "${udev_call}" != "" ]; then
-            udev_out=`${udev_call}`
-            udev_ver=`expr "$udev_out" : '[^0-9]*\([0-9]*\)'`
-            if [ "$udev_ver" = "" -o "$udev_ver" -lt 55 ]; then
-               udev_fix=""
-            fi
-        fi
-        ## @todo 60-vboxadd.rules -> 60-vboxguest.rules ?
-        echo "KERNEL=${udev_fix}\"vboxguest\", NAME=\"vboxguest\", OWNER=\"vboxadd\", MODE=\"0660\"" > /etc/udev/rules.d/60-vboxadd.rules
-        echo "KERNEL=${udev_fix}\"vboxuser\", NAME=\"vboxuser\", OWNER=\"vboxadd\", MODE=\"0666\"" >> /etc/udev/rules.d/60-vboxadd.rules
-    fi
-
-    # Put mount.vboxsf in the right place
-    ln -sf "$lib_path/$PACKAGE/mount.vboxsf" /sbin
-    # At least Fedora 11 and Fedora 12 demand on the correct security context when
-    # executing this command from service scripts. Shouldn't hurt for other distributions.
-    chcon -u system_u -t mount_exec_t "$lib_path/$PACKAGE/mount.vboxsf" > /dev/null 2>&1
-
-    succ_msg
-    if [ -n "$BUILDVBOXGUEST" ]; then
-        if running_vboxguest || running_vboxadd; then
-            printf "You should restart your guest to make sure the new modules are actually used\n\n"
-        else
-            start
-        fi
-    fi
+	begin "Recompiling VirtualBox kernel modules, NOT. It has been packaged."
+	succ_msg
 }
 
 # cleanup_script