aboutsummaryrefslogtreecommitdiff
path: root/scripts/make-hashes.pl
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2006-08-22 22:29:46 +0000
committerRob Austein <sra@hactrn.net>2006-08-22 22:29:46 +0000
commit5c2abdff73caa721d4d73689614a583778164b87 (patch)
treee280a7ec4d7ad41610b673cea7314f55c5fd980f /scripts/make-hashes.pl
parent07a34d268251758d0b2ea3ac7a61354182a7f26e (diff)
# on 2006/08/12 05:43:09, sra did:
hack for multiple directories svn path=/scripts/make-hashes.pl; revision=207
Diffstat (limited to 'scripts/make-hashes.pl')
-rw-r--r--scripts/make-hashes.pl33
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);