]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Show a better warning when certtool/openssl are missing.
authorPeter Powell <petpow@saberuk.com>
Fri, 22 May 2015 03:22:52 +0000 (04:22 +0100)
committerPeter Powell <petpow@saberuk.com>
Mon, 15 Jun 2015 20:30:27 +0000 (21:30 +0100)
make/gnutlscert.pm
make/opensslcert.pm

index 1204369a942a4855b2aa861b0d71a2d101085987..2c46e0e63e82b6eacb1e3beb1edc180ba38363b5 100644 (file)
@@ -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");
index b8c9d164fbaff2ebfd99a146b916327878f7a7a8..1bf27df159f7f50993e3bb0c0ead13a5bb7a7bfd 100644 (file)
@@ -32,6 +32,11 @@ our @EXPORT = qw(make_openssl_cert);
 
 sub make_openssl_cert()
 {
+       if (system 'openssl version >/dev/null 2>&1')
+       {
+               print "\e[1;31mCertificate generation failed:\e[0m unable to find 'openssl' in the PATH!\n";
+               return;
+       }
        open (FH, ">openssl.template");
        my $commonname = promptstring_s('What is the hostname of your server?', 'irc.example.com');
        my $email = promptstring_s('What email address can you be contacted at?', 'example@example.com');