VirtualBox

Ignore:
Timestamp:
Nov 5, 2015 7:13:45 PM (9 years ago)
Author:
vboxsync
Message:

bugref:7906: Installers/Linux: support systemd: add systemd support to the validation kit too.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/utils/TestExecServ/linux/vboxtxs-nat.sh

    r56295 r58591  
    3838
    3939PATH=$PATH:/bin:/sbin:/usr/sbin
     40SCRIPTNAME=vboxtxs-nat.sh
    4041
    4142CDROM_PATH=/media/cdrom
    4243SCRATCH_PATH=/tmp/vboxtxs-scratch
    4344
    44 system=unknown
    45 if [ -f /etc/redhat-release ]; then
    46     system=redhat
    47     PIDFILE="/var/lock/subsys/vboxtxs"
    48 elif [ -f /etc/SuSE-release ]; then
    49     system=suse
    50     PIDFILE="/var/lock/subsys/vboxtxs"
    51 elif [ -f /etc/debian_version ]; then
    52     system=debian
    53     PIDFILE="/var/run/vboxtxs"
    54 elif [ -f /etc/gentoo-release ]; then
    55     system=gentoo
    56     PIDFILE="/var/run/vboxtxs"
    57 elif [ -f /etc/arch-release ]; then
    58      system=arch
    59      PIDFILE="/var/run/vboxtxs"
    60 elif [ -f /etc/slackware-version ]; then
    61     system=slackware
    62     PIDFILE="/var/run/vboxtxs"
    63 elif [ -f /etc/lfs-release ]; then
    64     system=lfs
    65     PIDFILE="/var/run/vboxtxs.pid"
    66 else
    67     system=other
    68     if [ -d /var/run -a -w /var/run ]; then
    69         PIDFILE="/var/run/vboxtxs"
    70     fi
     45PIDFILE="/var/run/vboxtxs"
     46
     47# Preamble for Gentoo
     48if [ "`which $0`" = "/sbin/rc" ]; then
     49    shift
    7150fi
    7251
    73 if [ "$system" = "redhat" ]; then
    74     . /etc/init.d/functions
    75     fail_msg() {
    76         echo_failure
    77         echo
    78     }
     52begin_msg()
     53{
     54    test -n "${2}" && echo "${SCRIPTNAME}: ${1}."
     55    logger -t "${SCRIPTNAME}" "${1}."
     56}
    7957
    80     succ_msg() {
    81         echo_success
    82         echo
    83     }
     58succ_msg()
     59{
     60    logger -t "${SCRIPTNAME}" "${1}."
     61}
    8462
    85     begin() {
    86         echo -n "$1"
    87     }
    88 fi
     63fail_msg()
     64{
     65    echo "${SCRIPTNAME}: failed: ${1}." >&2
     66    logger -t "${SCRIPTNAME}" "failed: ${1}."
     67}
    8968
    90 if [ "$system" = "suse" ]; then
    91     . /etc/rc.status
    92     daemon() {
    93         startproc ${1+"$@"}
    94     }
    95 
    96     fail_msg() {
    97         rc_failed 1
    98         rc_status -v
    99     }
    100 
    101     succ_msg() {
    102         rc_reset
    103         rc_status -v
    104     }
    105 
    106     begin() {
    107         echo -n "$1"
    108     }
    109 fi
    110 
    111 if [ "$system" = "debian" ]; then
    112     daemon() {
    113         start-stop-daemon --start --exec $1 -- $2
    114     }
    115 
    116     killproc() {
    117         start-stop-daemon --stop --exec $@
    118     }
    119 
    120     fail_msg() {
    121         echo " ...fail!"
    122     }
    123 
    124     succ_msg() {
    125         echo " ...done."
    126     }
    127 
    128     begin() {
    129         echo -n "$1"
    130     }
    131 fi
    132 
    133 if [ "$system" = "gentoo" ]; then
    134     if [ -f /sbin/functions.sh ]; then
    135         . /sbin/functions.sh
    136     elif [ -f /etc/init.d/functions.sh ]; then
    137         . /etc/init.d/functions.sh
    138     fi
    139     daemon() {
    140         start-stop-daemon --start --exec $1 -- $2
    141     }
    142 
    143     killproc() {
    144         start-stop-daemon --stop --exec $@
    145     }
    146 
    147     fail_msg() {
    148         echo " ...fail!"
    149     }
    150 
    151     succ_msg() {
    152         echo " ...done."
    153     }
    154 
    155     begin() {
    156         echo -n "$1"
    157     }
    158 
    159     if [ "`which $0`" = "/sbin/rc" ]; then
    160         shift
    161     fi
    162 fi
    163 
    164 if [ "$system" = "arch" ]; then
    165     USECOLOR=yes
    166     . /etc/rc.d/functions
    167     daemon() {
    168         $@
    169         test $? -eq 0 && add_daemon rc.`basename $1`
    170     }
    171 
    172     killproc() {
    173         killall $@
    174         rm_daemon `basename $@`
    175     }
    176 
    177     fail_msg() {
    178         stat_fail
    179     }
    180 
    181     succ_msg() {
    182         stat_done
    183     }
    184 
    185     begin() {
    186         stat_busy "$1"
    187     }
    188 
    189 fi
    190 
    191 if [ "$system" = "slackware" ]; then
    192     daemon() {
    193         $1 $2
    194     }
    195 
    196     killproc() {
    197         killall $1
    198         rm -f $PIDFILE
    199     }
    200 
    201     fail_msg() {
    202         echo " ...fail!"
    203     }
    204 
    205     succ_msg() {
    206         echo " ...done."
    207     }
    208 
    209     begin() {
    210         echo -n "$1"
    211     }
    212 
    213 fi
    214 
    215 if [ "$system" = "lfs" ]; then
    216     . /etc/rc.d/init.d/functions
    217     daemon() {
    218         loadproc $1 $2
    219     }
    220 
    221     fail_msg() {
    222         echo_failure
    223     }
    224 
    225     succ_msg() {
    226         echo_ok
    227     }
    228 
    229     begin() {
    230         echo $1
    231     }
    232 
    233     status() {
    234         statusproc $1
    235     }
    236 fi
    237 
    238 if [ "$system" = "other" ]; then
    239     fail_msg() {
    240         echo " ...fail!"
    241     }
    242 
    243     succ_msg() {
    244         echo " ...done."
    245     }
    246 
    247     begin() {
    248         echo -n "$1"
    249     }
    250 fi
     69killproc() {
     70    kp_binary="${1##*/}"
     71    pkill "${kp_binary}" || return 0
     72    sleep 1
     73    pkill "${kp_binary}" || return 0
     74    sleep 1
     75    pkill -9 "${kp_binary}"
     76    return 0
     77}
    25178
    25279case "`uname -m`" in
     
    274101start() {
    275102    if ! test -f $PIDFILE; then
    276         begin "Starting VirtualBox Test Execution Service ";
     103        begin_msg "Starting VirtualBox Test Execution Service" console
    277104        fixAndTestBinary
    278105        mount /dev/cdrom "${CDROM_PATH}" 2> /dev/null > /dev/null
    279         daemon $binary --auto-upgrade --scratch="${SCRATCH_PATH}" --cdrom="${CDROM_PATH}" \
     106        $binary --auto-upgrade --scratch="${SCRATCH_PATH}" --cdrom="${CDROM_PATH}" \
    280107            --no-display-output --tcp-connect 10.0.2.2 > /dev/null
    281108        RETVAL=$?
     
    285112        fi
    286113        if test $RETVAL -eq 0; then
    287             succ_msg
     114            succ_msg "VirtualBox Test Execution service started"
    288115        else
    289             fail_msg
     116            fail_msg "VirtualBox Test Execution service failed to start"
    290117        fi
    291118    fi
     
    295122stop() {
    296123    if test -f $PIDFILE; then
    297         begin "Stopping VirtualBox Test Execution Service ";
     124        begin_msg "Stopping VirtualBox Test Execution Service" console
    298125        killproc $binary
    299         RETVAL=$?
    300         test $RETVAL -eq 0 && rm -f $PIDFILE
    301         succ_msg
    302126    fi
    303     return $RETVAL
    304127}
    305128
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