VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/testboxscript/setup.sh@ 85014

Last change on this file since 85014 was 85014, checked in by vboxsync, 4 years ago

bugref:9662 changes in testboxscript which kick --spb option to work on linux

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 21.0 KB
Line 
1#!/usr/bin/env bash
2# $Id: setup.sh 85014 2020-06-30 18:17:53Z vboxsync $
3## @file
4# VirtualBox Validation Kit - TestBoxScript Service Setup on Unixy platforms.
5#
6
7#
8# Copyright (C) 2006-2020 Oracle Corporation
9#
10# This file is part of VirtualBox Open Source Edition (OSE), as
11# available from http://www.virtualbox.org. This file is free software;
12# you can redistribute it and/or modify it under the terms of the GNU
13# General Public License (GPL) as published by the Free Software
14# Foundation, in version 2 as it comes in the "COPYING" file of the
15# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17#
18# The contents of this file may alternatively be used under the terms
19# of the Common Development and Distribution License Version 1.0
20# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
21# VirtualBox OSE distribution, in which case the provisions of the
22# CDDL are applicable instead of those of the GPL.
23#
24# You may elect to license modified versions of this file under the
25# terms and conditions of either the GPL or the CDDL or both.
26#
27
28
29#
30# !WARNING! Running the whole script in exit-on-failure mode.
31#
32# Note! Looking at the ash sources, it seems flags will be saved and restored
33# when calling functions. That's comforting.
34#
35set -e
36#set -x # debug only, disable!
37
38##
39# Get the host OS name, returning it in RETVAL.
40#
41get_host_os() {
42 RETVAL=`uname`
43 case "$RETVAL" in
44 Darwin|darwin)
45 RETVAL=darwin
46 ;;
47
48 DragonFly)
49 RETVAL=dragonfly
50 ;;
51
52 freebsd|FreeBSD|FREEBSD)
53 RETVAL=freebsd
54 ;;
55
56 Haiku)
57 RETVAL=haiku
58 ;;
59
60 linux|Linux|GNU/Linux|LINUX)
61 RETVAL=linux
62 ;;
63
64 netbsd|NetBSD|NETBSD)
65 RETVAL=netbsd
66 ;;
67
68 openbsd|OpenBSD|OPENBSD)
69 RETVAL=openbsd
70 ;;
71
72 os2|OS/2|OS2)
73 RETVAL=os2
74 ;;
75
76 SunOS)
77 RETVAL=solaris
78 ;;
79
80 WindowsNT|CYGWIN_NT-*)
81 RETVAL=win
82 ;;
83
84 *)
85 echo "$0: unknown os $RETVAL" 1>&2
86 exit 1
87 ;;
88 esac
89 return 0;
90}
91
92##
93# Get the host OS/CPU arch, returning it in RETVAL.
94#
95get_host_arch() {
96 if [ "${HOST_OS}" = "solaris" ]; then
97 RETVAL=`isainfo | cut -f 1 -d ' '`
98 else
99 RETVAL=`uname -m`
100 fi
101 case "${RETVAL}" in
102 amd64|AMD64|x86_64|k8|k8l|k9|k10)
103 RETVAL='amd64'
104 ;;
105 x86|i86pc|ia32|i[3456789]86|BePC)
106 RETVAL='x86'
107 ;;
108 sparc32|sparc|sparcv8|sparcv7|sparcv8e)
109 RETVAL='sparc32'
110 ;;
111 sparc64|sparcv9)
112 RETVAL='sparc64'
113 ;;
114 s390)
115 RETVAL='s390'
116 ;;
117 s390x)
118 RETVAL='s390x'
119 ;;
120 ppc32|ppc|powerpc)
121 RETVAL='ppc32'
122 ;;
123 ppc64|powerpc64)
124 RETVAL='ppc64'
125 ;;
126 mips32|mips)
127 RETVAL='mips32'
128 ;;
129 mips64)
130 RETVAL='mips64'
131 ;;
132 ia64)
133 RETVAL='ia64'
134 ;;
135 hppa32|parisc32|parisc)
136 RETVAL='hppa32'
137 ;;
138 hppa64|parisc64)
139 RETVAL='hppa64'
140 ;;
141 arm|armv4l|armv5tel|armv5tejl)
142 RETVAL='arm'
143 ;;
144 alpha)
145 RETVAL='alpha'
146 ;;
147
148 *)
149 echo "$0: unknown cpu/arch - $RETVAL" 1>&$2
150 exit 1
151 ;;
152 esac
153 return 0;
154}
155
156
157##
158# Loads config values from the current installation.
159#
160os_load_config() {
161 echo "os_load_config is not implemented" 2>&1
162 exit 1
163}
164
165##
166# Installs, configures and starts the service.
167#
168os_install_service() {
169 echo "os_install_service is not implemented" 2>&1
170 exit 1
171}
172
173##
174# Enables (starts) the service.
175os_enable_service() {
176 echo "os_enable_service is not implemented" 2>&1
177 return 0;
178}
179
180##
181# Disables (stops) the service.
182os_disable_service() {
183 echo "os_disable_service is not implemented" 2>&1
184 return 0;
185}
186
187##
188# Adds the testbox user
189#
190os_add_user() {
191 echo "os_add_user is not implemented" 2>&1
192 exit 1
193}
194
195##
196# Prints a final message after successful script execution.
197# This can contain additional instructions which needs to be carried out
198# manually or similar.
199os_final_message() {
200 return 0;
201}
202
203##
204# Checks the installation, verifying that files are there and scripts work fine.
205#
206check_testboxscript_install() {
207
208 # Presence
209 test -r "${TESTBOXSCRIPT_DIR}/testboxscript/testboxscript.py"
210 test -r "${TESTBOXSCRIPT_DIR}/testboxscript/testboxscript_real.py"
211 test -r "${TESTBOXSCRIPT_DIR}/testboxscript/linux/testboxscript-service.sh" -o "${HOST_OS}" != "linux"
212 test -r "${TESTBOXSCRIPT_DIR}/${HOST_OS}/${HOST_ARCH}/TestBoxHelper"
213
214 # Zip file may be missing the x bits, so set them.
215 chmod a+x \
216 "${TESTBOXSCRIPT_DIR}/testboxscript/testboxscript.py" \
217 "${TESTBOXSCRIPT_DIR}/testboxscript/testboxscript_real.py" \
218 "${TESTBOXSCRIPT_DIR}/${HOST_OS}/${HOST_ARCH}/TestBoxHelper" \
219 "${TESTBOXSCRIPT_DIR}/testboxscript/linux/testboxscript-service.sh"
220
221
222 # Check that the scripts work.
223 set +e
224 "${TESTBOXSCRIPT_PYTHON}" "${TESTBOXSCRIPT_DIR}/testboxscript/testboxscript.py" --version > /dev/null
225 if [ $? -ne 2 ]; then
226 echo "$0: error: testboxscript.py didn't respons correctly to the --version option."
227 exit 1;
228 fi
229
230 "${TESTBOXSCRIPT_PYTHON}" "${TESTBOXSCRIPT_DIR}/testboxscript/testboxscript_real.py" --version > /dev/null
231 if [ $? -ne 2 ]; then
232 echo "$0: error: testboxscript.py didn't respons correctly to the --version option."
233 exit 1;
234 fi
235 set -e
236
237 return 0;
238}
239
240##
241# Check that sudo is installed.
242#
243check_for_sudo() {
244 which sudo
245 test -f "${MY_ETC_SUDOERS}"
246}
247
248##
249# Check that sudo is installed.
250#
251check_for_cifs() {
252 return 0;
253}
254
255##
256# Checks if the testboxscript_user exists.
257does_testboxscript_user_exist() {
258 id "${TESTBOXSCRIPT_USER}" > /dev/null 2>&1
259 return $?;
260}
261
262##
263# hushes up the root login.
264maybe_hush_up_root_login() {
265 # This is a solaris hook.
266 return 0;
267}
268
269##
270# Adds the testbox user and make sure it has unrestricted sudo access.
271maybe_add_testboxscript_user() {
272 if ! does_testboxscript_user_exist; then
273 os_add_user "${TESTBOXSCRIPT_USER}"
274 fi
275
276 SUDOERS_LINE="${TESTBOXSCRIPT_USER} ALL=(ALL) NOPASSWD: ALL"
277 if ! ${MY_FGREP} -q "${SUDOERS_LINE}" ${MY_ETC_SUDOERS}; then
278 echo "# begin tinderboxscript setup.sh" >> ${MY_ETC_SUDOERS}
279 echo "${SUDOERS_LINE}" >> ${MY_ETC_SUDOERS}
280 echo "# end tinderboxscript setup.sh" >> ${MY_ETC_SUDOERS}
281 fi
282
283 maybe_hush_up_root_login;
284}
285
286
287##
288# Test the user.
289#
290test_user() {
291 su - "${TESTBOXSCRIPT_USER}" -c "true"
292
293 # sudo 1.7.0 adds the -n option.
294 MY_TMP="`sudo -V 2>&1 | head -1 | sed -e 's/^.*version 1\.[6543210]\..*$/old/'`"
295 if [ "${MY_TMP}" != "old" ]; then
296 echo "Warning: If sudo starts complaining about not having a tty,"
297 echo " disable the requiretty option in /etc/sudoers."
298 su - "${TESTBOXSCRIPT_USER}" -c "sudo -n -i true"
299 else
300 echo "Warning: You've got an old sudo installed. If it starts"
301 echo " complaining about not having a tty, disable the"
302 echo " requiretty option in /etc/sudoers."
303 su - "${TESTBOXSCRIPT_USER}" -c "sudo true"
304 fi
305}
306
307##
308# Test if core dumps are enabled. See https://wiki.ubuntu.com/Apport!
309#
310test_coredumps() {
311 # This is a linux hook.
312 return 0;
313}
314
315##
316# Test if unattended updates are disabled. See
317# http://ask.xmodulo.com/disable-automatic-updates-ubuntu.html
318test_unattended_updates_disabled() {
319 # This is a linux hook.
320 return 0;
321}
322
323##
324# Grants the user write access to the testboxscript files so it can perform
325# upgrades.
326#
327grant_user_testboxscript_write_access() {
328 chown -R "${TESTBOXSCRIPT_USER}" "${TESTBOXSCRIPT_DIR}"
329}
330
331##
332# Check the proxy setup.
333#
334check_proxy_config() {
335 if [ -n "${http_proxy}" -o -n "${ftp_proxy}" ]; then
336 if [ -z "${no_proxy}" ]; then
337 echo "Error: Env.vars. http_proxy/ftp_proxy without no_proxy is going to break upgrade among other things."
338 exit 1
339 fi
340 fi
341}
342
343##
344# Parses the testboxscript.py invocation, setting TESTBOXSCRIPT_xxx config
345# variables accordingly. Both darwin and solaris uses this.
346common_testboxscript_args_to_config()
347{
348 MY_ARG=0
349 while [ $# -gt 0 ];
350 do
351 case "$1" in
352 # boolean
353 "--hwvirt") TESTBOXSCRIPT_HWVIRT="yes";;
354 "--no-hwvirt") TESTBOXSCRIPT_HWVIRT="no";;
355 "--nested-paging") TESTBOXSCRIPT_NESTED_PAGING="yes";;
356 "--no-nested-paging") TESTBOXSCRIPT_NESTED_PAGING="no";;
357 "--io-mmu") TESTBOXSCRIPT_IOMMU="yes";;
358 "--no-io-mmu") TESTBOXSCRIPT_IOMMU="no";;
359 # optios taking values.
360 "--system-uuid") TESTBOXSCRIPT_SYSTEM_UUID="$2"; shift;;
361 "--scratch-root") TESTBOXSCRIPT_SCRATCH_ROOT="$2"; shift;;
362 "--test-manager") TESTBOXSCRIPT_TEST_MANAGER="$2"; shift;;
363 "--builds-path") TESTBOXSCRIPT_BUILDS_PATH="$2"; shift;;
364 "--builds-server-type") TESTBOXSCRIPT_BUILDS_TYPE="$2"; shift;;
365 "--builds-server-name") TESTBOXSCRIPT_BUILDS_NAME="$2"; shift;;
366 "--builds-server-share") TESTBOXSCRIPT_BUILDS_SHARE="$2"; shift;;
367 "--builds-server-user") TESTBOXSCRIPT_BUILDS_USER="$2"; shift;;
368 "--builds-server-passwd") TESTBOXSCRIPT_BUILDS_PASSWD="$2"; shift;;
369 "--builds-server-mountopt") TESTBOXSCRIPT_BUILDS_MOUNTOPT="$2"; shift;;
370 "--testrsrc-path") TESTBOXSCRIPT_TESTRSRC_PATH="$2"; shift;;
371 "--testrsrc-server-type") TESTBOXSCRIPT_TESTRSRC_TYPE="$2"; shift;;
372 "--testrsrc-server-name") TESTBOXSCRIPT_TESTRSRC_NAME="$2"; shift;;
373 "--testrsrc-server-share") TESTBOXSCRIPT_TESTRSRC_SHARE="$2"; shift;;
374 "--testrsrc-server-user") TESTBOXSCRIPT_TESTRSRC_USER="$2"; shift;;
375 "--testrsrc-server-passwd") TESTBOXSCRIPT_TESTRSRC_PASSWD="$2"; shift;;
376 "--testrsrc-server-mountopt") TESTBOXSCRIPT_TESTRSRC_MOUNTOPT="$2"; shift;;
377 "--spb") ;;
378 "--putenv")
379 MY_FOUND=no
380 MY_VAR=`echo $2 | sed -e 's/=.*$//' `
381 for i in ${!TESTBOXSCRIPT_ENVVARS[@]};
382 do
383 MY_CURVAR=`echo "${TESTBOXSCRIPT_ENVVARS[i]}" | sed -e 's/=.*$//' `
384 if [ -n "${MY_CURVAR}" -a "${MY_CURVAR}" = "${MY_VAR}" ]; then
385 TESTBOXSCRIPT_ENVVARS[$i]="$2"
386 MY_FOUND=yes
387 fi
388 done
389 if [ "${MY_FOUND}" = "no" ]; then
390 TESTBOXSCRIPT_ENVVARS=( "${TESTBOXSCRIPT_ENVVARS[@]}" "$2" );
391 fi
392 shift;;
393 --*)
394 echo "error: Unknown option '$1' in existing config"
395 exit 1
396 ;;
397
398 # Non-option bits.
399 *.py) ;; # ignored, should be the script.
400
401 *) if [ ${MY_ARG} -ne 0 ]; then
402 echo "error: unknown non-option '$1' in existing config"
403 exit 1
404 fi
405 TESTBOXSCRIPT_PYTHON="$1"
406 ;;
407 esac
408 shift
409 MY_ARG=$((${MY_ARG} + 1))
410 done
411}
412
413##
414# Used by common_compile_testboxscript_command_line, please override.
415#
416os_add_args() {
417 echo "os_add_args is not implemented" 2>&1
418 exit 1
419}
420
421##
422# Compiles the testboxscript.py command line given the current
423# configuration and defaults.
424#
425# This is used by solaris and darwin.
426#
427# The os_add_args function will be called several with one or two arguments
428# each time. The caller must override it.
429#
430common_compile_testboxscript_command_line() {
431 if [ -n "${TESTBOXSCRIPT_PYTHON}" ]; then
432 os_add_args "${TESTBOXSCRIPT_PYTHON}"
433 fi
434 os_add_args "${TESTBOXSCRIPT_DIR}/testboxscript/testboxscript.py"
435
436 for var in ${TESTBOXSCRIPT_CFG_NAMES};
437 do
438 varcfg=TESTBOXSCRIPT_${var}
439 vardef=TESTBOXSCRIPT_DEFAULT_${var}
440 if [ "${!varcfg}" != "${!vardef}" -a "${var}" != "PYTHON" ]; then # PYTHON handled above.
441 my_opt=TESTBOXSCRIPT_OPT_${var}
442 if [ -n "${!my_opt}" ]; then
443 if [ "${!my_opt}" == "--spb" ]; then
444 os_add_args "${!my_opt}"
445 elif [ "${!my_opt}" != "--skip" ]; then
446 os_add_args "${!my_opt}" "${!varcfg}"
447 fi
448 else
449 my_opt_yes=${my_opt}_YES
450 my_opt_no=${my_opt}_NO
451 if [ -n "${!my_opt_yes}" -a -n "${!my_opt_no}" ]; then
452 if [ "${!varcfg}" = "yes" ]; then
453 os_add_args "${!my_opt_yes}";
454 else
455 if [ "${!varcfg}" != "no" ]; then
456 echo "internal option misconfig: var=${var} not a yes/no value: ${!varcfg}";
457 exit 1;
458 fi
459 os_add_args "${!my_opt_yes}";
460 fi
461 else
462 echo "internal option misconfig: var=${var} my_opt_yes=${my_opt_yes}=${!my_opt_yes} my_opt_no=${my_opt_no}=${!my_opt_no}"
463 exit 1;
464 fi
465 fi
466 fi
467 done
468
469 i=0
470 while [ "${i}" -lt "${#TESTBOXSCRIPT_ENVVARS[@]}" ];
471 do
472 os_add_args "--putenv" "${TESTBOXSCRIPT_ENVVARS[${i}]}"
473 i=$((${i} + 1))
474 done
475}
476
477
478#
479#
480# main()
481#
482#
483
484
485#
486# Get our bearings and include the host specific code.
487#
488MY_ETC_SUDOERS="/etc/sudoers"
489MY_FGREP=fgrep
490DIR=`dirname "$0"`
491DIR=`cd "${DIR}"; /bin/pwd`
492
493get_host_os
494HOST_OS=${RETVAL}
495get_host_arch
496HOST_ARCH=${RETVAL}
497
498. "${DIR}/${HOST_OS}/setup-routines.sh"
499
500
501#
502# Config.
503#
504TESTBOXSCRIPT_CFG_NAMES="DIR PYTHON USER HWVIRT IOMMU NESTED_PAGING SYSTEM_UUID PATH_TESTRSRC TEST_MANAGER SCRATCH_ROOT"
505TESTBOXSCRIPT_CFG_NAMES="${TESTBOXSCRIPT_CFG_NAMES} BUILDS_PATH BUILDS_TYPE BUILDS_NAME BUILDS_SHARE BUILDS_USER"
506TESTBOXSCRIPT_CFG_NAMES="${TESTBOXSCRIPT_CFG_NAMES} BUILDS_PASSWD BUILDS_MOUNTOPT TESTRSRC_PATH TESTRSRC_TYPE TESTRSRC_NAME"
507TESTBOXSCRIPT_CFG_NAMES="${TESTBOXSCRIPT_CFG_NAMES} TESTRSRC_SHARE TESTRSRC_USER TESTRSRC_PASSWD TESTRSRC_MOUNTOPT SPB"
508
509# testboxscript.py option to config mappings.
510TESTBOXSCRIPT_OPT_DIR="--skip"
511TESTBOXSCRIPT_OPT_PYTHON="--skip"
512TESTBOXSCRIPT_OPT_USER="--skip"
513TESTBOXSCRIPT_OPT_HWVIRT_YES="--hwvirt"
514TESTBOXSCRIPT_OPT_HWVIRT_NO="--no-hwvirt"
515TESTBOXSCRIPT_OPT_NESTED_PAGING_YES="--nested-paging"
516TESTBOXSCRIPT_OPT_NESTED_PAGING_NO="--no-nested-paging"
517TESTBOXSCRIPT_OPT_IOMMU_YES="--io-mmu"
518TESTBOXSCRIPT_OPT_IOMMU_NO="--no-io-mmu"
519TESTBOXSCRIPT_OPT_SPB="--spb"
520TESTBOXSCRIPT_OPT_SYSTEM_UUID="--system-uuid"
521TESTBOXSCRIPT_OPT_TEST_MANAGER="--test-manager"
522TESTBOXSCRIPT_OPT_SCRATCH_ROOT="--scratch-root"
523TESTBOXSCRIPT_OPT_BUILDS_PATH="--builds-path"
524TESTBOXSCRIPT_OPT_BUILDS_TYPE="--builds-server-type"
525TESTBOXSCRIPT_OPT_BUILDS_NAME="--builds-server-name"
526TESTBOXSCRIPT_OPT_BUILDS_SHARE="--builds-server-share"
527TESTBOXSCRIPT_OPT_BUILDS_USER="--builds-server-user"
528TESTBOXSCRIPT_OPT_BUILDS_PASSWD="--builds-server-passwd"
529TESTBOXSCRIPT_OPT_BUILDS_MOUNTOPT="--builds-server-mountopt"
530TESTBOXSCRIPT_OPT_PATH_TESTRSRC="--testrsrc-path"
531TESTBOXSCRIPT_OPT_TESTRSRC_TYPE="--testrsrc-server-type"
532TESTBOXSCRIPT_OPT_TESTRSRC_NAME="--testrsrc-server-name"
533TESTBOXSCRIPT_OPT_TESTRSRC_SHARE="--testrsrc-server-share"
534TESTBOXSCRIPT_OPT_TESTRSRC_USER="--testrsrc-server-user"
535TESTBOXSCRIPT_OPT_TESTRSRC_PASSWD="--testrsrc-server-passwd"
536TESTBOXSCRIPT_OPT_TESTRSRC_MOUNTOPT="--testrsrc-server-mountopt"
537
538# Defaults:
539TESTBOXSCRIPT_DEFAULT_DIR="there-is-no-default-for-this-value"
540TESTBOXSCRIPT_DEFAULT_PYTHON=""
541TESTBOXSCRIPT_DEFAULT_USER="vbox"
542TESTBOXSCRIPT_DEFAULT_HWVIRT=""
543TESTBOXSCRIPT_DEFAULT_IOMMU=""
544TESTBOXSCRIPT_DEFAULT_NESTED_PAGING=""
545TESTBOXSCRIPT_DEFAULT_SPB=""
546TESTBOXSCRIPT_DEFAULT_SYSTEM_UUID=""
547TESTBOXSCRIPT_DEFAULT_PATH_TESTRSRC=""
548TESTBOXSCRIPT_DEFAULT_TEST_MANAGER=""
549TESTBOXSCRIPT_DEFAULT_SCRATCH_ROOT=""
550TESTBOXSCRIPT_DEFAULT_BUILDS_PATH=""
551TESTBOXSCRIPT_DEFAULT_BUILDS_TYPE="cifs"
552TESTBOXSCRIPT_DEFAULT_BUILDS_NAME="vboxstor.de.oracle.com"
553TESTBOXSCRIPT_DEFAULT_BUILDS_SHARE="builds"
554TESTBOXSCRIPT_DEFAULT_BUILDS_USER="guestr"
555TESTBOXSCRIPT_DEFAULT_BUILDS_PASSWD="guestr"
556TESTBOXSCRIPT_DEFAULT_BUILDS_MOUNTOPT=""
557TESTBOXSCRIPT_DEFAULT_TESTRSRC_PATH=""
558TESTBOXSCRIPT_DEFAULT_TESTRSRC_TYPE="cifs"
559TESTBOXSCRIPT_DEFAULT_TESTRSRC_NAME="teststor.de.oracle.com"
560TESTBOXSCRIPT_DEFAULT_TESTRSRC_SHARE="testrsrc"
561TESTBOXSCRIPT_DEFAULT_TESTRSRC_USER="guestr"
562TESTBOXSCRIPT_DEFAULT_TESTRSRC_PASSWD="guestr"
563TESTBOXSCRIPT_DEFAULT_TESTRSRC_MOUNTOPT=""
564
565# Set config values to defaults.
566for var in ${TESTBOXSCRIPT_CFG_NAMES}
567do
568 defvar=TESTBOXSCRIPT_DEFAULT_${var}
569 eval TESTBOXSCRIPT_${var}="${!defvar}"
570done
571declare -a TESTBOXSCRIPT_ENVVARS
572
573# Load old config values (platform specific).
574os_load_config
575
576
577#
578# Config tweaks.
579#
580
581# The USER must be a non-empty value for the successful execution of this script.
582if [ -z "${TESTBOXSCRIPT_USER}" ]; then
583 TESTBOXSCRIPT_USER=${TESTBOXSCRIPT_DEFAULT_USER};
584fi;
585
586# The DIR must be according to the setup.sh location.
587TESTBOXSCRIPT_DIR=`dirname "${DIR}"`
588
589# Storage server replacement trick.
590if [ "${TESTBOXSCRIPT_BUILDS_NAME}" = "solserv.de.oracle.com" ]; then
591 TESTBOXSCRIPT_BUILDS_NAME=${TESTBOXSCRIPT_DEFAULT_BUILDS_NAME}
592fi
593if [ "${TESTBOXSCRIPT_TESTRSRC_NAME}" = "solserv.de.oracle.com" ]; then
594 TESTBOXSCRIPT_TESTRSRC_NAME=${TESTBOXSCRIPT_DEFAULT_TESTRSRC_NAME}
595fi
596
597
598#
599# Parse arguments.
600#
601while test $# -gt 0;
602do
603 case "$1" in
604 -h|--help)
605 echo "TestBox Script setup utility."
606 echo "";
607 echo "Usage: setup.sh [options]";
608 echo "";
609 echo "Options:";
610 echo " Later...";
611 exit 0;
612 ;;
613 -V|--version)
614 echo '$Revision: 85014 $'
615 exit 0;
616 ;;
617
618 --python) TESTBOXSCRIPT_PYTHON="$2"; shift;;
619 --test-manager) TESTBOXSCRIPT_TEST_MANAGER="$2"; shift;;
620 --scratch-root) TESTBOXSCRIPT_SCRATCH_ROOT="$2"; shift;;
621 --system-uuid) TESTBOXSCRIPT_SYSTEM_UUID="$2"; shift;;
622 --hwvirt) TESTBOXSCRIPT_HWVIRT="yes";;
623 --no-hwvirt) TESTBOXSCRIPT_HWVIRT="no";;
624 --nested-paging) TESTBOXSCRIPT_NESTED_PAGING="yes";;
625 --no-nested-paging) TESTBOXSCRIPT_NESTED_PAGING="no";;
626 --io-mmu) TESTBOXSCRIPT_IOMMU="yes";;
627 --no-io-mmu) TESTBOXSCRIPT_IOMMU="no";;
628 --builds-path) TESTBOXSCRIPT_BUILDS_PATH="$2"; shift;;
629 --builds-server-type) TESTBOXSCRIPT_BUILDS_TYPE="$2"; shift;;
630 --builds-server-name) TESTBOXSCRIPT_BUILDS_NAME="$2"; shift;;
631 --builds-server-share) TESTBOXSCRIPT_BUILDS_SHARE="$2"; shift;;
632 --builds-server-user) TESTBOXSCRIPT_BUILDS_USER="$2"; shift;;
633 --builds-server-passwd) TESTBOXSCRIPT_BUILDS_PASSWD="$2"; shift;;
634 --builds-server-mountopt) TESTBOXSCRIPT_BUILDS_MOUNTOPT="$2"; shift;;
635 --testrsrc-path) TESTBOXSCRIPT_TESTRSRC_PATH="$2"; shift;;
636 --testrsrc-server-type) TESTBOXSCRIPT_TESTRSRC_TYPE="$2"; shift;;
637 --testrsrc-server-name) TESTBOXSCRIPT_TESTRSRC_NAME="$2"; shift;;
638 --testrsrc-server-share) TESTBOXSCRIPT_TESTRSRC_SHARE="$2"; shift;;
639 --testrsrc-server-user) TESTBOXSCRIPT_TESTRSRC_USER="$2"; shift;;
640 --testrsrc-server-passwd) TESTBOXSCRIPT_TESTRSRC_PASSWD="$2"; shift;;
641 --testrsrc-server-mountopt) TESTBOXSCRIPT_TESTRSRC_MOUNTOPT="$2"; shift;;
642 --spb) TESTBOXSCRIPT_SPB="yes";;
643 *)
644 echo 'Syntax error: Unknown option:' "$1" >&2;
645 exit 1;
646 ;;
647 esac
648 shift;
649done
650
651
652#
653# Find usable python if not already specified.
654#
655if [ -z "${TESTBOXSCRIPT_PYTHON}" ]; then
656 set +e
657 MY_PYTHON_VER_TEST="\
658import sys;\
659x = sys.version_info[0] == 2 and (sys.version_info[1] >= 6 or (sys.version_info[1] == 5 and sys.version_info[2] >= 1));\
660sys.exit(not x);\
661";
662 for python in python2.7 python2.6 python2.5 python;
663 do
664 python=`which ${python} 2> /dev/null`
665 if [ -n "${python}" -a -x "${python}" ]; then
666 if ${python} -c "${MY_PYTHON_VER_TEST}"; then
667 TESTBOXSCRIPT_PYTHON="${python}";
668 break;
669 fi
670 fi
671 done
672 set -e
673 test -n "${TESTBOXSCRIPT_PYTHON}";
674fi
675
676
677#
678# Do the job
679#
680set -e
681check_testboxscript_install;
682check_for_sudo;
683check_for_cifs;
684check_proxy_config;
685
686maybe_add_testboxscript_user;
687test_user;
688test_coredumps;
689test_unattended_updates_disabled;
690
691grant_user_testboxscript_write_access;
692
693os_disable_service;
694os_install_service;
695os_enable_service;
696
697#
698# That's all folks.
699#
700echo "done"
701os_final_message;
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