makecerts requirement

This commit is contained in:
olszomal 2020-01-29 19:26:31 +01:00 committed by Michał Trojnara
parent 2bb573219a
commit e7dd72c64d
2 changed files with 165 additions and 127 deletions

View File

@ -1,5 +1,7 @@
#!/bin/sh #!/bin/sh
result=0
test_result() { test_result() {
if [ "$1" == 0 ] if [ "$1" == 0 ]
then then
@ -9,8 +11,8 @@ if [ "$1" == 0 ]
fi fi
} }
make_certs() {
password=passme password=passme
result_path=$(pwd) result_path=$(pwd)
cd $(dirname "$0") cd $(dirname "$0")
script_path=$(pwd) script_path=$(pwd)
@ -20,7 +22,8 @@ mkdir "tmp/"
# OpenSSL settings # OpenSSL settings
CONF="${script_path}/openssltest.cnf" CONF="${script_path}/openssltest.cnf"
TEMP_LD_LIBRARY_PATH=$LD_LIBRARY_PATH TEMP_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
if test -n "$1"; then if test -n "$1"
then
OPENSSL="$1/bin/openssl" OPENSSL="$1/bin/openssl"
LD_LIBRARY_PATH="$1/lib" LD_LIBRARY_PATH="$1/lib"
else else
@ -137,17 +140,17 @@ test_result $?
# copy new files # copy new files
if [ -s tmp/CACert.pem ] && [ -s tmp/crosscert.pem ] && [ -s tmp/expired.pem ] && [ -s tmp/cert.pem ] && \ if [ -s tmp/CACert.pem ] && [ -s tmp/crosscert.pem ] && [ -s tmp/expired.pem ] && [ -s tmp/cert.pem ] && \
[ -s tmp/CACertCRL.pem ] && [ -s tmp/revoked.pem ] && \ [ -s tmp/CACertCRL.pem ] && [ -s tmp/revoked.pem ] && [ -s tmp/key.pem ] && [ -s tmp/keyp.pem ] && \
[ -s tmp/key.pem ] && [ -s tmp/keyp.pem ] && [ -s tmp/key.der ] && \ [ -s tmp/key.der ] && [ -s tmp/cert.der ] && [ -s tmp/cert.spc ] && [ -s tmp/cert.p12 ]
[ -s tmp/cert.der ] && [ -s tmp/cert.spc ] && [ -s tmp/cert.p12 ]
then then
cp tmp/* ./ cp tmp/* ./
printf "%s\n" "keys & certificates successfully generated" printf "%s\n" "keys & certificates successfully generated"
printf "%s\n" "./makecerts.sh finished" printf "%s\n" "makecerts.sh finished"
rm -f "makecerts.log" rm -f "makecerts.log"
else else
printf "%s\n" "./makecerts.sh failed" printf "%s\n" "makecerts.sh failed"
printf "%s\n" "error logs ${result_path}/makecerts.log" printf "%s\n" "error logs ${result_path}/makecerts.log"
result=1
fi fi
# remove the working directory # remove the working directory
@ -156,3 +159,19 @@ rm -rf "tmp/"
# restore settings # restore settings
LD_LIBRARY_PATH=$TEMP_LD_LIBRARY_PATH LD_LIBRARY_PATH=$TEMP_LD_LIBRARY_PATH
exit $result
}
# Tests requirement
if [ -n "$(command -v faketime)" ]
then
make_certs $1
result=$?
else
printf "%s\n" "faketime not found in \$PATH"
printf "%s\n" "tests skipped, please install faketime package"
result=1
fi
exit $result

View File

@ -2,7 +2,7 @@
# mingw64-gcc, gcab, msitools, libgsf, libgsf-devel # mingw64-gcc, gcab, msitools, libgsf, libgsf-devel
# vim-common, libfaketime packages are required # vim-common, libfaketime packages are required
result=1 result=0
count=0 count=0
skip=0 skip=0
fail=0 fail=0
@ -11,6 +11,7 @@ result_path=$(pwd)
cd $(dirname "$0") cd $(dirname "$0")
script_path=$(pwd) script_path=$(pwd)
result_path="${result_path}/logs" result_path="${result_path}/logs"
certs_path="${script_path}/certs"
make_tests() { make_tests() {
for plik in ${script_path}/recipes/* for plik in ${script_path}/recipes/*
@ -22,7 +23,7 @@ make_tests() {
then then
skip=$(grep -c "Test skipped" "results.log") skip=$(grep -c "Test skipped" "results.log")
fail=$(grep -c "Test failed" "results.log") fail=$(grep -c "Test failed" "results.log")
printf "%s\n" "./newtest.sh finished" printf "%s\n" "testall.sh finished"
printf "%s\n" "summary: success $count, skip $skip, fail $fail" printf "%s\n" "summary: success $count, skip $skip, fail $fail"
else # no test was done else # no test was done
result=1 result=1
@ -36,6 +37,23 @@ cd "${result_path}"
date > "results.log" date > "results.log"
../../osslsigncode -v >> "results.log" 2>/dev/null ../../osslsigncode -v >> "results.log" 2>/dev/null
cd ${certs_path}
if [ -s CACert.pem ] && [ -s crosscert.pem ] && [ -s expired.pem ] && [ -s cert.pem ] && \
[ -s CACertCRL.pem ] && [ -s revoked.pem ] && [ -s key.pem ] && [ -s keyp.pem ] && \
[ -s key.der ] && [ -s cert.der ] && [ -s cert.spc ] && [ -s cert.p12 ]
then
printf "%s\n" "keys & certificates path: ${certs_path}"
else
./makecerts.sh $1
result=$?
fi
cd "${result_path}"
if [ "$result" -ne 0 ]
then
exit $result
fi
# PE and CAB files support # PE and CAB files support
if [ -n "$(command -v x86_64-w64-mingw32-gcc)" ] if [ -n "$(command -v x86_64-w64-mingw32-gcc)" ]
then then
@ -91,4 +109,5 @@ if [ -n "$(command -v faketime)" ]
printf "%s\n" "faketime not found in \$PATH" printf "%s\n" "faketime not found in \$PATH"
printf "%s\n" "tests skipped, please install faketime package" printf "%s\n" "tests skipped, please install faketime package"
fi fi
exit $result exit $result