VirtualBox

Changeset 89203 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 20, 2021 4:32:38 PM (4 years ago)
Author:
vboxsync
Message:

Installer: Linux: vboxdrv.sh: update modules rebuild logic, bugref:9958.

Do not trigger modules rebuild if they are already available in system,
their version matches to current VirtualBox installation and they are
located outside of /lib/modules/*/misc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Installer/linux/vboxdrv.sh

    r89173 r89203  
    274274}
    275275
     276# Returns path to module file as seen by modinfo(8) or empty string.
     277module_path()
     278{
     279    mod="$1"
     280    [ -n "$mod" ] || return
     281
     282    modinfo "$mod" 2>/dev/null | grep -e "^filename:" | tr -s ' ' | cut -d " " -f2
     283}
     284
    276285# Returns module version if module is available or empty string.
    277286module_version()
     
    292301}
    293302
    294 # Returns "1" if module is available in the system and its version and revision
    295 # number do match to current VirtualBox installation. Or empty string otherwise.
     303# Returns "1" if externally built module is available in the system and its
     304# version and revision number do match to current VirtualBox installation.
     305# Or empty string otherwise.
    296306module_available()
    297307{
     
    299309    [ -n "$mod" ] || return
    300310
    301     [ "$VBOX_VERSION" = "$(module_version $mod)" ] || return
    302     [ "$VBOX_REVISION" = "$(module_revision $mod)" ] || return
     311    [ "$VBOX_VERSION" = "$(module_version "$mod")" ] || return
     312    [ "$VBOX_REVISION" = "$(module_revision "$mod")" ] || return
     313
     314    # Check if module belongs to VirtualBox installation.
     315    #
     316    # We have a convention that only modules from /lib/modules/*/misc
     317    # belong to us. Modules from other locations are treated as
     318    # externally built.
     319    mod_path="$(module_path "$mod")"
     320
     321    # If module path points to a symbolic link, resolve actual file location.
     322    [ -L "$mod_path" ] && mod_path="$(readlink -e -- "$mod_path")"
     323
     324    # File exists?
     325    [ -f "$mod_path" ] || return
     326
     327    # Extract last component of module path and check whether it is located
     328    # outside of /lib/modules/*/misc.
     329    mod_dir="$(dirname "$mod_path" | sed 's;^.*/;;')"
     330    [ "$mod_dir" != "misc" ] || return
    303331
    304332    echo "1"
     
    332360    fi
    333361
    334     # Check if system already has matching modules installed.
    335     [ "$(setup_complete)" = "1" ] || setup
    336 
    337362    if ! running vboxdrv; then
     363
     364        # Check if system already has matching modules installed.
     365        [ "$(setup_complete)" = "1" ] || setup
     366
    338367        if ! rm -f $DEVICE; then
    339368            failure "Cannot remove $DEVICE"
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