VirtualBox

Changeset 32183 in vbox for trunk/debian


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

Location:
trunk/debian
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/debian/postinst.in

    r31999 r32183  
    9393  fi
    9494
    95   # try to build a kernel module (disable with INSTALL_NO_VBOXDRV=1 in /etc/default/virtualbox)
    96   REGISTER_DKMS=1
    97   if [ ! -f /lib/modules/`uname -r`/misc/vboxdrv.ko -a "$INSTALL_NO_VBOXDRV" != "1" ]; then
    98     db_get virtualbox/module-compilation-allowed
    99     if [ "$RET" = "false" ]; then
    100       cat << EOF
    101 Unable to find a precompiled module for the current kernel
    102 though module compilation denied by debconf setting.
    103 EOF
    104     else
    105       db_input low virtualbox/module-compilation-allowed || true
    106       db_go || true
    107       db_get virtualbox/module-compilation-allowed
    108       if [ "$RET" = "true" ]; then
    109         # Compile module. Don't show a message box here if everything works well.
    110         cat << EOF
    111 Messages emitted during module compilation will be logged to $LOG.
    112 EOF
    113         rm -f /etc/vbox/module_not_compiled
    114         echo "** Compiling vboxdrv" > /var/log/vbox-install.log
    115         if ! /usr/share/virtualbox/src/vboxdrv/build_in_tmp \
    116             --save-module-symvers /tmp/vboxdrv-Module.symvers \
    117             --no-print-directory KBUILD_VERBOSE= \
    118             install >> /var/log/vbox-install.log 2>&1; then
    119           db_fset virtualbox/module-compilation-failed seen false
    120           db_input critical virtualbox/module-compilation-failed || true
    121           db_go || true
    122           touch /etc/vbox/module_not_compiled
    123           # don't abort the installation!
    124         else
    125           echo "** Compiling vboxnetflt" >> /var/log/vbox-install.log
    126           if ! /usr/share/virtualbox/src/vboxnetflt/build_in_tmp \
    127               --use-module-symvers /tmp/vboxdrv-Module.symvers \
    128               --no-print-directory KBUILD_VERBOSE= \
    129               install >> /var/log/vbox-install.log 2>&1; then
    130             db_fset virtualbox/module-compilation-failed seen false
    131             db_input critical virtualbox/module-compilation-failed || true
    132             db_go || true
    133             touch /etc/vbox/module_not_compiled
    134             # don't abort the installation!
    135           else
    136             echo "** Compiling vboxnetadp" >> /var/log/vbox-install.log
    137             if ! /usr/share/virtualbox/src/vboxnetadp/build_in_tmp \
    138                 --use-module-symvers /tmp/vboxdrv-Module.symvers \
    139                 --no-print-directory KBUILD_VERBOSE= \
    140                 install >> /var/log/vbox-install.log 2>&1; then
    141               db_fset virtualbox/module-compilation-failed seen false
    142               db_input critical virtualbox/module-compilation-failed || true
    143               db_go || true
    144               touch /etc/vbox/module_not_compiled
    145               # don't abort the installation!
    146             fi
    147           fi
    148         fi
    149         # cleanup
    150         rm -f /tmp/vboxdrv-Module.symvers
    151         if [ ! -f /etc/vbox/module_not_compiled ]; then
    152           # success
    153           cat << EOF
    154 Success!
    155 EOF
    156           REGISTER_DKMS=
    157         fi
    158       fi
    159     fi
    160   fi
    161 
    162   # Register at DKMS. If the modules were built above, they are already registered
    163   if [ -n "$REGISTER_DKMS" ]; then
    164     DKMS=`which dkms 2>/dev/null`
    165     if [ -n "$DKMS" ]; then
    166       for m in vboxdrv vboxnetflt vboxnetadp; do
    167         $DKMS status -m $m | while read line; do
    168           if echo "$line" | grep -q added > /dev/null ||
    169              echo "$line" | grep -q built > /dev/null ||
    170              echo "$line" | grep -q installed > /dev/null; then
    171                v=`echo "$line" | sed "s/$m,\([^,]*\)[,:].*/\1/;t;d"`
    172                $DKMS remove -m $m -v $v --all > /dev/null 2>&1
    173           fi
    174         done
    175         $DKMS add -m $m -v %VER% > /dev/null 2>&1
    176       done
    177     fi
    178   fi
    179 
    180   # There might be an old module active (e.g. manually loaded)
    181   if lsmod | grep -q "vboxdrv[^_-]"; then
    182     /etc/init.d/vboxdrv stop || true
    183   fi
    184 
    18595  # The starters need to be Suid root. They drop the privileges before starting
    18696  # the real frontend.
     
    212122#DEBHELPER#
    213123
     124if [ "$1" = "configure" ]; then
     125  # Start vboxdrv/vboxweb-service manually as we use our own error handling in postrm
     126  if [ -x "/etc/init.d/vboxdrv" ]; then
     127    update-rc.d vboxdrv defaults >/dev/null
     128
     129    # There might be an old module active (e.g. manually loaded)
     130    if lsmod | grep -q "vboxdrv[^_-]"; then
     131      /etc/init.d/vboxdrv stop || true
     132    fi
     133
     134    BUILD_MODULES=0
     135    # Disable module compilation with INSTALL_NO_VBOXDRV=1 in /etc/default/virtualbox
     136    if [ ! -f /lib/modules/`uname -r`/misc/vboxdrv.ko -a "$INSTALL_NO_VBOXDRV" != "1" ]; then
     137      db_get virtualbox/module-compilation-allowed
     138      if [ "$RET" = "false" ]; then
     139        cat << EOF
     140Unable to find a precompiled module for the current kernel
     141though module compilation denied by debconf setting.
     142EOF
     143      else
     144        db_input low virtualbox/module-compilation-allowed || true
     145        db_go || true
     146        db_get virtualbox/module-compilation-allowed
     147        if [ "$RET" = "true" ]; then
     148          BUILD_MODULES=1
     149        fi
     150      fi
     151    fi
     152
     153    if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
     154      if [ $BUILD_MODULES -eq 1 ]; then
     155        invoke-rc.d vboxdrv setup || true
     156      else
     157        invoke-rc.d vboxdrv start || exit $?
     158      fi
     159    else
     160      if [ $BUILD_MODULES -eq 1 ]; then
     161        /etc/init.d/vboxdrv setup || true
     162      else
     163        /etc/init.d/vboxdrv start || exit $?
     164      fi
     165    fi
     166  fi
     167  if [ -x "/etc/init.d/vboxweb-service" ]; then
     168    update-rc.d vboxweb-service defaults >/dev/null
     169#    if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
     170#        invoke-rc.d vboxweb-service start || exit $?
     171#    else
     172#        /etc/init.d/vboxweb-service start || exit $?
     173#    fi
     174  fi
     175
     176fi # $1 = "configure"
     177
    214178exit 0
  • trunk/debian/prerm.in

    r32030 r32183  
    4444
    4545# make sure we de-register the DMKS modules before the files get removed
    46 DKMS=`which dkms 2>/dev/null`
    47 if [ -n "$DKMS" ]; then
    48   $DKMS remove -m vboxnetadp -v %VER% --all > /dev/null 2>&1 || true
    49   $DKMS remove -m vboxnetflt -v %VER% --all > /dev/null 2>&1 || true
    50   $DKMS remove -m vboxdrv -v %VER% --all > /dev/null 2>&1 || true
     46if [ "$1" = "upgrade" -o "$1" = "remove" -o "$1" = "deconfigure" ]; then
     47  DKMS=`which dkms 2>/dev/null`
     48  if [ -n "$DKMS" ]; then
     49    $DKMS remove -m vboxhost -v %VER% --all > /dev/null 2>&1 || true
     50  fi
    5151fi
    5252
  • trunk/debian/rules

    r32045 r32183  
    250250            usr/bin/VBox                        usr/bin/VBoxHeadless \
    251251            $(if $(NOWEBSVC),,usr/bin/VBox      usr/bin/vboxwebsrv) \
    252             usr/share/virtualbox/src/vboxdrv    usr/src/vboxdrv-$(ver) \
    253             usr/share/virtualbox/src/vboxnetflt usr/src/vboxnetflt-$(ver) \
    254             usr/share/virtualbox/src/vboxnetadp usr/src/vboxnetadp-$(ver)
     252            usr/share/virtualbox/src/vboxhost   usr/src/vboxhost-$(ver)
    255253        dh_desktop
    256254        dh_installmenu
Note: See TracChangeset for help on using the changeset viewer.

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