Polish shell script to avoid needless complexity.

No need for here documents, just use "yes" or </dev/null.
No need for "|| exit 1" clauses, just use "set -e".

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
This commit is contained in:
Viktor Dukhovni 2015-04-10 12:25:30 -04:00
parent e71cecd551
commit 34b0a927ab

View File

@ -1,5 +1,7 @@
#!/bin/sh #!/bin/sh
set -e
PERL="$1" PERL="$1"
if test "$OSTYPE" = msdosdjgpp; then if test "$OSTYPE" = msdosdjgpp; then
@ -9,35 +11,19 @@ else
fi fi
export PATH export PATH
SSLEAY_CONFIG="-config CAss.cnf" export SSLEAY_CONFIG="-config CAss.cnf"
export SSLEAY_CONFIG export OPENSSL="`pwd`/../util/opensslwrap.sh"
OPENSSL="`pwd`/../util/opensslwrap.sh"
export OPENSSL
/bin/rm -fr demoCA /bin/rm -fr demoCA
# Could do '...CA.pl -newca <<EOF || exit 1 OPENSSL_CONFIG=/dev/null $PERL ../apps/CA.pl -newca </dev/null
# EOF' but that seems too obscure to me. :)
OPENSSL_CONFIG=/dev/null $PERL ../apps/CA.pl -newca <<EOF
EOF
[ $? -eq 0 ] || exit 1
SSLEAY_CONFIG="-config Uss.cnf" export SSLEAY_CONFIG="-config Uss.cnf"
export SSLEAY_CONFIG $PERL ../apps/CA.pl -newreq
$PERL ../apps/CA.pl -newreq || exit 1
SSLEAY_CONFIG="-config ../apps/openssl.cnf" SSLEAY_CONFIG="-config ../apps/openssl.cnf"
export SSLEAY_CONFIG yes | $PERL ../apps/CA.pl -sign
# Same comment here. $PERL ../apps/CA.pl -verify newcert.pem
$PERL ../apps/CA.pl -sign <<EOF
y
y
EOF
[ $? -eq 0 ] || exit 1
$PERL ../apps/CA.pl -verify newcert.pem || exit 1
/bin/rm -fr demoCA newcert.pem newreq.pem /bin/rm -fr demoCA newcert.pem newreq.pem