source: trunk/test/testrun_2c.sh@ 12

Last change on this file since 12 was 1, checked in by katerina, 19 years ago

Initial import

File size: 4.7 KB
RevLine 
[1]1#! /bin/sh
2
3
4# The following two are the ANSI sequences for start and end embolden
5case $TERM in
6vt*|ansi*|con*|xterm*|linux*|screen*)
7 S=[1m
8 E=[m
9 ;;
10*)
11 S=
12 E=
13 ;;
14esac
15
16PW_DIR=`pwd`
17
18if test x$UID != x; then
19 TRUST="--with-trusted=0,2,$UID"
20else
21 TRUST="--with-trusted=0,2"
22fi
23
24echo; echo "${S}__ STARTING TEST RUN CLIENT/SERVER W/MYSQL __${E}"; echo;
25echo Working directory: $PW_DIR
26
27MAKE=`which gmake`
28if test "x$?" = x1 ; then
29 MAKE="make -s"
30else
31 MAKE=`which gmake | sed -e "s%\([a-z:]\) .*%\1%g"`
32 if test "x$MAKE" = x; then
33 MAKE="make -s"
34 elif test "x$MAKE" = xno; then
35 MAKE="make -s"
36 else
37 if test "x$MAKE" = "xwhich:"; then
38 MAKE="make -s"
39 else
40 MAKE="gmake -s"
41 gmake -v >/dev/null 2>&1 || MAKE="make -s"
42 fi
43 fi
44fi
45
46echo MAKE is $MAKE
47echo
48
49
50testrun2c ()
51{
52 #
53 # test standalone compilation
54 #
55 echo "${S}Building client and server${E}"; echo;
56 #
57 if test -r "Makefile"; then
58 $MAKE distclean
59 fi
60 #
61 #
62 # ${TOP_SRCDIR}/configure --quiet $TRUST --enable-login-watch --enable-xml-log --enable-debug --enable-network=client --enable-srp --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=localhost --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock
63 #
64 ${TOP_SRCDIR}/configure --prefix=$PW_DIR --localstatedir=$PW_DIR --enable-network=client --disable-mail --disable-external-scripts --enable-login-watch --enable-xml-log --enable-db-reload --with-logserver=localhost --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-timeserver=localhost --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock
65 #
66 #
67 if test x$? = x0; then
68 echo "configure completed, exit status 0"; echo;
69 $MAKE > /dev/null
70 if test x$? = x0; then
71 echo "$MAKE completed, exit status $?"; echo;
72 else
73 echo "${S}ERROR:${E} make failed, exit status $?"; echo;
74 exit
75 fi
76
77 else
78 echo "${S}ERROR:${E} configure failed, exit status $?"; echo;
79 exit
80 fi
81
82 # save binary and build server
83 #
84 cp samhain samhain.build
85 make clean
86
87 #
88 ${TOP_SRCDIR}/configure --quiet $TRUST --enable-xml-log --enable-debug --enable-network=server --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=${SH_LOCALHOST} --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-database=mysql
89
90# --enable-login-watch --enable-mounts-check --enable-userfiles --enable-identity=yule --enable-suidcheck --with-gpg=/usr/local/bin/gpg --with-fp="EF6C EF54 701A 0AFD B86A F4C3 1AAD 26C8 0F57 1F6C"
91
92 #
93 # --with-database=mysql --with-libs=-L/usr/local/mysql/lib
94 # --with-database=postgresql
95 #
96 if test x$? = x0; then
97 echo "configure completed, exit status 0"; echo;
98 $MAKE > /dev/null
99 if test x$? = x0; then
100 echo "$MAKE completed, exit status $?"; echo;
101 else
102 echo "${S}ERROR:${E} make failed, exit status $?"; echo;
103 exit
104 fi
105
106 else
107 echo "${S}ERROR:${E} configure failed, exit status $?"; echo;
108 exit
109 fi
110 echo "${S}Initialize database${E}"; echo;
111
112 rm -f ./.samhain_file
113 rm -f ./.samhain_log
114 rm -f ./.samhain_lock
115 rm -f ./rc.${SH_LOCALHOST}
116 rm -f ./file.${SH_LOCALHOST}
117
118 cp ${SCRIPTDIR}/testrc_2.in testrc_2
119
120 # Create a password
121 SHPW=`./yule -G`
122 if test x"$SHPW" = x; then
123 echo "password not generated -- aborting"
124 exit 1
125 fi
126
127 # Set in client
128 echo "./samhain_setpwd samhain.build new $SHPW"
129 ./samhain_setpwd samhain.build new $SHPW
130 mv samhain.build.new samhain.new
131 SHCLT=`./yule -P $SHPW | sed s%HOSTNAME%${SH_LOCALHOST}%`
132 echo $SHCLT >> testrc_2
133
134 echo "./samhain.new -t init"
135 ./samhain.new -t init
136
137 SHINI=$?
138
139 rm -f ./.samhain_log
140 rm -f ./.samhain_lock
141
142 cp ./testrc_2 ./rc.${SH_LOCALHOST}
143 mv ./.samhain_file ./file.${SH_LOCALHOST}
144
145 if test x$SHINI = x0; then
146
147 echo; echo "${S}Start Server${E}: ./yule &"; echo;
148 ./yule &
149 PROC_Y=$!
150 sleep 5
151
152 echo; echo "${S}Start Client${E}: ./samhain.new -l none -p none -e info -t check";
153
154 ./samhain.new -t check -p none -l none -e info
155 if test x$? = x0; then
156 echo "${S}check completed${E}"
157 else
158 echo "${S}ERROR:${E} -- check -- failed, exit status $?"
159 echo
160 kill $PROC_Y
161 exit
162 fi
163
164 kill $PROC_Y
165 sleep 5
166 else
167 echo "${S}ERROR:${E} -- init -- failed, exit status $SHINI";
168 echo;
169 exit
170 fi
171
172}
173
174 if test x$1 = x; then
175 echo
176 echo "Please provide the local hostname as argument."
177 echo
178 exit 8
179 fi
180
181 SH_LOCALHOST=$1; export SH_LOCALHOST
182
183 testrun2c
184
185
186echo; echo "${S}__ END TEST RUN CLIENT/SERVER W/MYSQL __${E}"; echo;
187
188exit
189
Note: See TracBrowser for help on using the repository browser.