VirtualBox

vbox的更動 61199 路徑 trunk/src/VBox/Additions


忽略:
時間撮記:
2016-5-25 下午05:51:35 (8 年 以前)
作者:
vboxsync
訊息:

bugref:8062: Linux installers: drop DKMS support: on Additions installation and service start-up, build modules for all kernels found on the system; and hook into the kernel package update notification which at least Debian and Redhat-based systems provide to build new packages as soon as a new kernel is installed.

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Additions/linux/installer/vboxadd.sh

    r61176 r61199  
    2929### END INIT INFO
    3030
     31## @todo This file duplicates a lot of script with vboxdrv.sh.  When making
     32# changes please try to reduce differences between the two wherever possible.
     33
    3134PATH=$PATH:/bin:/sbin:/usr/sbin
    3235PACKAGE=VBoxGuestAdditions
     
    3538OLDMODULES="vboxguest vboxadd vboxsf vboxvfs vboxvideo"
    3639SCRIPTNAME=vboxadd.sh
     40QUICKSETUP=
    3741
    3842if $MODPROBE -c 2>/dev/null | grep -q '^allow_unsupported_modules  *0'; then
     
    166170{
    167171    begin "Starting the VirtualBox Guest Additions" console;
     172    # If we got this far assume that the slow set-up has been done.
     173    QUICKSETUP=yes
    168174    if test -r $config; then
    169175      . $config
     
    300306{
    301307    # don't stop the old modules here -- they might be in use
    302     cleanup_modules
     308    test -z "${QUICKSETUP}" && cleanup_modules
    303309    begin "Building the VirtualBox Guest Additions kernel modules"
    304310
    305311    begin "Building the main Guest Additions module"
    306     if ! $BUILDINTMP \
    307         --save-module-symvers /tmp/vboxguest-Module.symvers \
    308         --module-source $MODULE_SRC/vboxguest \
    309         --no-print-directory install >> $LOG 2>&1; then
    310         show_error "Look at $LOG to find out what went wrong"
    311         return 1
    312     fi
    313     succ_msg
    314     begin "Building the shared folder support module"
    315     if ! $BUILDINTMP \
    316         --use-module-symvers /tmp/vboxguest-Module.symvers \
    317         --module-source $MODULE_SRC/vboxsf \
    318         --no-print-directory install >> $LOG 2>&1; then
    319         show_error  "Look at $LOG to find out what went wrong"
    320         return 1
    321     fi
    322     succ_msg
    323     begin "Building the graphics driver module"
    324     if ! $BUILDINTMP \
    325         --use-module-symvers /tmp/vboxguest-Module.symvers \
    326         --module-source $MODULE_SRC/vboxvideo \
    327         --no-print-directory install >> $LOG 2>&1; then
    328         show_error "Look at $LOG to find out what went wrong"
    329     fi
    330     succ_msg
    331     depmod
     312    for i in /lib/modules/*; do
     313        test -d "${i}/build" || continue
     314        # This does not work for 2.4 series kernels.  How sad.
     315        test -n "${QUICKSETUP}" && test -f "${i}/misc/vboxguest.ko" && continue
     316        begin "Building for kernel ${i##*/}" console
     317        export KERN_DIR="${i}/build"
     318        export MODULE_DIR="${i}/misc"
     319        if ! $BUILDINTMP \
     320            --save-module-symvers /tmp/vboxguest-Module.symvers \
     321            --module-source $MODULE_SRC/vboxguest \
     322            --no-print-directory install >> $LOG 2>&1; then
     323            show_error "Look at $LOG to find out what went wrong"
     324            test "${i##*/}" = "`uname -r`" && return 1
     325        fi
     326        succ_msg
     327        begin "Building the shared folder support module"
     328        if ! $BUILDINTMP \
     329            --use-module-symvers /tmp/vboxguest-Module.symvers \
     330            --module-source $MODULE_SRC/vboxsf \
     331            --no-print-directory install >> $LOG 2>&1; then
     332            show_error  "Look at $LOG to find out what went wrong"
     333            test "${i##*/}" = "`uname -r`" && return 1
     334        fi
     335        succ_msg
     336        begin "Building the graphics driver module"
     337        if ! $BUILDINTMP \
     338            --use-module-symvers /tmp/vboxguest-Module.symvers \
     339            --module-source $MODULE_SRC/vboxvideo \
     340            --no-print-directory install >> $LOG 2>&1; then
     341            show_error "Look at $LOG to find out what went wrong"
     342        fi
     343        succ_msg
     344        depmod "${i##*/}"
     345    done
    332346    return 0
    333347}
     
    381395    ln -sf "$lib_path/$PACKAGE/vboxadd" /sbin/rcvboxadd
    382396    ln -sf "$lib_path/$PACKAGE/vboxadd-x11" /sbin/rcvboxadd-x11
     397    # And a post-installation script for rebuilding modules when a new kernel
     398    # is installed.
     399    mkdir -p /etc/kernel/postinst.d /etc/kernel/prerm.d
     400    cat << EOF > /etc/kernel/postinst.d/vboxadd
     401#!/bin/sh
     402/sbin/rcvboxadd quicksetup
     403exit 0
     404EOF
     405    cat << EOF > /etc/kernel/prerm.d/vboxadd
     406#!/bin/sh
     407for i in ${OLDMODULES}; do rm -f /lib/modules/"\${1}"/misc/"\${i}".ko; done
     408rmdir -p /lib/modules/"\$1"/misc 2>/dev/null
     409exit 0
     410EOF
     411    chmod 0755 /etc/kernel/postinst.d/vboxadd /etc/kernel/prerm.d/vboxadd
    383412    # At least Fedora 11 and Fedora 12 require the correct security context when
    384413    # executing this command from service scripts. Shouldn't hurt for other
     
    424453        show_error "Please check that you have gcc, make, the header files for your Linux kernel and possibly perl installed."
    425454    fi
    426     extra_setup
     455    test -z "${QUICKSETUP}" && extra_setup
    427456    if [ "$mod_succ" -eq "0" ]; then
    428457        if running_vboxguest || running_vboxadd; then
     
    460489    rm /sbin/rcvboxadd 2>/dev/null
    461490    rm /sbin/rcvboxadd-x11 2>/dev/null
     491    rm -f /etc/kernel/postinst.d/vboxadd /etc/kernel/prerm.d/vboxadd
     492    rmdir -p /etc/kernel/postinst.d /etc/kernel/prerm.d 2>/dev/null
    462493    rm /etc/udev/rules.d/60-vboxadd.rules 2>/dev/null
    463494}
     
    485516    setup && start
    486517    ;;
     518quicksetup)
     519    QUICKSETUP=yes
     520    setup && start
     521    ;;
    487522cleanup)
    488523    cleanup
     
    492527    ;;
    493528*)
    494     echo "Usage: $0 {start|stop|restart|status|setup}"
     529    echo "Usage: $0 {start|stop|restart|status|setup|quicksetup|cleanup}"
    495530    exit 1
    496531esac
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette