1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
#!/usr/bin/perl
##- the Free Software Foundation; either version 2, or (at your option)
##- any later version.
##-
##- This program is distributed in the hope that it will be useful,
##- but WITHOUT ANY WARRANTY; without even the implied warranty of
##- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
##- GNU General Public License for more details.
##-
##- You should have received a copy of the GNU General Public License
##- along with this program; if not, write to the Free Software
##- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# $Id$
use strict;
use warnings;
use Getopt::Long;
use RPM4::Sign;
use Pod::Usage;
my ($batch, $sigtype, $passfile, $macrofile, $fastmode, $path, $name, $keyid, $pass);
my @defines;
=head1 NAME
rpmresign
=head1 DESCRIPTION
Resign massively rpm file
=head1 SYNOPSIS
rpmresign [--passwordfile file] rpmfile or directory
=cut
GetOptions(
'p|path=s' => \$path,
'n|name=s' => \$name,
'b|batch' => \$batch,
'd|define=s' => \@defines,
'f|fastmode' => \$fastmode,
'passwordfile|sig-pass-file=s' => \$passfile,
'm|macros=s' => \$macrofile,
'help|h' => sub { pod2usage(0) },
) or pod2usage(1);
=head1 OPTIONS
=over 8
=item B<--help>
Print help
=item B<--passwordfile>
Read passphrase from this file
=item B<--name>
Use this name as gpg identity
=item B<--macros>
Load this macros file before processing
=item B<--define>
Define a rpm macro. This option is similar to --define of rpm.
=item B<--path>
Set gpghome to this directory
=item B<-f>
Fastmode: don't check rpm md5sum signatures before processing
=back
=cut
foreach (@defines) {
RPM4::add_macro($_);
}
my $sign = RPM4::Sign->new(
passphrase => $ENV{RPMRESIGN_PASSPHRASE},
_signature => $sigtype,
path => $path,
name => $name,
checkrpms => $fastmode ? 0 : 1,
password_file => $passfile,
);
my @files;
while (my $f = shift(@ARGV)) {
-d $f and do {
push(@files, glob("$f/*.rpm"));
next;
};
push(@files, $f);
}
$sign->rpmssign(@files);
__END__
=head1 DESCRIPTION
rpmresign is a perl script to massivelly resign rpms. Only rpm which does
not have the proper signature are resigned.
The script will resign all rpms given on the command line or all rpms inside
directories (rpms are find with a glob on *.rpm).
The passphrase can be passed from a file B<--passwordfile> or by setting the
envirronement variable B<RPMRESIGN_PASSPHRASE>
=head1 AUTHOR
Olivier Thauvin <nanardon@zarb.org>
=head1 SEE ALSO
B<RPM4> perl module
http://rpm4.zarb.org/
=head1 LICENSE
Gnu Public License version 2 or later.
=cut
|