Changeset 77306 in vbox for trunk/src/VBox/Additions/linux
- Timestamp:
- Feb 14, 2019 10:10:46 AM (6 years ago)
- Location:
- trunk/src/VBox/Additions/linux
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/Makefile.kmk
r77003 r77306 446 446 $(QUIET)$(VBOX_MAKESELF) --nocomp $(VBOX_LNX_ADD_INST_STAGE_DIR) $@ \ 447 447 "VirtualBox $(VBOX_VERSION_STRING) Guest Additions for Linux" \ 448 /bin/sh ./install.sh "\$$0 1> /dev/null"449 448 /bin/sh ./install.sh "\$$0" 449 -
trunk/src/VBox/Additions/linux/installer/install.sh.in
r77077 r77306 363 363 rm -f "$CONFIG_DIR/$CONFIG" 364 364 rm -f "$CONFIG_DIR/$CONFIG_FILES" 365 rmdir "$CONFIG_DIR" 2>/dev/null 365 rmdir "$CONFIG_DIR" 2>/dev/null || true 366 366 test "$ACTION" = "install" || exit 0 367 367 … … 467 467 fi 468 468 469 "$INSTALLATION_DIR /init/vboxadd" setup 1>&2 2>> "${LOGFILE}"469 "$INSTALLATION_DIR"/init/vboxadd setup 2>&1 | tee -a "$LOGFILE" 470 470 471 471 # Install, set up and start init scripts -
trunk/src/VBox/Additions/linux/installer/vboxadd.sh
r77049 r77306 57 57 OLDMODULES="vboxguest vboxadd vboxsf vboxvfs vboxvideo" 58 58 SERVICE="VirtualBox Guest Additions" 59 QUICKSETUP=60 59 ## systemd logs information about service status, otherwise do that ourselves. 61 60 QUIET= … … 63 62 # Marker to ignore a particular kernel version which was already installed. 64 63 SKIPFILE_BASE=/var/lib/VBoxGuestAdditions/skip 64 export BUILD_TYPE 65 export USERNAME 65 66 66 67 setup_log() … … 79 80 fi 80 81 81 # Check architecture82 cpu=`uname -m`;83 case "$cpu" in84 i[3456789]86|x86)85 cpu="x86"86 ldconfig_arch="(libc6)"87 lib_candidates="/usr/lib/i386-linux-gnu /usr/lib /lib"88 ;;89 x86_64|amd64)90 cpu="amd64"91 ldconfig_arch="(libc6,x86-64)"92 lib_candidates="/usr/lib/x86_64-linux-gnu /usr/lib64 /usr/lib /lib64 /lib"93 ;;94 esac95 for i in $lib_candidates; do96 if test -d "$i/VBoxGuestAdditions"; then97 lib_path=$i98 break99 fi100 done101 102 82 # Preamble for Gentoo 103 83 if [ "`which $0`" = "/sbin/rc" ]; then … … 153 133 test -n "$INSTALL_DIR" -a -n "$INSTALL_VER" || 154 134 fail "Configuration file $config not complete" 135 MODULE_SRC="$INSTALL_DIR/src/vboxguest-$INSTALL_VER" 136 BUILDINTMP="$MODULE_SRC/build_in_tmp" 155 137 156 138 running_vboxguest() … … 220 202 fi 221 203 fi 222 }223 224 start()225 {226 begin "Starting."227 if test -z "${INSTALL_NO_MODULE_BUILDS}"; then228 setup --quick229 test -d /sys &&230 ps -A -o comm | grep -q '/*udevd$' 2>/dev/null ||231 no_udev=1232 running_vboxguest || {233 rm -f $dev || {234 fail "Cannot remove $dev"235 }236 rm -f $userdev || {237 fail "Cannot remove $userdev"238 }239 $MODPROBE vboxguest >/dev/null 2>&1 ||240 fail "modprobe vboxguest failed"241 case "$no_udev" in 1)242 sleep .5;;243 esac244 }245 case "$no_udev" in 1)246 do_vboxguest_non_udev;;247 esac248 249 running_vboxsf || {250 $MODPROBE vboxsf > /dev/null 2>&1 ||251 info "modprobe vboxsf failed"252 }253 fi # INSTALL_NO_MODULE_BUILDS254 255 # Put the X.Org driver in place. This is harmless if it is not needed.256 # Also set up the OpenGL library.257 myerr=`"${INSTALL_DIR}/init/vboxadd-x11" setup 2>&1`258 test -z "${myerr}" || log "${myerr}"259 260 # Mount all shared folders from /etc/fstab. Normally this is done by some261 # other startup script but this requires the vboxdrv kernel module loaded.262 # This isn't necessary anymore as the vboxsf module is autoloaded.263 # mount -a -t vboxsf264 265 return 0266 }267 268 stop()269 {270 begin "Stopping."271 test -n "${INSTALL_NO_MODULE_BUILDS}" || setup --quick272 if test -r /etc/ld.so.conf.d/00vboxvideo.conf; then273 rm /etc/ld.so.conf.d/00vboxvideo.conf274 ldconfig275 fi276 if ! umount -a -t vboxsf 2>/dev/null; then277 fail "Cannot unmount vboxsf folders"278 fi279 test -n "${INSTALL_NO_MODULE_BUILDS}" ||280 info "You may need to restart your guest system to finish removing the guest drivers."281 return 0282 204 } 283 205 … … 358 280 test ! -f /lib/modules/"$KERN_VER"/misc/vboxguest.o || return 0 359 281 test -d /lib/modules/"$KERN_VER"/build || return 0 360 test ! -f "$SKIPFILE_BASE"-"$KERN_VER" || return 0361 282 export KERN_VER 362 283 info "Building the modules for kernel $KERN_VER." … … 451 372 #!/bin/sh 452 373 for i in ${OLDMODULES}; do rm -f /lib/modules/"\${1}"/misc/"\${i}".ko; done 453 rmdir -p /lib/modules/"\$1"/misc 2>/dev/null 374 rmdir -p /lib/modules/"\$1"/misc 2>/dev/null || true 454 375 exit 0 455 376 EOF … … 482 403 setup() 483 404 { 484 export BUILD_TYPE485 export USERNAME486 487 test x"$1" != x--quick || QUICKSETUP=true488 test -n "$QUICKSETUP" || cleanup489 MODULE_SRC="$INSTALL_DIR/src/vboxguest-$INSTALL_VER"490 BUILDINTMP="$MODULE_SRC/build_in_tmp"491 405 # chcon is needed on old Fedora/Redhat systems. No one remembers which. 492 406 test ! -e /etc/selinux/config || … … 494 408 495 409 if test -z "$INSTALL_NO_MODULE_BUILDS"; then 496 if test -z "$QUICKSETUP"; then 497 info "Building the VirtualBox Guest Additions kernel modules. This may take a while." 498 info "To build modules for other installed kernels, run" 499 info " /sbin/rcvboxadd quicksetup <version>" 500 for setupi in /lib/modules/*; do 501 KERN_VER="${setupi##*/}" 502 # For a full setup, mark kernels we do not want to build. 503 touch "$SKIPFILE_BASE"-"$KERN_VER" 504 done 505 fi 506 # That is, we mark all but the requested kernel. 507 rm -f "$SKIPFILE_BASE"-"$TARGET_VER" 508 test -d /lib/modules/"$TARGET_VER"/build || test -n "$QUICKSETUP" || 410 info "Building the VirtualBox Guest Additions kernel modules. This may take a while." 411 info "To build modules for other installed kernels, run" 412 info " /sbin/rcvboxadd quicksetup <version>" 413 info "or" 414 info " /sbin/rcvboxadd quicksetup all" 415 if test -d /lib/modules/"$TARGET_VER"/build; then 416 setup_modules "$TARGET_VER" 417 depmod 418 else 509 419 info "Kernel headers not found for target kernel $TARGET_VER. \ 510 420 Please install them and execute 511 421 /sbin/rcvboxadd setup" 512 for setupi in /lib/modules/*; do 513 KERN_VER="${setupi##*/}" 514 setup_modules "$KERN_VER" 515 done 516 depmod 422 fi 517 423 fi 518 424 create_vbox_user 519 425 create_udev_rule 520 426 test -n "${INSTALL_NO_MODULE_BUILDS}" || create_module_rebuild_script 521 test -z "$QUICKSETUP" || return 0522 427 shared_folder_setup 523 428 if running_vboxguest || running_vboxadd; then 524 429 info "Running kernel modules will not be replaced until the system is restarted" 525 430 fi 431 432 # Put the X.Org driver in place. This is harmless if it is not needed. 433 # Also set up the OpenGL library. 434 myerr=`"${INSTALL_DIR}/init/vboxadd-x11" setup 2>&1` 435 test -z "${myerr}" || log "${myerr}" 436 526 437 return 0 527 438 } … … 547 458 if test -z "${INSTALL_NO_MODULE_BUILDS}"; then 548 459 rm -f /etc/kernel/postinst.d/vboxadd /etc/kernel/prerm.d/vboxadd 549 rmdir -p /etc/kernel/postinst.d /etc/kernel/prerm.d 2>/dev/null 550 fi 551 rm /sbin/mount.vboxsf 2>/dev/null 552 rm /etc/udev/rules.d/60-vboxadd.rules 2>/dev/null 460 rmdir -p /etc/kernel/postinst.d /etc/kernel/prerm.d 2>/dev/null || true 461 fi 462 rm -f /sbin/mount.vboxsf 2>/dev/null 463 rm -f /etc/udev/rules.d/60-vboxadd.rules 2>/dev/null 464 } 465 466 start() 467 { 468 begin "Starting." 469 if test -z "${INSTALL_NO_MODULE_BUILDS}"; then 470 # We want to build modules for newly installed kernels on shutdown, so 471 # mark the ones already present. These will be ignored on shutdown. 472 rm -f "$SKIPFILE_BASE"-* 473 for setupi in /lib/modules/*; do 474 KERN_VER="${setupi##*/}" 475 # For a full setup, mark kernels we do not want to build. 476 touch "$SKIPFILE_BASE"-"$KERN_VER" 477 done 478 fi 479 setup 480 if test -z "${INSTALL_NO_MODULE_BUILDS}"; then 481 test -d /sys && 482 ps -A -o comm | grep -q '/*udevd$' 2>/dev/null || 483 no_udev=1 484 running_vboxguest || { 485 rm -f $dev || { 486 fail "Cannot remove $dev" 487 } 488 rm -f $userdev || { 489 fail "Cannot remove $userdev" 490 } 491 $MODPROBE vboxguest >/dev/null 2>&1 || 492 fail "modprobe vboxguest failed" 493 case "$no_udev" in 1) 494 sleep .5;; 495 esac 496 $MODPROBE vboxsf > /dev/null 2>&1 || 497 info "modprobe vboxsf failed" 498 } 499 case "$no_udev" in 1) 500 do_vboxguest_non_udev;; 501 esac 502 fi # INSTALL_NO_MODULE_BUILDS 503 504 return 0 505 } 506 507 stop() 508 { 509 begin "Stopping." 510 if test -z "${INSTALL_NO_MODULE_BUILDS}"; then 511 # We want to build modules for newly installed kernels on shutdown, so 512 # check which we marked at start-up. 513 for setupi in /lib/modules/*; do 514 KERN_VER="${setupi##*/}" 515 # For a full setup, mark kernels we do not want to build. 516 test -f "$SKIPFILE_BASE"-"$KERN_VER" || setup_modules "$KERN_VER" 517 done 518 fi 519 if test -r /etc/ld.so.conf.d/00vboxvideo.conf; then 520 rm /etc/ld.so.conf.d/00vboxvideo.conf 521 ldconfig 522 fi 523 if ! umount -a -t vboxsf 2>/dev/null; then 524 fail "Cannot unmount vboxsf folders" 525 fi 526 test -n "${INSTALL_NO_MODULE_BUILDS}" || 527 info "You may need to restart your guest system to finish removing guest drivers." 528 return 0 553 529 } 554 530 … … 562 538 } 563 539 564 case "$2" in quiet) 565 QUIET=yes;;566 esac 540 for i; do 541 case "$i" in quiet) QUIET=yes;; esac 542 done 567 543 case "$1" in 544 # Does setup without clean-up first and marks all kernels currently found on the 545 # system so that we can see later if any were added. 568 546 start) 569 547 start 570 548 ;; 549 # Tries to build kernel modules for kernels added since start. Tries to unmount 550 # shared folders. Uninstalls our Chromium 3D libraries since we can't always do 551 # this fast enough at start time if we discover we do not want to use them. 571 552 stop) 572 553 stop … … 575 556 restart 576 557 ;; 558 # Setup does a clean-up (see below) and re-does all Additions-specific 559 # configuration of the guest system, including building kernel modules for the 560 # current kernel. 577 561 setup) 578 setup579 start580 ;; 562 cleanup && start 563 ;; 564 # Builds kernel modules for the specified kernels if they are not already built. 581 565 quicksetup) 582 test -z "$2" || test ! -d /lib/modules/"$2"/build || TARGET_VER="$2" 583 setup --quick 584 ;; 566 if test x"$2" = xall; then 567 for i in /lib/modules/*; do 568 KERN_VER="${i%/misc}" 569 KERN_VER="${KERN_VER#/lib/modules/}" 570 setup_modules "$KERN_VER" 571 done 572 elif test -n "$2"; then 573 setup_modules "$2" 574 else 575 setup_modules "$TARGET_VER" 576 fi 577 ;; 578 # Clean-up removes all Additions-specific configuration of the guest system, 579 # including all kernel modules. 585 580 cleanup) 586 581 cleanup
Note:
See TracChangeset
for help on using the changeset viewer.