/usr/bin/jetring-gen is in jetring 0.21.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 | #!/usr/bin/perl
# Generate changesets for changes between two keyrings.
use Cwd q{abs_path};
use File::Temp qw(tempdir);
use warnings;
use strict;
if (@ARGV < 2) {
die "Usage: jetring-gen oldring.gpg newring.gpg [comment]\n";
}
# avoid gnupg touching ~/.gnupg
$ENV{GNUPGHOME}=tempdir("jetring.XXXXXXXXXX", TMPDIR => 1, CLEANUP => 1);
my $old=abs_path(shift);
my $new=abs_path(shift);
my $comment=shift || "merging changes";
my $date=`date -R`;
chomp $date;
open(DIFF, "jetring-diff $old $new|") || die "jetring-diff: $!";
while (<DIFF>) {
next unless /^?pub:/;
chomp;
my @fields=split(":", $_);
if (/-pub:/) {
genchangeset("delete-$fields[4]",
"delete-key $fields[4]",
"y");
}
elsif (/\+pub:/) {
genchangeset("add-$fields[4]",
"import",
getkey($fields[4]));
}
elsif (/ pub/) {
genchangeset("modify-$fields[4]",
"import",
getkey($fields[4]));
}
}
close DIFF;
sub genchangeset {
my $fn=shift;
my $action=shift;
my $data=shift;
if ($data=~/\n/) {
$data=~s/^/ /mg;
$data="\n".$data;
}
open(OUT, ">$fn") || die "$fn: $!";
print OUT <<"EOF";
Comment: $comment
Date: $date
Action: $action
Data: $data
EOF
close OUT;
print "$fn\n";
}
sub getkey {
my $id=shift;
my $key=`gpg --no-auto-check-trustdb --options /dev/null --no-default-keyring --keyring "$new" -a --export "$id"`;
return $key;
}
|