Polish shell script to avoid needless complexity.
[openssl.git] / test / testca
index 8215ebb5d1d0194da164aad5b2add2eb36ae50fa..4bcb1fd57680382b219b38c5d9c6c97342f40456 100644 (file)
@@ -1,48 +1,29 @@
 #!/bin/sh
 
-SH="/bin/sh"
+set -e
+
+PERL="$1"
+
 if test "$OSTYPE" = msdosdjgpp; then
-    PATH=./apps\;../apps\;$PATH
+    PATH="../apps\;$PATH"
 else
-    PATH=../apps:$PATH
+    PATH="../apps:$PATH"
 fi
-export SH PATH
+export PATH
 
-SSLEAY_CONFIG="-config CAss.cnf"
-export SSLEAY_CONFIG
+export SSLEAY_CONFIG="-config CAss.cnf"
+export OPENSSL="`pwd`/../util/opensslwrap.sh"
 
 /bin/rm -fr demoCA
-$SH ../apps/CA.sh -newca <<EOF
-EOF
 
-if [ $? != 0 ]; then
-       exit 1;
-fi
-
-SSLEAY_CONFIG="-config Uss.cnf"
-export SSLEAY_CONFIG
-$SH ../apps/CA.sh -newreq
-if [ $? != 0 ]; then
-       exit 1;
-fi
+OPENSSL_CONFIG=/dev/null $PERL ../apps/CA.pl -newca </dev/null
 
+export SSLEAY_CONFIG="-config Uss.cnf"
+$PERL ../apps/CA.pl -newreq
 
 SSLEAY_CONFIG="-config ../apps/openssl.cnf"
-export SSLEAY_CONFIG
-$SH ../apps/CA.sh -sign  <<EOF
-y
-y
-EOF
-if [ $? != 0 ]; then
-       exit 1;
-fi
-
+yes | $PERL ../apps/CA.pl -sign
 
-$SH ../apps/CA.sh -verify newcert.pem
-if [ $? != 0 ]; then
-       exit 1;
-fi
+$PERL ../apps/CA.pl -verify newcert.pem
 
 /bin/rm -fr demoCA newcert.pem newreq.pem
-#usage: CA -newcert|-newreq|-newca|-sign|-verify
-