VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/utils/TestExecServ/linux/vboxtxs.sh@ 101675

Last change on this file since 101675 was 101675, checked in by vboxsync, 15 months ago

ValidationKit/TestExecServ: Use the correct binaries for arm, bugref:10542

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 4.1 KB
Line 
1#!/bin/sh
2## @file
3# VirtualBox Test Execution Service Init Script.
4#
5
6#
7# Copyright (C) 2006-2023 Oracle and/or its affiliates.
8#
9# This file is part of VirtualBox base platform packages, as
10# available from https://www.virtualbox.org.
11#
12# This program is free software; you can redistribute it and/or
13# modify it under the terms of the GNU General Public License
14# as published by the Free Software Foundation, in version 3 of the
15# License.
16#
17# This program is distributed in the hope that it will be useful, but
18# WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20# General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
23# along with this program; if not, see <https://www.gnu.org/licenses>.
24#
25# The contents of this file may alternatively be used under the terms
26# of the Common Development and Distribution License Version 1.0
27# (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
28# in the VirtualBox distribution, in which case the provisions of the
29# CDDL are applicable instead of those of the GPL.
30#
31# You may elect to license modified versions of this file under the
32# terms and conditions of either the GPL or the CDDL or both.
33#
34# SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
35#
36
37# chkconfig: 35 35 65
38# description: VirtualBox Test Execution Service
39#
40### BEGIN INIT INFO
41# Provides: vboxtxs
42# Required-Start: $network
43# Required-Stop:
44# Default-Start: 2 3 4 5
45# Default-Stop: 0 1 6
46# Description: VirtualBox Test Execution Service
47### END INIT INFO
48
49PATH=$PATH:/bin:/sbin:/usr/sbin
50SCRIPTNAME=vboxtxs.sh
51
52CDROM_PATH=/media/cdrom
53SCRATCH_PATH=/tmp/vboxtxs-scratch
54
55PIDFILE="/var/run/vboxtxs"
56
57# Preamble for Gentoo
58if [ "`which $0`" = "/sbin/rc" ]; then
59 shift
60fi
61
62begin_msg()
63{
64 test -n "${2}" && echo "${SCRIPTNAME}: ${1}."
65 logger -t "${SCRIPTNAME}" "${1}."
66}
67
68succ_msg()
69{
70 logger -t "${SCRIPTNAME}" "${1}."
71}
72
73fail_msg()
74{
75 echo "${SCRIPTNAME}: failed: ${1}." >&2
76 logger -t "${SCRIPTNAME}" "failed: ${1}."
77}
78
79killproc() {
80 kp_binary="${1##*/}"
81 pkill "${kp_binary}" || return 0
82 sleep 1
83 pkill "${kp_binary}" || return 0
84 sleep 1
85 pkill -9 "${kp_binary}"
86 return 0
87}
88
89case "`uname -m`" in
90 AMD64|amd64|X86_64|x86_64)
91 binary=/opt/validationkit/linux/amd64/TestExecService
92 ;;
93
94 i386|x86|i486|i586|i686|i787)
95 binary=/opt/validationkit/linux/x86/TestExecService
96 ;;
97
98 aarch64)
99 binary=/opt/validationkit/linux/arm64/TestExecService
100 ;;
101
102 arm|armv8l)
103 binary=/opt/validationkit/linux/arm32/TestExecService
104 ;;
105
106 *)
107 binary=/opt/validationkit/linux/x86/TestExecService
108 ;;
109esac
110
111fixAndTestBinary() {
112 chmod a+x "$binary" 2> /dev/null > /dev/null
113 test -x "$binary" || {
114 echo "Cannot run $binary"
115 exit 1
116 }
117}
118
119start() {
120 if ! test -f $PIDFILE; then
121 begin_msg "Starting VirtualBox Test Execution Service" console
122 fixAndTestBinary
123 mount /dev/cdrom "${CDROM_PATH}" 2> /dev/null > /dev/null
124 $binary --auto-upgrade --scratch="${SCRATCH_PATH}" --cdrom="${CDROM_PATH}" --no-display-output > /dev/null
125 RETVAL=$?
126 test $RETVAL -eq 0 && sleep 2 && echo `pidof TestExecService` > $PIDFILE
127 if ! test -s "${PIDFILE}"; then
128 RETVAL=5
129 fi
130 if test $RETVAL -eq 0; then
131 succ_msg "VirtualBox Test Execution service started"
132 else
133 fail_msg "VirtualBox Test Execution service failed to start"
134 fi
135 fi
136 return $RETVAL
137}
138
139stop() {
140 if test -f $PIDFILE; then
141 begin_msg "Stopping VirtualBox Test Execution Service" console
142 killproc $binary
143 rm -f $PIDFILE
144 fi
145}
146
147restart() {
148 stop && start
149}
150
151status() {
152 echo -n "Checking for vboxtxs"
153 if [ -f $PIDFILE ]; then
154 echo " ...running"
155 else
156 echo " ...not running"
157 fi
158}
159
160case "$1" in
161start)
162 start
163 ;;
164stop)
165 stop
166 ;;
167restart)
168 restart
169 ;;
170status)
171 status
172 ;;
173setup)
174 ;;
175cleanup)
176 ;;
177*)
178 echo "Usage: $0 {start|stop|restart|status}"
179 exit 1
180esac
181
182exit $RETVAL
Note: See TracBrowser for help on using the repository browser.

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