- Timestamp:
- Oct 2, 2018 1:28:15 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/installer/vboxadd.sh
r74412 r74579 51 51 # * Uninstalling the Additions and re-installing them does not trigger warnings. 52 52 53 export LC_ALL=C 53 54 PATH=$PATH:/bin:/sbin:/usr/sbin 54 55 PACKAGE=VBoxGuestAdditions … … 59 60 ## systemd logs information about service status, otherwise do that ourselves. 60 61 QUIET= 62 test -z "${KERN_VER}" && KERN_VER=`uname -r` 61 63 62 64 setup_log() … … 312 314 } 313 315 316 ## Update the initramfs. Debian and Ubuntu put the graphics driver in, and 317 # need the touch(1) command below. Everyone else that I checked just need 318 # the right module alias file from depmod(1) and only use the initramfs to 319 # load the root filesystem, not the boot splash. update-initramfs works 320 # for the first two and dracut for every one else I checked. We are only 321 # interested in distributions recent enough to use the KMS vboxvideo driver. 322 update_initramfs() 323 { 324 ## kernel version to update for. 325 version="${1}" 326 depmod "${version}" 327 rm -f "/lib/modules/${version}/initrd/vboxvideo" 328 test -d "/lib/modules/${version}/initrd" && 329 test -f "/lib/modules/${version}/misc/vboxvideo.ko" && 330 touch "/lib/modules/${version}/initrd/vboxvideo" 331 if type dracut >/dev/null 2>&1; then 332 dracut -f --kver "${version}" 333 elif type update-initramfs >/dev/null 2>&1; then 334 update-initramfs -u -k "${version}" 335 fi 336 } 337 314 338 # Remove any existing VirtualBox guest kernel modules from the disk, but not 315 339 # from the kernel as they may still be in use 316 340 cleanup_modules() 317 341 { 342 test "x${1}" = x--skip && skip_ver="${2}" 343 # Needed for Ubuntu and Debian, see update_initramfs 344 rm -f /lib/modules/*/initrd/vboxvideo 345 for i in /lib/modules/*/misc; do 346 kern_ver="${i%/misc}" 347 kern_ver="${kern_ver#/lib/modules/}" 348 unset do_update 349 for j in ${OLDMODULES}; do 350 test -f "${i}/${j}.ko" && do_update=1 && rm -f "${i}/${j}.ko" 351 done 352 test -n "${do_update}" && test "x${kern_ver}" != "x${skip_ver}" && 353 update_initramfs "${kern_ver}" 354 # Remove empty /lib/modules folders which may have been kept around 355 rmdir -p "${i}" 2>/dev/null || true 356 unset keep 357 for j in /lib/modules/"${kern_ver}"/*; do 358 name="${j##*/}" 359 test -d "${name}" || test "${name%%.*}" != modules && keep=1 360 done 361 if test -z "${keep}"; then 362 rm -rf /lib/modules/"${kern_ver}" 363 rm -f /boot/initrd.img-"${kern_ver}" 364 fi 365 done 318 366 for i in ${OLDMODULES}; do 319 367 # We no longer support DKMS, remove any leftovers. 320 368 rm -rf "/var/lib/dkms/${i}"* 321 # And remove old modules.322 rm -f /lib/modules/*/misc/"${i}"*323 done324 # Remove leftover module folders.325 for i in /lib/modules/*/misc; do326 test -d "${i}" && rmdir -p "${i}" 2>/dev/null327 369 done 328 370 rm -f /etc/depmod.d/vboxvideo-upstream.conf … … 333 375 { 334 376 # don't stop the old modules here -- they might be in use 335 test -z "${QUICKSETUP}" && cleanup_modules 377 test -z "${QUICKSETUP}" && cleanup_modules --skip "${KERN_VER}" 336 378 # This does not work for 2.4 series kernels. How sad. 337 379 test -n "${QUICKSETUP}" && test -f "${MODULE_DIR}/vboxguest.ko" && return 0 … … 347 389 "${INSTALL_DIR}"/other/check_module_dependencies.sh 2>&1 && 348 390 info "Look at $LOG to find out what went wrong" 391 update_initramfs "${KERN_VER}" 349 392 return 0 350 393 fi … … 356 399 module_build_log "$myerr" 357 400 info "Look at $LOG to find out what went wrong" 401 update_initramfs "${KERN_VER}" 358 402 return 0 359 403 fi … … 370 414 echo "override vboxsf * misc" >> /etc/depmod.d/vboxvideo-upstream.conf 371 415 echo "override vboxvideo * misc" >> /etc/depmod.d/vboxvideo-upstream.conf 416 update_initramfs "${KERN_VER}" 372 417 depmod 373 418 return 0 … … 378 423 # This is the LSB version of useradd and should work on recent 379 424 # distributions 380 useradd -d /var/run/vboxadd -g 1 -r -s /bin/false vboxadd >/dev/null 2>&1 425 useradd -d /var/run/vboxadd -g 1 -r -s /bin/false vboxadd >/dev/null 2>&1 || true 381 426 # And for the others, we choose a UID ourselves 382 useradd -d /var/run/vboxadd -g 1 -u 501 -o -s /bin/false vboxadd >/dev/null 2>&1 427 useradd -d /var/run/vboxadd -g 1 -u 501 -o -s /bin/false vboxadd >/dev/null 2>&1 || true 383 428 384 429 } … … 462 507 MODULE_SRC="$INSTALL_DIR/src/vboxguest-$INSTALL_VER" 463 508 BUILDINTMP="$MODULE_SRC/build_in_tmp" 464 chcon -t bin_t "$BUILDINTMP" > /dev/null 2>&1 509 test -e /etc/selinux/config && 510 chcon -t bin_t "$BUILDINTMP" 465 511 466 512 test -z "${INSTALL_NO_MODULE_BUILDS}" && setup_modules
Note:
See TracChangeset
for help on using the changeset viewer.