From ecc75be6f37448520546f30bfe516068fa0220db Mon Sep 17 00:00:00 2001 From: Gunter Knauf Date: Fri, 15 Feb 2008 00:26:26 +0000 Subject: [PATCH] moved info block up before help block so that it can also be displayed before help option; trial to add a version number. --- lib/mk-ca-bundle.pl | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/lib/mk-ca-bundle.pl b/lib/mk-ca-bundle.pl index 4a70f715f..a51b2d3cb 100755 --- a/lib/mk-ca-bundle.pl +++ b/lib/mk-ca-bundle.pl @@ -41,11 +41,26 @@ my $url = 'http://lxr.mozilla.org/seamonkey/source/security/nss/lib/ckfw/builtin # If the OpenSSL commandline is not in search path you can configure it here! my $openssl = 'openssl'; +my $version = '$Revision$'; + getopts('bhilnqtuv'); +if ($opt_i) { + print ("=" x 78 . "\n"); + print "Script Version : $version\n"; + print "Perl Version : $]\n"; + print "Operating System Name : $^O\n"; + print "Getopt::Std.pm Version : ${Getopt::Std::VERSION}\n"; + print "MIME::Base64.pm Version : ${MIME::Base64::VERSION}\n"; + print "LWP::UserAgent.pm Version : ${LWP::UserAgent::VERSION}\n"; + print "LWP.pm Version : ${LWP::VERSION}\n"; + print ("=" x 78 . "\n"); +} + +$0 =~ s/\\/\//g; +$0 = substr($0, rindex($0, '/') + 1); if ($opt_h) { - $0 =~ s/\\/\//g; - printf("Usage:\t%s [-b] [-i] [-l] [-n] [-q] [-t] [-u] [-v] []\n", substr($0, rindex($0, '/') + 1)); + printf("Usage:\t%s [-b] [-i] [-l] [-n] [-q] [-t] [-u] [-v] []\n", $0); print "\t-b\tbackup an existing version of ca-bundle.crt\n"; print "\t-i\tprint version info about used modules\n"; print "\t-l\tprint license info about certdata.txt\n"; @@ -57,21 +72,13 @@ if ($opt_h) { exit; } -if ($opt_i) { - print "Perl Version : $]\n"; - print "Operating System Name : $^O\n"; - printf("MIME::Base64.pm Version : %s\n", $MIME::Base64::VERSION); - printf("LWP::UserAgent.pm Version : %s\n", $LWP::UserAgent::VERSION); - print ("=" x 78 . "\n"); -} - my $crt = $ARGV[0] || 'ca-bundle.crt'; my $txt = substr($url, rindex($url, '/') + 1); $txt =~ s/\?.*//; if (!$opt_n || !-e $txt) { print "Downloading '$txt' ...\n" if (!$opt_q); - my $ua = new LWP::UserAgent; + my $ua = new LWP::UserAgent(agent => "$0/$version"); my $req = new HTTP::Request('GET', $url); my $res = $ua->request($req); if ($res->is_success) { @@ -106,8 +113,8 @@ print CRT <