summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2022-08-02 20:20:02 +0200
committerMartin Schanzenbach <schanzen@gnunet.org>2022-08-02 20:20:02 +0200
commitd7dde28801c8478e25c575c0a369284e324d3d24 (patch)
tree0b1934992eddcdfb9aea61de47882baa1c78579f /src
parent9850b818b4b4744840c7b441dbc1c0af533ee74c (diff)
TRANSPORT: Fix certtool detection. Fixes #7257
Diffstat (limited to 'src')
-rw-r--r--src/transport/gnunet-transport-certificate-creation.in26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/transport/gnunet-transport-certificate-creation.in b/src/transport/gnunet-transport-certificate-creation.in
index 454f05a5d..dfcb4e8e9 100644
--- a/src/transport/gnunet-transport-certificate-creation.in
+++ b/src/transport/gnunet-transport-certificate-creation.in
@@ -42,6 +42,10 @@
progname=${0##*/}
+existence() {
+ command -v "$1" >/dev/null 2>&1
+}
+
setdefaults()
{
verbosity=0
@@ -105,21 +109,23 @@ generate_cert_key()
CERTTOOL=""
GNUTLS_CA_TEMPLATE=@PKGDATADIRECTORY@/gnunet-gns-proxy-ca.template
OPENSSL=0
- if test -z "`gnutls-certtool --version`" > /dev/null
+ if test -x $(existence gnunet-certtool)
+ #if test -z "`gnutls-certtool --version`" > /dev/null
then
- if test -z "`certtool --version`" > /dev/null
+ if test -z "`certtool --version | grep gnutls`" > /dev/null
then
- if test -z "`openssl version`" > /dev/null
+ warningmsg "'gnutls-certtool' or 'certtool' command not found. Trying openssl."
+ # if test -z "`openssl version`" > /dev/null
+ if test -x $(existence openssl)
then
+ OPENSSL=1
+ else
warningmsg "Install either gnutls certtool or openssl for certificate generation!"
+ statusmsg "Cleaning up."
exit 1
- else
- OPENSSL=1
fi
- CERTTOOL="openssl"
- else
- CERTTOOL="certtool"
fi
+ CERTTOOL="certtool"
else
CERTTOOL="gnutls-certtool"
fi
@@ -127,8 +133,8 @@ generate_cert_key()
if test 1 -eq $OPENSSL
then
- $CERTTOOL genrsa -out $KEYFILE 1024
- $CERTTOOL req -batch -days 365 -out $CERTFILE -new -x509 -key $KEYFILE
+ openssl genrsa -out $KEYFILE 1024
+ openssl req -batch -days 365 -out $CERTFILE -new -x509 -key $KEYFILE
else
$CERTTOOL --generate-privkey --outfile $KEYFILE 2>/dev/null
$CERTTOOL --template $GNUTLS_CA_TEMPLATE --generate-self-signed --load-privkey $KEYFILE --outfile $CERTFILE 2>/dev/null