VirtualBox

Changeset 72196 in vbox for trunk/src/VBox/Installer


Ignore:
Timestamp:
May 11, 2018 7:06:17 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
122633
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/Installer/linux
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • 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.

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