Changeset 94308 in vbox for trunk/src/VBox/Additions/linux/installer
- Timestamp:
- Mar 18, 2022 6:52:14 PM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 150592
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/installer/vboxadd.sh
r93374 r94308 135 135 MODULE_SRC="$INSTALL_DIR/src/vboxguest-$INSTALL_VER" 136 136 BUILDINTMP="$MODULE_SRC/build_in_tmp" 137 138 # Attempt to detect VirtualBox Guest Additions version and revision information. 139 VBOXCLIENT="${INSTALL_DIR}/bin/VBoxClient" 140 VBOX_VERSION="`"$VBOXCLIENT" --version | cut -d r -f1`" 141 [ -n "$VBOX_VERSION" ] || VBOX_VERSION='unknown' 142 VBOX_REVISION="r`"$VBOXCLIENT" --version | cut -d r -f2`" 143 [ "$VBOX_REVISION" != "r" ] || VBOX_REVISION='unknown' 137 144 138 145 running_vboxguest() … … 404 411 } 405 412 413 # Returns path to module file as seen by modinfo(8) or empty string. 414 module_path() 415 { 416 mod="$1" 417 [ -n "$mod" ] || return 418 419 modinfo "$mod" 2>/dev/null | grep -e "^filename:" | tr -s ' ' | cut -d " " -f2 420 } 421 422 # Returns module version if module is available or empty string. 423 module_version() 424 { 425 mod="$1" 426 [ -n "$mod" ] || return 427 428 modinfo "$mod" 2>/dev/null | grep -e "^version:" | tr -s ' ' | cut -d " " -f2 429 } 430 431 # Returns module revision if module is available in the system or empty string. 432 module_revision() 433 { 434 mod="$1" 435 [ -n "$mod" ] || return 436 437 modinfo "$mod" 2>/dev/null | grep -e "^version:" | tr -s ' ' | cut -d " " -f3 438 } 439 440 # Returns "1" if externally built module is available in the system and its 441 # version and revision number do match to current VirtualBox installation. 442 # Or empty string otherwise. 443 module_available() 444 { 445 mod="$1" 446 [ -n "$mod" ] || return 447 448 [ "$VBOX_VERSION" = "$(module_version "$mod")" ] || return 449 [ "$VBOX_REVISION" = "$(module_revision "$mod")" ] || return 450 451 # Check if module belongs to VirtualBox installation. 452 # 453 # We have a convention that only modules from /lib/modules/*/misc 454 # belong to us. Modules from other locations are treated as 455 # externally built. 456 mod_path="$(module_path "$mod")" 457 458 # If module path points to a symbolic link, resolve actual file location. 459 [ -L "$mod_path" ] && mod_path="$(readlink -e -- "$mod_path")" 460 461 # File exists? 462 [ -f "$mod_path" ] || return 463 464 # Extract last component of module path and check whether it is located 465 # outside of /lib/modules/*/misc. 466 mod_dir="$(dirname "$mod_path" | sed 's;^.*/;;')" 467 [ "$mod_dir" = "misc" ] || return 468 469 echo "1" 470 } 471 472 # Check if required modules are installed in the system and versions match. 473 setup_complete() 474 { 475 [ "$(module_available vboxguest)" = "1" ] || return 476 [ "$(module_available vboxsf)" = "1" ] || return 477 478 # All modules are in place. 479 echo "1" 480 } 481 406 482 # setup_script 407 483 setup() … … 412 488 413 489 if test -z "$INSTALL_NO_MODULE_BUILDS"; then 414 info "Building the VirtualBox Guest Additions kernel modules. This may take a while." 415 info "To build modules for other installed kernels, run" 416 info " /sbin/rcvboxadd quicksetup <version>" 417 info "or" 418 info " /sbin/rcvboxadd quicksetup all" 419 if test -d /lib/modules/"$TARGET_VER"/build; then 420 setup_modules "$TARGET_VER" 421 depmod 490 # Check whether modules setup is already complete for currently running kernel. 491 # Prevent unnecessary rebuilding in order to speed up booting process. 492 if test "$(setup_complete)" = "1"; then 493 info "VirtualBox Guest Additions kernel modules $VBOX_VERSION $VBOX_REVISION are" 494 info "already available for kernel $TARGET_VER and do not require to be rebuilt." 422 495 else 423 info "Kernel headers not found for target kernel $TARGET_VER. \ 496 info "Building the VirtualBox Guest Additions kernel modules. This may take a while." 497 info "To build modules for other installed kernels, run" 498 info " /sbin/rcvboxadd quicksetup <version>" 499 info "or" 500 info " /sbin/rcvboxadd quicksetup all" 501 if test -d /lib/modules/"$TARGET_VER"/build; then 502 setup_modules "$TARGET_VER" 503 depmod 504 else 505 info "Kernel headers not found for target kernel $TARGET_VER. \ 424 506 Please install them and execute 425 507 /sbin/rcvboxadd setup" 508 fi 426 509 fi 427 510 fi
Note:
See TracChangeset
for help on using the changeset viewer.