diff options
Diffstat (limited to 'scripts/make-hashes.pl')
-rw-r--r-- | scripts/make-hashes.pl | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/scripts/make-hashes.pl b/scripts/make-hashes.pl index c5fb44fa..7b269b71 100644 --- a/scripts/make-hashes.pl +++ b/scripts/make-hashes.pl @@ -1,26 +1,41 @@ # -*- Perl -*- # $Id$ +use strict; + my $openssl = "/u/sra/isc/route-pki/subvert-rpki.hactrn.net/openssl/trunk/apps/openssl"; my $dir = "hashed"; - +my %dirs = ($dir => 1); +my @cmds; my %count; -open(F, "-|", qw{find repository.apnic.net/APNIC -type f ( -name *.cer -o -name *.crl )}) +exit unless (@ARGV); + +open(F, "-|", "find", @ARGV, qw{-type f ( -name *.cer -o -name *.crl )}) or die("Couldn't run find: $!\n"); -my @files = <F>; -close(F); -chomp(@files); -print("test -d $dir || mkdir $dir\n"); +@ARGV = (); -for my $f (@files) { - my $type = ($f =~ /\.cer$/) ? "x509" : "crl"; +while (<F>) { + chomp; + my $f = $_; + my $type = /\.cer$/ ? "x509" : "crl"; my $h = `$openssl $type -inform DER -in $f -noout -hash`; chomp($h); $h .= "."; $h .= "r" if ($type eq "crl"); my $n = 0 + $count{$h}++; - print("$openssl $type -inform DER -outform PEM -out $dir/$h$n -in $f\n"); + $_ = "$dir/$f"; + s=/[^/]+$==; + $dirs{$_} = 1; + push(@cmds, "$openssl $type -inform DER -outform PEM -out $_/$h$n -in $f\n"); } + +close(F); + +print("test -d $_ || mkdir $_\n") + foreach (sort(keys(%dirs))); + +print($_) + foreach (@cmds); |