aboutsummaryrefslogtreecommitdiff
path: root/src/kadmin/testing/scripts/env-setup.shin
blob: ae501300955da49bd1d6b045efb72b1ab801086d (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/sh
#
# The KADM5 unit tests were developed to work under gmake.  As a
# result, they expect to inherit a number of environment variables.
# Rather than rewrite the tests, we simply use this script as an
# execution wrapper that sets all the necessary environment variables
# before running the program specified on its command line.
#
# The variable settings all came from OV's config.mk.
#
# Usage: env-setup.sh <command line>
#

TOP=@RBUILD@/kadmin
STOP=@SRCTOP@/kadmin
export TOP
export STOP

# The shared library run time setup
TOPLIBD=@RBUILD@/lib
# This converts $(TOPLIBD) to $TOPLIBD
foo=`echo '@KRB5_RUN_ENV@' | sed -e 's/(//' -e 's/)//'` 
eval $foo

# This will get put in setup.csh for convenience
KRB5_RUN_ENV_CSH=`eval echo "$foo" | \
	sed -e 's/\([^=]*\)=\(.*\)/setenv \1 \2/g'`
export KRB5_RUN_ENV_CSH

TESTDIR=$TOP/testing; export TESTDIR
STESTDIR=$STOP/testing; export STESTDIR
if [ "$K5ROOT" = "" ]; then
	K5ROOT="`cd $TESTDIR; pwd`/krb5-test-root"
	export K5ROOT
fi

# If $VERBOSE_TEST is non-null, enter verbose mode.  Set $VERBOSE to
# true or false so its exit status identifies the mode.
if test x$VERBOSE_TEST = x; then
	VERBOSE=false
else
	VERBOSE=true
fi
export VERBOSE

REALM=SECURE-TEST.OV.COM; export REALM

EXPECT=@EXPECT@; export EXPECT

COMPARE_DUMP=$TESTDIR/scripts/compare_dump.pl; export COMPARE_DUMP
FIX_CONF_FILES=$TESTDIR/scripts/fixup-conf-files.pl
export FIX_CONF_FILES
INITDB=$STESTDIR/scripts/init_db; export INITDB
MAKE_KEYTAB=$TESTDIR/scripts/make-host-keytab.pl; export MAKE_KEYTAB
LOCAL_MAKE_KEYTAB=$TESTDIR/scripts/make-host-keytab.pl
export LOCAL_MAKE_KEYTAB
RESTORE_FILES=$TESTDIR/scripts/restore_files.sh; export RESTORE_FILES
SAVE_FILES=$STESTDIR/scripts/save_files.sh; export SAVE_FILES
SIMPLE_DUMP=$TESTDIR/scripts/simple_dump.pl; export SIMPLE_DUMP
QUALNAME=$TESTDIR/scripts/qualname.pl; export QUALNAME
TCLUTIL=$STESTDIR/tcl/util.t; export TCLUTIL
BSDDB_DUMP=$TESTDIR/util/bsddb_dump; export BSDDB_DUMP
CLNTTCL=$TESTDIR/util/ovsec_kadm_clnt_tcl; export CLNTTCL
SRVTCL=$TESTDIR/util/ovsec_kadm_srv_tcl; export SRVTCL

KRB5_CONFIG=$K5ROOT/krb5.conf; export KRB5_CONFIG
KRB5_KDC_PROFILE=$K5ROOT/kdc.conf; export KRB5_KDC_PROFILE
KRB5_KTNAME=$K5ROOT/ovsec_adm.srvtab; export KRB5_KTNAME
KRB5CCNAME=/tmp/krb5cc_unit-test; export KRB5CCNAME

if [ "$TEST_SERVER" != "" ]; then
	MAKE_KEYTAB="$MAKE_KEYTAB -server $TEST_SERVER"
fi
if [ "$TEST_PATH" != "" ]; then
	MAKE_KEYTAB="$MAKE_KEYTAB -top $TEST_PATH"
fi

if [ "x$PS_ALL" = "x" ]; then
	ps -axwwu >/dev/null 2>&1
	ps_bsd=$?

	ps -ef >/dev/null 2>&1
	ps_sysv=$?

	if [ $ps_bsd = 0 -a $ps_sysv = 1 ]; then
		PS_ALL="ps -auxww"
		PS_PID="ps -auxww"
	elif [ $ps_bsd = 1 -a $ps_sysv = 0 ]; then
		PS_ALL="ps -ef"
		PS_PID="ps -fp"
	else
		PS_ALL="ps -auxww"
		PS_PID="ps -auxww"
		echo "WARNING!  Cannot auto-detect ps type, assuming BSD."
	fi

	export PS_ALL PS_PID
fi

exec ${1+"$@"}