summaryrefslogtreecommitdiff
path: root/make/gnutlscert.pm
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2015-06-26 00:00:25 +0200
committerAttila Molnar <attilamolnar@hush.com>2015-06-26 00:00:25 +0200
commit539abb9e93e9657c136759116379f7182c78ea8c (patch)
treef78ce03a6225ad49c4e11cf9d2fc156c08d631e1 /make/gnutlscert.pm
parenteb084fc8b2d3938c42fb39890482f6ac60915507 (diff)
parent4e3d7a6e30eadf714483994681b8b2534229f4a8 (diff)
Merge pull request #1063 from SaberUK/insp20+cert-warning
[2.0] Show a better warning when certtool/openssl are missing.
Diffstat (limited to 'make/gnutlscert.pm')
-rw-r--r--make/gnutlscert.pm13
1 files changed, 7 insertions, 6 deletions
diff --git a/make/gnutlscert.pm b/make/gnutlscert.pm
index 1204369a9..2c46e0e63 100644
--- a/make/gnutlscert.pm
+++ b/make/gnutlscert.pm
@@ -29,9 +29,16 @@ use Exporter 'import';
use make::configure;
our @EXPORT = qw(make_gnutls_cert);
+# On OS X the GnuTLS certtool is prefixed to avoid collision with the system certtool.
+my $certtool = $^O eq 'darwin' ? 'gnutls-certtool' : 'certtool';
sub make_gnutls_cert()
{
+ if (system "$certtool --version >/dev/null 2>&1")
+ {
+ print "\e[1;31mError:\e[0m unable to find '$certtool' in the PATH!\n";
+ return 1;
+ }
open (FH, ">certtool.template");
my $timestr = time();
my $commonname = promptstring_s('What is the hostname of your server?', 'irc.example.com');
@@ -133,12 +140,6 @@ ocsp_signing_key
time_stamping_key
__END__
close(FH);
-my $certtool = "certtool";
-if (`uname -s` eq "Darwin\n") {
- # On OS X the certtool binary name is different to prevent
- # collisions with the system certtool from NSS.
- $certtool = "gnutls-certtool";
-}
if ( (my $status = system("$certtool --generate-privkey --outfile key.pem")) ne 0) { return 1; }
if ( (my $status = system("$certtool --generate-self-signed --load-privkey key.pem --outfile cert.pem --template certtool.template")) ne 0) { return 1; }
unlink("certtool.template");