aboutsummaryrefslogtreecommitdiffstats
path: root/check_sign_by_path.pl
diff options
context:
space:
mode:
authorAntoine Ginies <aginies@mandriva.com>2010-10-06 07:58:18 +0000
committerAntoine Ginies <aginies@mandriva.com>2010-10-06 07:58:18 +0000
commitb364785ea90e60806aaaec56d15bcc70a74daf6d (patch)
treeda257e1277bd0218929f12fde2e318657067eb16 /check_sign_by_path.pl
parent46324a3fd9b86040b16dc3070b3a22438f7a616d (diff)
downloadbcd-b364785ea90e60806aaaec56d15bcc70a74daf6d.tar
bcd-b364785ea90e60806aaaec56d15bcc70a74daf6d.tar.gz
bcd-b364785ea90e60806aaaec56d15bcc70a74daf6d.tar.bz2
bcd-b364785ea90e60806aaaec56d15bcc70a74daf6d.tar.xz
bcd-b364785ea90e60806aaaec56d15bcc70a74daf6d.zip
end of the move
Diffstat (limited to 'check_sign_by_path.pl')
-rwxr-xr-xcheck_sign_by_path.pl62
1 files changed, 62 insertions, 0 deletions
diff --git a/check_sign_by_path.pl b/check_sign_by_path.pl
new file mode 100755
index 0000000..ca2c131
--- /dev/null
+++ b/check_sign_by_path.pl
@@ -0,0 +1,62 @@
+#!/usr/bin/perl -w
+
+use strict;
+use Parallel::ForkManager;
+use File::Glob ':glob';
+use File::Basename;
+
+#rpm --checksig -v ~/pieces/2010.1/i586/media/main/release/basesystem-2010.0-2mdv2010.1.i586.rpm
+# Header V3 DSA signature: OK, key ID 26752624
+# Header SHA1 digest: OK (fdeb18c37115229582c4b42dba7d834c7b82bc8c)
+# MD5 digest: OK (74cee8f749ae4443cb6dae3b65cc5a6e)
+# V3 DSA signature: OK, key ID 26752624
+
+#gpg -a pubkey_main
+#pub 1024D/26752624 2003-12-10 MandrakeCooker <cooker@linux-mandrake.com>
+#sub 1024g/E5CC3CAA 2003-12-10
+
+my $NB_FORK=15;
+my $path = $ARGV[0];
+#my $key = $ARGV[1];
+
+$ARGV[0] or die "First arg must be a path to rpm\n";
+#$ARGV[1] or die "Second arg must be a the key (ie: 26752624)\n";
+
+my $B;
+my $convert = $path;
+$convert =~ tr|\/|_|;
+my $log = "log_check_sign_$convert.log";
+system("cp /dev/null -f $log");
+my $pm = new Parallel::ForkManager($NB_FORK);
+my @list_pkg = glob("$path/*.rpm");
+my $count = @list_pkg;
+my $key = `gpg -a $path/media_info/pubkey | grep pub | cut -d "/" -f 2 | cut -d " " -f 1`;
+print "$count transactions to do ... be patient !!!!\n";
+my $status = "0";
+open $B, ">>$log";
+foreach my $pkg (@list_pkg) {
+ $pkg or next;
+ my $basename_pkg = basename($pkg);
+ $status++;
+ my $pid = $pm->start and next;
+ print("$basename_pkg ($status/$count)\n");
+ #my @command = `LC_ALL=C rpm --rcfile=$rpmrc --checksig -v $pkg | grep "key ID"`;
+ my @command = `LC_ALL=C rpm --checksig -v $pkg | grep "key ID"`;
+ foreach (@command) {
+ if ($_ =~ /$key/) {
+ # dont print if it is OK
+ # print "$pkg signature OK\n";
+ last;
+ } else {
+ print "$pkg signature NOK\n";
+ print $B "$pkg NOK\n";
+ last;
+ }
+ next;
+ }
+ $pm->finish;
+}
+#print "Waiting for the end of some check...\n";
+$pm->wait_all_children;
+close $B;
+#print "all check are done...\n";