VirtualBox

Changeset 68084 in vbox for trunk


Ignore:
Timestamp:
Jul 21, 2017 12:44:53 PM (8 years ago)
Author:
vboxsync
Message:

debian_postinstall.sh: Implemented installing TXS. Fixed exitcode logging. Ignore GAs indicating reboot needed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/UnattendedTemplates/debian_postinstall.sh

    r68075 r68084  
    3131    echo "** Executing: $*" >> "${MY_LOGFILE}"
    3232    "$@" 2>&1 | tee -a "${MY_LOGFILE}"
    33     if [ "${PIPESTATUS[0]}" != "0" ]; then
    34         echo "exit code: ${PIPESTATUS[0]}"
    35         MY_EXITCODE=1;
     33    MY_TMP_EXITCODE="${PIPESTATUS[0]}"
     34    if [ "${MY_TMP_EXITCODE}" != "0" ]; then
     35        if [ "${MY_TMP_EXITCODE}" != "${MY_IGNORE_EXITCODE}" ]; then
     36            echo "** exit code: ${MY_TMP_EXITCODE}" | tee -a "${MY_LOGFILE}"
     37            MY_EXITCODE=1;
     38        else
     39            echo "** exit code: ${MY_TMP_EXITCODE} (ignored)" | tee -a "${MY_LOGFILE}"
     40        fi
    3641    fi
    3742}
     
    4752    # script (see below) and just use chroot here.
    4853    #
    49     # Also, GA installer and in-root/log-output doesn't seem to get along.
    50     #
    5154    log_command chroot "${MY_TARGET}" "$@"
    5255    # log_command in-target --pass-stdout "$@" # No stderr output... :-(
     
    7881
    7982#
    80 # Debug
    81 #
    82 if [ "${MY_DEBUG}" = "yes" ]; then
    83     log_command id
    84     log_command df
    85     log_command mount
    86     log_command_in_target df
    87     log_command_in_target mount
    88     log_command_in_target ls -Rla /cdrom
    89     log_command_in_target ls -Rla /media
    90     log_command find /
    91     MY_EXITCODE=0
    92 fi
    93 
    9483# We want the ISO available inside the target jail.
     84#
    9585if [ -f "${MY_TARGET}/cdrom/vboxpostinstall.sh" ]; then
    9686    MY_UNMOUNT_TARGET_CDROM=
     
    110100
    111101#
     102# Debug
     103#
     104if [ "${MY_DEBUG}" = "yes" ]; then
     105    log_command id
     106    log_command df
     107    log_command mount
     108    log_command_in_target df
     109    log_command_in_target mount
     110    log_command find /
     111    MY_EXITCODE=0
     112fi
     113
     114#
    112115# Packages needed for GAs.
    113116#
     
    121124@@VBOX_COND_IS_INSTALLING_ADDITIONS@@
    122125echo '** Installing VirtualBox Guest Additions...' | tee -a "${MY_LOGFILE}"
     126MY_IGNORE_EXITCODE=2  # returned if modules already loaded and reboot required.
    123127log_command_in_target /bin/bash /cdrom/vboxadditions/VBoxLinuxAdditions.run --nox11
     128MY_IGNORE_EXITCODE=
    124129log_command_in_target usermod -a -G vboxsf "@@VBOX_INSERT_USER_LOGIN@@"
    125130@@VBOX_COND_END@@
    126131
    127132#
    128 # Testing.
     133# Test Execution Service.
    129134#
    130135@@VBOX_COND_IS_INSTALLING_TEST_EXEC_SERVICE@@
    131136echo '** Installing Test Execution Service...' | tee -a "${MY_LOGFILE}"
    132 log_command_in_target test "/cdrom/linux/@@VBOX_INSERT_OS_ARCH@@/TestExecService"
    133 ## @todo fix this
     137log_command_in_target test "/cdrom/vboxvalidationkit/linux/@@VBOX_INSERT_OS_ARCH@@/TestExecService"
     138log_command mkdir -p "${MY_TARGET}/root/validationkit" "${MY_TARGET}/target/cdrom"
     139log_command cp -R /cdrom/vboxvalidationkit/* "${MY_TARGET}/root/validationkit/"
     140log_command chmod -R u+rw,a+xr "${MY_TARGET}/root/validationkit/"
     141
     142# systemd service config:
     143MY_UNIT_PATH="${MY_TARGET}/lib/systemd/system"
     144test -d "${MY_TARGET}/usr/lib/systemd/system" && MY_UNIT_PATH="${MY_TARGET}/usr/lib/systemd/system"
     145if [ -d "${MY_UNIT_PATH}" ]; then
     146    if [  -f "${MY_TARGET}/linux/vboxtxs.service" ]; then ## REMOVE AS SOON AS r117117 IS READY
     147        log_command cp "${MY_TARGET}/linux/vboxtxs.service" "${MY_UNIT_PATH}/vboxtxs.service"
     148    else                                                  ## REMOVE AS SOON AS r117117 IS READY
     149        cat > "${MY_UNIT_PATH}/vboxtxs.service" <<EOF
     150[Unit]
     151Description=VirtualBox Test Execution Service
     152SourcePath=/root/validationkit/linux/vboxtxs
     153
     154[Service]
     155Type=forking
     156Restart=no
     157TimeoutSec=5min
     158IgnoreSIGPIPE=no
     159KillMode=process
     160GuessMainPID=no
     161RemainAfterExit=yes
     162ExecStart=/root/validationkit/linux/vboxtxs start
     163ExecStop=/root/validationkit/linux/vboxtxs stop
     164
     165[Install]
     166WantedBy=multi-user.target
     167EOF
     168    fi
     169    log_command chmod 755 "${MY_UNIT_PATH}/vboxtxs.service"
     170    log_command_in_target systemctl -q enable vboxtxs
     171
     172# Not systemd.  Add support for upstart later...
     173else
     174    echo "** error: No systemd unit dir found.  Using upstart or something?" | tee -a "${MY_LOGFILE}"
     175fi
     176
    134177@@VBOX_COND_END@@
    135178
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