equal
deleted
inserted
replaced
|
1 #!/usr/bin/perl |
|
2 |
|
3 # Some source packages come unsigned. This wouldnt be a problem if it wouldnt |
|
4 # cause reprepro to spit messages like: 'Data seems not to be signed trying to |
|
5 # use directly...' which may be confusing when you think that it is related to |
|
6 # a changes file |
|
7 use strict; |
|
8 |
|
9 use IO::File; |
|
10 use File::Basename; |
|
11 use Symbol qw(gensym); |
|
12 |
|
13 my $arch = 'i386'; |
|
14 my $incoming = "/home/apt/incoming"; |
|
15 |
|
16 my @unsigned = qw( |
|
17 |
|
18 nagios-client-check_1.4.5-1.dsc |
|
19 freeradius_1.0.0+cvs20040609-0.hs.dsc |
|
20 libnss-ldap_238-1.schlittermann.1.dsc |
|
21 |
|
22 ); |
|
23 |
|
24 my $cv = "/usr/bin/gpg --verify"; |
|
25 my $cc = "/usr/bin/gpg --clearsign"; |
|
26 my $cu = "/usr/bin/changestool"; |
|
27 |
|
28 for (@unsigned) { |
|
29 |
|
30 my $cmd; |
|
31 |
|
32 my $sf = "$incoming/$_"; |
|
33 (my $cf = $sf) =~ s/\.dsc$/_${arch}.changes/; |
|
34 |
|
35 # we assume that the changes have been successfully resigned too when the dsc |
|
36 # files can be verified |
|
37 my $r = qx/$cv $sf 2>&1/; |
|
38 next unless $?; |
|
39 |
|
40 print "Attempting to sign [$sf] .. "; |
|
41 $cmd = "$cc $sf"; |
|
42 system($cmd) == 0 or warn "[system($cmd)] failed: [$?] [$!]\n"; |
|
43 rename("$sf.asc", $sf) or warn "rename([$sf.asc], [$sf]) failed: [$!]\n"; |
|
44 print "finished\n"; |
|
45 |
|
46 print "Attempting to update and sign [$cf] .. "; |
|
47 $cmd = "$cu $cf updatechecksums $sf"; |
|
48 system("$cmd") == 0 or warn "[system($cmd)] failed: [$?] [$!]\n"; |
|
49 $cmd = "$cc $cf"; |
|
50 system($cmd) == 0 or warn "[system($cmd)] failed: [$?] [$!]\n"; |
|
51 rename("$cf.asc", $cf) or warn "rename([$cf.asc], [$cf]) failed: [$!]\n"; |
|
52 print "finished\n"; |
|
53 |
|
54 } |