summaryrefslogtreecommitdiffstats
path: root/src/kadmin/testing/scripts/start_servers
blob: 2e395faf858ac45eb7abb36f5159c0c1bc679aaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/sh
#
# Usage: start_servers [hostname [path]]
#
# This script turns a host into a OpenV*Secure primary server for the
# realm SECURE-TEST.OV.COM.  If no arguments are specified,
# the local host is affected.  Otherwise, the host hostname is
# affected; the path argument is the top of the Secure install tree on
# that host, and if it is not specified the current canonical value of
# TOP is used.

DUMMY=${TESTDIR=$TOP/testing}
DUMMY=${SAVE_FILES=$TESTDIR/scripts/save_files.sh}
DUMMY=${FIX_CONF_FILES=$TESTDIR/scripts/fixup-conf-files.pl}
DUMMY=${START_SERVERS_LOCAL=$TESTDIR/scripts/start_servers_local}
# This'll be wrong sometimes
DUMMY=${RSH_CMD=/usr/ucb/rsh}

# If it's set, set it to true
VERBOSE=${VERBOSE_TEST:+true}
# Otherwise, set it to false
DUMMY=${VERBOSE:=false}

local=1

if [ $# -gt 0 ]; then
	if [ $# != 1 -a $# != 2 ]; then
		echo "Usage: $0 [hostname [path]]" 1>&2
		exit 1
	fi

	local=0
	hostname=$1
	if [ $# = 1 ]; then
		rempath=`sh -c "cd $TOP && pwd"`
	else
		rempath=$2
	fi
fi

if [ $local = 0 ]; then
	$SAVE_FILES || exit 1
	$FIX_CONF_FILES -server $hostname || exit 1

# Using /usr/ucb/rsh and getting rid of "-k $REALM" until we get
# around to fixing the fact that Kerberos rsh doesn't strip out "-k
# REALM" when falling back.

	START_SERVERS_LOCAL=`echo $START_SERVERS_LOCAL|sed "s%$TOP%$rempath%"`
	CMD="$RSH_CMD $hostname -l root -n \
	  \"cd $rempath; \\\`testing/scripts/find-make.sh\\\` execute VERBOSE_TEST=$VERBOSE_TEST \
	    TOP=$rempath \
	    CMD='$START_SERVERS_LOCAL $rempath'\""

	if $VERBOSE; then
		echo "+++"
		echo "+++ Begin execution of start_servers_local on $hostname"
		echo "+++"
		echo $CMD
	fi
	eval $CMD
	if $VERBOSE; then
		echo "+++"
		echo "+++ End execution of start_servers_local on $hostname"
		echo "+++"
	fi
else
	$START_SERVERS_LOCAL
fi