VirtualBox

Ignore:
Timestamp:
Sep 1, 2010 3:53:42 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
65467
Message:

Linux Installer/Additions: attempt to properly register the host/guest kernel modules at DKMS and use the setup function of the service script to compile the modules instead of doing this separately in the installer scripts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/VBox/Installer/linux/rpm/VirtualBox.tmpl.spec

    r32008 r32183  
    135135ln -s VBox $RPM_BUILD_ROOT/usr/bin/VBoxHeadless
    136136ln -s VBox $RPM_BUILD_ROOT/usr/bin/vboxwebsrv
    137 ln -s /usr/share/virtualbox/src/vboxdrv $RPM_BUILD_ROOT/usr/src/vboxdrv-%VER%
    138 ln -s /usr/share/virtualbox/src/vboxnetflt $RPM_BUILD_ROOT/usr/src/vboxnetflt-%VER%
    139 ln -s /usr/share/virtualbox/src/vboxnetadp $RPM_BUILD_ROOT/usr/src/vboxnetadp-%VER%
     137ln -s /usr/share/virtualbox/src/vboxhost $RPM_BUILD_ROOT/usr/src/vboxhost-%VER%
    140138mv virtualbox.desktop $RPM_BUILD_ROOT/usr/share/applications/virtualbox.desktop
    141139mv VBox.png $RPM_BUILD_ROOT/usr/share/pixmaps/VBox.png
     
    267265%endif
    268266
    269 # try to build a kernel module (disable with INSTALL_NO_VBOXDRV=1 in /etc/default/virtualbox)
    270 REGISTER_DKMS=1
     267# Disable module compilation with INSTALL_NO_VBOXDRV=1 in /etc/default/virtualbox
     268BUILD_MODULES=0
    271269if [ ! -f /lib/modules/`uname -r`/misc/vboxdrv.ko -a "$INSTALL_NO_VBOXDRV" != "1" ]; then
    272270  # compile problem
     
    276274
    277275EOF
    278   rm -f /etc/vbox/module_not_compiled
    279   echo "** Compiling vboxdrv" > /var/log/vbox-install.log
    280   if ! /usr/share/virtualbox/src/vboxdrv/build_in_tmp \
    281     --save-module-symvers /tmp/vboxdrv-Module.symvers \
    282     --no-print-directory KBUILD_VERBOSE= \
    283     install >> /var/log/vbox-install.log 2>&1; then
    284     cat << EOF
    285 Compilation of the kernel module FAILED! VirtualBox will not start until this
    286 problem is fixed. Please consult $LOG to find out why the
    287 kernel module does not compile. Most probably the kernel sources are not found.
    288 Install them and execute
    289 
    290   /etc/init.d/vboxdrv setup
    291 
    292 as root.
    293 
    294 EOF
    295     touch /etc/vbox/module_not_compiled
    296   else
    297     echo "** Compiling vboxnetflt" >> /var/log/vbox-install.log
    298     if ! /usr/share/virtualbox/src/vboxnetflt/build_in_tmp \
    299       --use-module-symvers /tmp/vboxdrv-Module.symvers \
    300       --no-print-directory KBUILD_VERBOSE= \
    301       install >> /var/log/vbox-install.log 2>&1; then
    302       cat << EOF
    303 Compilation of the kernel module FAILED! VirtualBox will not start until this
    304 problem is fixed. Please consult $LOG to find out why the
    305 kernel module does not compile. Most probably the kernel sources are not found.
    306 Install them and execute
    307 
    308   /etc/init.d/vboxdrv setup
    309 
    310 as root.
    311 
    312 EOF
    313       touch /etc/vbox/module_not_compiled
    314     else
    315       echo "** Compiling vboxnetadp" >> /var/log/vbox-install.log
    316       if ! /usr/share/virtualbox/src/vboxnetadp/build_in_tmp \
    317         --use-module-symvers /tmp/vboxdrv-Module.symvers \
    318         --no-print-directory KBUILD_VERBOSE= \
    319         install >> /var/log/vbox-install.log 2>&1; then
    320         cat << EOF
    321 Compilation of the kernel module FAILED! VirtualBox will not start until this
    322 problem is fixed. Please consult $LOG to find out why the
    323 kernel module does not compile. Most probably the kernel sources are not found.
    324 Install them and execute
    325 
    326   /etc/init.d/vboxdrv setup
    327 
    328 as root.
    329 
    330 EOF
    331         touch /etc/vbox/module_not_compiled
    332       fi
    333     fi
    334   fi
    335   rm -f /tmp/vboxdrv-Module.symvers
    336   if [ ! -f /etc/vbox/module_not_compiled ]; then
    337     cat << EOF
    338 Success!
    339 
    340 EOF
    341     REGISTER_DKMS=
    342   fi
    343 fi
    344 # Register at DKMS. If the modules were built above, they are already registered
    345 if [ -n "$REGISTER_DKMS" ]; then
    346   DKMS=`which dkms 2>/dev/null`
    347   if [ -n "$DKMS" ]; then
    348     for m in vboxdrv vboxnetflt vboxnetadp; do
    349       $DKMS status -m $m | while read line; do
    350         if echo "$line" | grep -q added > /dev/null ||
    351            echo "$line" | grep -q built > /dev/null ||
    352            echo "$line" | grep -q installed > /dev/null; then
    353              v=`echo "$line" | sed "s/$m,\([^,]*\)[,:].*/\1/;t;d"`
    354              $DKMS remove -m $m -v $v --all > /dev/null 2>&1
    355         fi
    356       done
    357       $DKMS add -m $m -v %VER% > /dev/null 2>&1
    358     done
    359   fi
     276  BUILD_MODULES=1
    360277fi
    361278# if INSTALL_NO_VBOXDRV is set to 1, remove all shipped modules
     
    368285  /etc/init.d/vboxdrv stop || true
    369286fi
    370 if [ ! -f /etc/vbox/module_not_compiled ]; then
    371   depmod -a
     287if [ $BUILD_MODULES -eq 1 ]; then
     288  /etc/init.d/vboxdrv setup || true
     289else
    372290  /etc/init.d/vboxdrv start > /dev/null
    373   /etc/init.d/vboxweb-service start > /dev/null
    374 fi
     291fi
     292/etc/init.d/vboxweb-service start > /dev/null
    375293
    376294
     
    405323DKMS=`which dkms 2>/dev/null`
    406324if [ -n "$DKMS" ]; then
    407   $DKMS remove -m vboxnetadp -v %VER% --all > /dev/null 2>&1 || true
    408   $DKMS remove -m vboxnetflt -v %VER% --all > /dev/null 2>&1 || true
    409   $DKMS remove -m vboxdrv -v %VER% --all > /dev/null 2>&1 || true
     325  $DKMS remove -m vboxhost -v %VER% --all > /dev/null 2>&1 || true
    410326fi
    411327
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette