-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig
More file actions
executable file
·203 lines (175 loc) · 5.05 KB
/
config
File metadata and controls
executable file
·203 lines (175 loc) · 5.05 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# -*- sh -*-
#
# tiger - A UN*X security checking system
# Copyright (C) 1993 Douglas Lee Schales, David K. Hess, David R. Safford
#
# Please see the file `COPYING' for the complete copyright notice.
#
# config (top level) - 06/14/93
#
# 04/29/93 dls Added support for 'tigerrc' file.
#
#-----------------------------------------------------------------------------
#
# space, tab, newline
TigerLogDir='.'
TigerWorkDir='/tmp'
TigerBinDir='$BASEDIR/bin'
checkfile()
{
_rcfile=$1
_rcpath=${2:=$1}
_status=1
if [ -d $_rcfile ]; then
echo "--CONFIG-- [con001c] Ignoring config file $_rcpath, (directory)"
elif [ -f $_rcfile ]; then
_status=0
_permit=`$LS $LSLINK -l $_rcfile |
$AWK '{printf("%s%s", substr($1,6,1), substr($1,9,1));}'`
[ "$_permit" != "--" ] && {
echo "--CONFIG-- [con003c] Ignoring config file $_rcpath, (world and/or group writable)"
_status=1
}
fi
return $_status
}
[ "$CONFIGURED_ALREADY" != "YES" ] && {
umask 077
CONFIGURED_ALREADY=YES
if [ -n "$TIGERHOMEDIR" -a "$TIGERHOMEDIR" != '.' ]; then
BASEDIR="$TIGERHOMEDIR"
elif [ -n "$TigerInstallDir" -a "$TigerInstallDir" != '.' ]; then
BASEDIR="$TigerInstallDir"
elif [ ! -d ./systems -a -d ../systems ]; then
BASEDIR='..'
else
BASEDIR='.'
fi
LOGDIR=${TigerLogDir:=.}
WORKDIR=${TigerWorkDir:=${TMPDIR:=/tmp}}
EXPLAINREPORT=N
SERVERCHECK=N
Tiger_TESTMODE=N
HTML=N
RCFILE=
export BASEDIR LOGDIR WORKDIR BINDIR EXPLAINREPORT SERVERCHECK RCFILE
export Tiger_TESTMODE TigerCleanup HTML
doversion=0
while [ $# != 0 ]
do
case $1 in
-v) doversion=1;;
-B) BASEDIR=$2; shift;;
-l) LOGDIR=$2; shift;;
-w) WORKDIR=$2; shift;;
-b) BINDIR=$2; shift;;
-c) RCFILE=$2; shift;;
-e) EXPLAINREPORT=I;;
-E) EXPLAINREPORT=Y;;
-S) SERVERCHECK=Y;;
-O) OS=$2; shift;;
-A) ARCH=$2; shift;;
-R) REV=$2; shift;;
-t) Tiger_TESTMODE=Y;;
-H) HTML=Y;;
*) echo "--ERROR-- [con006e] Unknown option $1";;
esac
shift;
done
TIGERHOMEDIR="$BASEDIR"
export TIGERHOMEDIR
TIGERVERSION="`/bin/cat $TIGERHOMEDIR/version.h 2>/dev/null`"
[ ! -n "$TIGERVERSION" ] && TIGERVERSION="undetermined"
export TIGERVERSION
[ $doversion -eq 1 ] && {
echo "tiger, version $TIGERVERSION"
exit 0
}
set X `$BASEDIR/util/gethostinfo` unknown unknown unknown
OS=${OS:=$2}
REV=${REV:=$3}
ARCH=${ARCH:=$4}
saveifs=$IFS
IFS=.
set X $REV
IFS=$saveifs
shift
REL="$1"
[ ! -n "$REL" ] && REL=$REV
[ ! -n "$BINDIR" ] && eval BINDIR=${TigerBinDir:=$BASEDIR/bin}
SCRIPTDIR=$BASEDIR/scripts
export SCRIPTDIR
CONFIG_LOC=${TIGERCONF:="$BASEDIR/systems"}
if [ -f "$CONFIG_LOC/$OS/$REL/$REV/$ARCH/config" ]; then
echo "Using configuration files for $OS $REV $ARCH."
CONFIG_DIR="$CONFIG_LOC/$OS/$REL/$REV/$ARCH"
elif [ -f "$CONFIG_LOC/$OS/$REL/$REV/config" ]; then
echo "Using configuration files for $OS $REV."
CONFIG_DIR="$CONFIG_LOC/$OS/$REL/$REV"
elif [ -f "$CONFIG_LOC/$OS/$REL/config" ]; then
echo "Using configuration files for $OS $REL"
CONFIG_DIR="$CONFIG_LOC/$OS/$REL"
elif [ -f "$CONFIG_LOC/$OS/config" ]; then
echo "No files for $OS $REV. Using configuration files for generic $OS."
CONFIG_DIR="$CONFIG_LOC/$OS"
elif [ -f "$CONFIG_LOC/default/config" ]; then
echo "No files for $OS. Using default configuration files."
echo "Not all checks may be performed."
CONFIG_DIR="$CONFIG_LOC/default"
else
echo "--ERROR-- [con008e] No configuration files for $OS $REV and can't find the"
echo " default configuration files. Terminating."
exit 1
fi
CONFIG_FILE="$CONFIG_DIR/config"
. $CONFIG_FILE
[ ! -n "$TESTEXEC" ] && TESTEXEC="-f"
[ ! -n "$TESTLINK" ] && TESTLINK="-h"
OUTPUTMETHOD="$CAT"
[ "$EXPLAINREPORT" != "N" ] && {
OUTPUTMETHOD="$BASEDIR/tigexp -F"
}
export OUTPUTMETHOD
HOSTNAME=`$GETHOSTNAME`
for file in './site-$HOSTNAME' '$BASEDIR/site-$HOSTNAME' './site' '$BASEDIR/site'
do
eval rc=$file
if checkfile $rc $file; then
SITECONFIG=$rc
break
fi
done
[ -n "$SITECONFIG" -a -r "$SITECONFIG" ] && . $SITECONFIG
[ -n "$RCFILE" -a ! -f "$RCFILE" ] && {
echo "Control file "$RCFILE" not found... exiting..."
exit 1
}
[ ! -n "$RCFILE" ] && {
for file in './.tigerrc' './tigerrc' '$HOME/.tigerrc' '$BASEDIR/tigerrc'
do
eval rc=$file
if checkfile $rc $file; then
RCFILE=$rc
break
fi
done
}
#
# Preprocess the RC file, to export variables to environment
#
[ -n "$RCFILE" -a -f $RCFILE ] && {
$GREP -v '^#' $RCFILE |
$SED -e 's/^\(.*\)=/export \1; \1=/' > $WORKDIR/rcfile.$$
. $WORKDIR/rcfile.$$
$RM -f $WORKDIR/rcfile.$$
}
HOSTNAMESLIST=${HOSTNAMESLIST:=$HOSTNAME}
export CONFIGURED_ALREADY OS REL REV ARCH HOSTNAME
export CONFIG_DIR CONFIG_FILE HOSTNAMESLIST CRACK
[ "$TigerNoBuild" != 'Y' ] && {
> $WORKDIR/tigercmds.$$
$BASEDIR/util/buildbins $WORKDIR/tigercmds.$$
. $WORKDIR/tigercmds.$$
$RM -f $WORKDIR/tigercmds.$$
}
}