VirtualBox

Changeset 72196 in vbox


Ignore:
Timestamp:
May 11, 2018 7:06:17 PM (6 years ago)
Author:
vboxsync
Message:

Installers/Linux: clean up logging.

  • Remove strange kernel output from kernel module build log.
  • Remove most non-error output, in particular, only print module build output in case of error.
Location:
trunk/src/VBox
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/linux/installer/vboxadd.sh

    r69564 r72196  
    127127    setup_log
    128128    echo "${1}" >> "${LOG}"
     129}
     130
     131module_build_log()
     132{
     133    setup_log
     134    echo "${1}" | egrep -v \
     135        "^test -e include/generated/autoconf.h|^echo >&2|^/bin/false)$" \
     136        >> "${LOG}"
    129137}
    130138
     
    254262
    255263    # Put the X.Org driver in place.  This is harmless if it is not needed.
    256     "${INSTALL_DIR}/init/vboxadd-x11" setup 2>> "${LOG}"
     264    myerr=`"${INSTALL_DIR}/init/vboxadd-x11" setup 2>&1`
     265    test -z "${myerr}" || log "${myerr}"
    257266    # Install the guest OpenGL drivers.  For now we don't support
    258267    # multi-architecture installations
     
    308317cleanup_modules()
    309318{
    310     log "Removing existing VirtualBox kernel modules."
    311319    for i in ${OLDMODULES}; do
    312320        # We no longer support DKMS, remove any leftovers.
     
    329337    # This does not work for 2.4 series kernels.  How sad.
    330338    test -n "${QUICKSETUP}" && test -f "${MODULE_DIR}/vboxguest.ko" && return 0
    331     info "Building the VirtualBox Guest Additions kernel modules."
    332 
    333     # We are allowed to do ">> $LOG" after we have called "log()" once.
     339    info "Building the VirtualBox Guest Additions kernel modules.  This may take a while."
     340
    334341    log "Building the main Guest Additions module."
    335     if ! $BUILDINTMP \
     342    if ! myerr=`$BUILDINTMP \
    336343        --save-module-symvers /tmp/vboxguest-Module.symvers \
    337344        --module-source $MODULE_SRC/vboxguest \
    338         --no-print-directory install >> $LOG 2>&1; then
     345        --no-print-directory install 2>&1`; then
    339346        # If check_module_dependencies.sh fails it prints a message itself.
     347        log "Error building the module:"
     348        module_build_log "$myerr"
    340349        "${INSTALL_DIR}"/other/check_module_dependencies.sh 2>&1 &&
    341350            info "Look at $LOG to find out what went wrong"
    342351        return 0
    343352    fi
    344     log "Building the shared folder support module"
    345     if ! $BUILDINTMP \
     353    log "Building the shared folder support module."
     354    if ! myerr=`$BUILDINTMP \
    346355        --use-module-symvers /tmp/vboxguest-Module.symvers \
    347356        --module-source $MODULE_SRC/vboxsf \
    348         --no-print-directory install >> $LOG 2>&1; then
     357        --no-print-directory install 2>&1`; then
     358        log "Error building the module:"
     359        module_build_log "$myerr"
    349360        info  "Look at $LOG to find out what went wrong"
    350361        return 0
    351362    fi
    352     log "Building the graphics driver module"
    353     if ! $BUILDINTMP \
     363    log "Building the graphics driver module."
     364    if ! myerr=`$BUILDINTMP \
    354365        --use-module-symvers /tmp/vboxguest-Module.symvers \
    355366        --module-source $MODULE_SRC/vboxvideo \
    356         --no-print-directory install >> $LOG 2>&1; then
     367        --no-print-directory install 2>&1`; then
     368        log "Error building the module:"
     369        module_build_log "$myerr"
    357370        info "Look at $LOG to find out what went wrong"
    358371    fi
     
    367380create_vbox_user()
    368381{
    369     log "Creating user for the Guest Additions."
    370382    # This is the LSB version of useradd and should work on recent
    371383    # distributions
     
    380392    # Create udev description file
    381393    if [ -d /etc/udev/rules.d ]; then
    382         log "Creating udev rule for the Guest Additions kernel module."
    383394        udev_call=""
    384395        udev_app=`which udevadm 2> /dev/null`
     
    484495
    485496    # Clean-up X11-related bits
    486     "${INSTALL_DIR}/init/vboxadd-x11" cleanup 2>> "${LOG}"
     497    "${INSTALL_DIR}/init/vboxadd-x11" cleanup
    487498
    488499    # Remove other files
  • trunk/src/VBox/Installer/linux/routines.sh

    r70930 r72196  
    4545}
    4646
    47 ## Writes text to standard error
     47## Writes text to standard error, as standard output is masked.
    4848#
    4949# Syntax: info text
     
    5151{
    5252    echo 1>&2 "$1"
     53}
     54
     55## Copies standard input to standard error, as standard output is masked.
     56#
     57# Syntax: info text
     58catinfo()
     59{
     60    cat 1>&2
    5361}
    5462
  • trunk/src/VBox/Installer/linux/vboxdrv.sh

    r69500 r72196  
    3535PATH=/sbin:/bin:/usr/sbin:/usr/bin:$PATH
    3636DEVICE=/dev/vboxdrv
    37 LOG="/var/log/vbox-install.log"
    3837MODPROBE=/sbin/modprobe
    3938SCRIPTNAME=vboxdrv.sh
     
    4645  MODPROBE="$MODPROBE --allow-unsupported-modules"
    4746fi
     47
     48setup_log()
     49{
     50    test -n "${LOG}" && return 0
     51    # Rotate log files
     52    LOG="/var/log/vbox-setup.log"
     53    mv "${LOG}.3" "${LOG}.4" 2>/dev/null
     54    mv "${LOG}.2" "${LOG}.3" 2>/dev/null
     55    mv "${LOG}.1" "${LOG}.2" 2>/dev/null
     56    mv "${LOG}" "${LOG}.1" 2>/dev/null
     57}
    4858
    4959[ -f /etc/vbox/vbox.cfg ] && . /etc/vbox/vbox.cfg
     
    110120{
    111121    lsmod | grep -q "$1[^_-]"
     122}
     123
     124log()
     125{
     126    setup_log
     127    echo "${1}" >> "${LOG}"
     128}
     129
     130module_build_log()
     131{
     132    setup_log
     133    echo "${1}" | egrep -v \
     134        "^test -e include/generated/autoconf.h|^echo >&2|^/bin/false)$" \
     135        >> "${LOG}"
    112136}
    113137
     
    398422{
    399423    begin_msg "Building VirtualBox kernel modules" console
    400     if ! $BUILDINTMP \
     424    log "Building the main VirtualBox module."
     425    if ! myerr=`$BUILDINTMP \
    401426        --save-module-symvers /tmp/vboxdrv-Module.symvers \
    402427        --module-source "$MODULE_SRC/vboxdrv" \
    403         --no-print-directory install >> $LOG 2>&1; then
     428        --no-print-directory install 2>&1`; then
    404429        "${INSTALL_DIR}/check_module_dependencies.sh" || exit 1
     430        log "Error building the module:"
     431        module_build_log "$myerr"
    405432        failure "Look at $LOG to find out what went wrong"
    406433    fi
    407     if ! $BUILDINTMP \
     434    log "Building the net filter module."
     435    if ! myerr=`$BUILDINTMP \
    408436        --use-module-symvers /tmp/vboxdrv-Module.symvers \
    409437        --module-source "$MODULE_SRC/vboxnetflt" \
    410         --no-print-directory install >> $LOG 2>&1; then
     438        --no-print-directory install 2>&1`; then
     439        log "Error building the module:"
     440        module_build_log "$myerr"
    411441        failure "Look at $LOG to find out what went wrong"
    412442    fi
    413     if ! $BUILDINTMP \
     443    log "Building the net adaptor module."
     444    if ! myerr=`$BUILDINTMP \
    414445        --use-module-symvers /tmp/vboxdrv-Module.symvers \
    415446        --module-source "$MODULE_SRC/vboxnetadp" \
    416         --no-print-directory install >> $LOG 2>&1; then
     447        --no-print-directory install 2>&1`; then
     448        log "Error building the module:"
     449        module_build_log "$myerr"
    417450        failure "Look at $LOG to find out what went wrong"
    418451    fi
    419     if ! $BUILDINTMP \
     452    log "Building the PCI pass-through module."
     453    if ! myerr=`$BUILDINTMP \
    420454        --use-module-symvers /tmp/vboxdrv-Module.symvers \
    421455        --module-source "$MODULE_SRC/vboxpci" \
    422         --no-print-directory install >> $LOG 2>&1; then
     456        --no-print-directory install 2>&1`; then
     457        log "Error building the module:"
     458        module_build_log "$myerr"
    423459        failure "Look at $LOG to find out what went wrong"
    424460    fi
     
    475511    ;;
    476512setup)
     513    test -n "${2}" && export KERN_VER="${2}"
    477514    # Create udev rule and USB device nodes.
    478515    ## todo Wouldn't it make more sense to install the rule to /lib/udev?  This
Note: See TracChangeset for help on using the changeset viewer.

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