#!/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 =head1 AUTHOR Olivier Thauvin =head1 SEE ALSO B perl module http://rpm4.zarb.org/ =head1 LICENSE Gnu Public License version 2 or later. =cut