1
0
Stephan Kulow 4ee730db27 Accepting request 231426 from home:michal-m:branches:Base:System
- Fix matching /boot and /lib/firmware in pesign-repackage.spec

- Do not store the buildroot in the .*.hmac file.

- Regenerate the HMAC checksum when signing and EFI binary with
  a checksum (fate#316930, bnc#856310).

- Update README.

- Add /usr/lib/rpm/pesign/gen-hmac tool to generate a hmac checksum
  for a given file (fate#316930, bnc#856310).

OBS-URL: https://build.opensuse.org/request/show/231426
OBS-URL: https://build.opensuse.org/package/show/Base:System/pesign-obs-integration?expand=0&rev=23
2014-04-27 07:52:13 +00:00

32 lines
568 B
Perl

#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long;
my $USAGE = "Usage: $0 [-r <build root>] <file>\n";
my $buildroot = "";
GetOptions("r|root=s" => \$buildroot) or die $USAGE;
if (scalar(@ARGV) != 1) {
die $USAGE;
}
if ($buildroot) {
$buildroot .= "/";
}
my $fn = shift @ARGV;
my $out = `sha512hmac "$buildroot$fn"`;
if ($?) {
exit 1;
}
my @t = split(" ", $out);
my $hmac = $t[0];
(my $hmacfn = "$buildroot$fn") =~ s|([^/]*)$|.$1.hmac|;
open(my $fd, '>', $hmacfn) or die "$0: Cannot open $hmacfn: $!\n";
print $fd "$hmac $fn\n";
close($fd);
exit 0;