gpg: adjust command line

This commit is contained in:
Konstantin Demin 2021-05-09 23:31:05 +03:00
parent 88a031477a
commit 7cf91eeda6
Signed by: rockdrilla
GPG key ID: 1F33CB0BA4731BC6

View file

@ -4950,12 +4950,14 @@ sub main() {
TMPDIR => 1, TMPDIR => 1,
CLEANUP => 1 CLEANUP => 1
); );
my @gpgcmd = ( my @gpgcmd_base = (
'gpg', '--quiet', 'gpg', '--quiet', '--ignore-time-conflict', '--no-options',
'--ignore-time-conflict', '--no-options', '--no-default-keyring', '--homedir', $gpghome
'--no-default-keyring', '--homedir', );
$gpghome, '--no-auto-check-trustdb', my @gpgcmd_enum = (
'--trust-model', 'always' '--no-auto-check-trustdb', '--trust-model',
'always', '--with-colons',
'--show-keys'
); );
my ($ret, $message); my ($ret, $message);
{ {
@ -4964,7 +4966,7 @@ sub main() {
# change warning handler to prevent message # change warning handler to prevent message
# Can't exec "gpg": No such file or directory # Can't exec "gpg": No such file or directory
local $SIG{__WARN__} = sub { $message = shift; }; local $SIG{__WARN__} = sub { $message = shift; };
$ret = open $fh, '-|', @gpgcmd, '--version'; $ret = open $fh, '-|', @gpgcmd_base, '--version';
} }
# we only want to check if the gpg command exists # we only want to check if the gpg command exists
close $fh; close $fh;
@ -4976,7 +4978,7 @@ sub main() {
} }
# initialize gpg trustdb with empty one # initialize gpg trustdb with empty one
{ {
`@gpgcmd --update-trustdb >/dev/null 2>/dev/null`; `@gpgcmd_base --update-trustdb >/dev/null 2>/dev/null`;
$? == 0 or error "gpg failed to initialize trustdb: $?"; $? == 0 or error "gpg failed to initialize trustdb: $?";
} }
# find all the fingerprints of the keys apt currently # find all the fingerprints of the keys apt currently
@ -5003,8 +5005,8 @@ sub main() {
last; last;
} }
{ {
open(my $fh, '-|', @gpgcmd, '--with-colons', '--show-keys', open(my $fh, '-|', @gpgcmd_base, @gpgcmd_enum, @keyrings)
@keyrings) // error "failed to fork(): $!"; // error "failed to fork(): $!";
while (my $line = <$fh>) { while (my $line = <$fh>) {
if ($line !~ /^fpr:::::::::([^:]+):/) { if ($line !~ /^fpr:::::::::([^:]+):/) {
next; next;
@ -5025,8 +5027,8 @@ sub main() {
# the case # the case
my @suitefingerprints = (); my @suitefingerprints = ();
{ {
open(my $fh, '-|', @gpgcmd, '--with-colons', '--show-keys', open(my $fh, '-|', @gpgcmd_base, @gpgcmd_enum, $keyring)
$keyring) // error "failed to fork(): $!"; // error "failed to fork(): $!";
while (my $line = <$fh>) { while (my $line = <$fh>) {
if ($line !~ /^fpr:::::::::([^:]+):/) { if ($line !~ /^fpr:::::::::([^:]+):/) {
next; next;