Last change
on this file since 1 was
1,
checked in by fasma, 12 years ago
|
Initial Import from Mandriva's soft revision 224062 and package revision 45733
|
File size:
1.0 KB
|
Line | |
---|
1 | #!/usr/bin/perl |
---|
2 | # Chmouel Boudjnah <chmouel@mandrakesoft.com> |
---|
3 | # $rcs = ' $Id: resign 871 2004-07-21 08:35:14Z mandrake $ ' ; |
---|
4 | |
---|
5 | use Expect; |
---|
6 | |
---|
7 | my @corrupted; |
---|
8 | my $verbose; |
---|
9 | if ($ARGV[0] =~ /^-v$/) { |
---|
10 | $verbose = 1; |
---|
11 | shift; |
---|
12 | } |
---|
13 | |
---|
14 | my ($class) = $0 =~ /resign_(.*)/; |
---|
15 | my $file = "/root/." . ( $class ? $class : 'signature') . ".gpg"; |
---|
16 | my $rpmrc = "/root/etc/rpmrc" . ($class ? "_$class" : ''); |
---|
17 | |
---|
18 | foreach $rpm_files (@ARGV) { |
---|
19 | |
---|
20 | #system("rpm -K $rpm_files &> /dev/null"); |
---|
21 | # if the package is already signed the -K fails, but the package should be resigned. |
---|
22 | # if ("$?" != 0) { |
---|
23 | # push @corrupted, $rpm_files; |
---|
24 | # print "Corrupted: $rpm_files\n"; |
---|
25 | # next; |
---|
26 | #} |
---|
27 | |
---|
28 | $password = `cat $file`; |
---|
29 | $command = Expect->spawn("rpm --rcfile=$rpmrc --resign $rpm_files") or die "Couldn't start rpm: $!\n"; |
---|
30 | |
---|
31 | $command->log_stdout($verbose); |
---|
32 | |
---|
33 | print "Resigning: $rpm_files\n" if $verbose; |
---|
34 | unless (($command->expect(20, -re => 'Enter pass phrase:'))) {}; |
---|
35 | |
---|
36 | print $command $password; |
---|
37 | $command->soft_close(); |
---|
38 | system("chown mandrake.rpm $rpm_files"); |
---|
39 | exit 0; |
---|
40 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.