Changeset 66401 in vbox
- Timestamp:
- Apr 3, 2017 2:01:06 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 114353
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/installer/vboxadd.sh
r66388 r66401 32 32 # changes please try to reduce differences between the two wherever possible. 33 33 34 # Testing: 35 # * Should fail if the configuration file is missing or missing INSTALL_[DIR|VER]. 36 # * vboxadd user and vboxsf groups should be created if they do not exist. 37 # * udev rule should be successfully created. 38 # * Shared folders can be mounted and auto-mounts accessible to vboxsf group, 39 # including on recent Fedoras with SELinux. 40 # * Setting INSTALL_NO_MODULE_BUILDS does not set up modules, users, udev. 41 # * rcvboxadd udev sets up udev but not modules, users, shared folders. 42 34 43 PATH=$PATH:/bin:/sbin:/usr/sbin 35 44 PACKAGE=VBoxGuestAdditions … … 110 119 owner=vboxadd 111 120 group=1 121 122 if test -r $config; then 123 . $config 124 else 125 fail "Configuration file $config not found" 126 fi 127 test -n "$INSTALL_DIR" -a -n "$INSTALL_VER" || 128 fail "Configuration file $config not complete" 112 129 113 130 running_vboxguest() … … 184 201 # If we got this far assume that the slow set-up has been done. 185 202 QUICKSETUP=yes 186 if test -r $config; then187 . $config188 else189 fail "Configuration file $config not found"190 fi191 test -n "$INSTALL_DIR" -a -n "$INSTALL_VER" ||192 fail "Configuration file $config not complete"193 203 uname -r | grep -q -E '^2\.6|^3|^4' 2>/dev/null && 194 204 ps -A -o comm | grep -q '/*udevd$' 2>/dev/null || … … 321 331 "${INSTALL_DIR}"/other/check_module_dependencies.sh 2>&1 && 322 332 info "Look at $LOG to find out what went wrong" 323 return 1333 return 0 324 334 fi 325 335 log "Building the shared folder support module" … … 329 339 --no-print-directory install >> $LOG 2>&1; then 330 340 info "Look at $LOG to find out what went wrong" 331 return 1341 return 0 332 342 fi 333 343 log "Building the graphics driver module" … … 346 356 } 347 357 348 # Do non-kernel bits needed for the kernel modules to work properly (user 349 # creation, udev, mount helper...) 350 extra_setup() 358 create_vbox_user() 351 359 { 352 360 log "Creating user for the Guest Additions." … … 357 365 useradd -d /var/run/vboxadd -g 1 -u 501 -o -s /bin/false vboxadd >/dev/null 2>&1 358 366 359 # Add a group "vboxsf" for Shared Folders access 360 # All users which want to access the auto-mounted Shared Folders have to 361 # be added to this group. 362 groupadd -r -f vboxsf >/dev/null 2>&1 363 367 } 368 369 create_udev_rule() 370 { 364 371 # Create udev description file 365 372 if [ -d /etc/udev/rules.d ]; then … … 387 394 echo "KERNEL=${udev_fix}\"vboxuser\", NAME=\"vboxuser\", OWNER=\"vboxadd\", MODE=\"0666\"" >> /etc/udev/rules.d/60-vboxadd.rules 388 395 fi 389 390 # Put mount.vboxsf in the right place 391 ln -sf "${INSTALL_DIR}/other/mount.vboxsf" /sbin 396 } 397 398 create_module_rebuild_script() 399 { 392 400 # And a post-installation script for rebuilding modules when a new kernel 393 401 # is installed. … … 407 415 EOF 408 416 chmod 0755 /etc/kernel/postinst.d/vboxadd /etc/kernel/prerm.d/vboxadd 417 } 418 419 shared_folder_setup() 420 { 421 # Add a group "vboxsf" for Shared Folders access 422 # All users which want to access the auto-mounted Shared Folders have to 423 # be added to this group. 424 groupadd -r -f vboxsf >/dev/null 2>&1 425 426 # Put the mount.vboxsf mount helper in the right place. 427 ## @todo It would be nicer if the kernel module just parsed parameters 428 # itself instead of needing a separate binary to do that. 429 ln -sf "${INSTALL_DIR}/other/mount.vboxsf" /sbin 409 430 # SELinux security context for the mount helper. 410 431 if test -e /etc/selinux/config; then … … 421 442 setup() 422 443 { 423 if test -r $config; then424 . $config425 else426 fail "Configuration file $config not found"427 fi428 test -n "$INSTALL_DIR" -a -n "$INSTALL_VER" ||429 fail "Configuration file $config not complete"430 444 export BUILD_TYPE 431 445 export USERNAME … … 435 449 chcon -t bin_t "$BUILDINTMP" > /dev/null 2>&1 436 450 437 if test -n "${INSTALL_NO_MODULE_BUILDS}" || setup_modules; then 438 mod_succ=0 439 else 440 mod_succ=1 441 fi 442 test -n "${QUICKSETUP}" && return "${mod_succ}" 443 extra_setup 444 test -n "${INSTALL_NO_MODULE_BUILDS}" && return 0 445 if [ "$mod_succ" -eq "0" ]; then 446 if running_vboxguest || running_vboxadd; then 447 info "You should restart your guest to make sure the new modules are actually used" 448 fi 449 fi 450 return "${mod_succ}" 451 setup_modules 452 create_vbox_user 453 create_udev_rule 454 create_module_rebuild_script 455 test -n "${QUICKSETUP}" && return 0 456 shared_folder_setup 457 if running_vboxguest || running_vboxadd; then 458 info "Running kernel modules will not be replaced until the system is restarted" 459 fi 460 return 0 451 461 } 452 462 … … 454 464 cleanup() 455 465 { 456 if test -r $config; then457 . $config458 test -n "$INSTALL_DIR" -a -n "$INSTALL_VER" ||459 fail "Configuration file $config not complete"460 else461 fail "Configuration file $config not found"462 fi463 464 466 # Delete old versions of VBox modules. 465 467 cleanup_modules … … 504 506 ;; 505 507 setup) 506 setup && start 508 if test -z "${INSTALL_NO_MODULE_BUILDS}"; then 509 setup 510 else 511 shared_folder_setup 512 fi 513 start 507 514 ;; 508 515 quicksetup) 509 516 QUICKSETUP=yes 510 517 setup 518 ;; 519 udev) 520 create_udev_rule 511 521 ;; 512 522 cleanup)
Note:
See TracChangeset
for help on using the changeset viewer.