From 7cf91eeda6bf80b952eee9df4dfce8cba0577a0e Mon Sep 17 00:00:00 2001 From: Konstantin Demin Date: Sun, 9 May 2021 23:31:05 +0300 Subject: [PATCH] gpg: adjust command line --- mmdebstrap | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/mmdebstrap b/mmdebstrap index 672d5df..d13b6cc 100755 --- a/mmdebstrap +++ b/mmdebstrap @@ -4950,12 +4950,14 @@ sub main() { TMPDIR => 1, CLEANUP => 1 ); - my @gpgcmd = ( - 'gpg', '--quiet', - '--ignore-time-conflict', '--no-options', - '--no-default-keyring', '--homedir', - $gpghome, '--no-auto-check-trustdb', - '--trust-model', 'always' + my @gpgcmd_base = ( + 'gpg', '--quiet', '--ignore-time-conflict', '--no-options', + '--no-default-keyring', '--homedir', $gpghome + ); + my @gpgcmd_enum = ( + '--no-auto-check-trustdb', '--trust-model', + 'always', '--with-colons', + '--show-keys' ); my ($ret, $message); { @@ -4964,7 +4966,7 @@ sub main() { # change warning handler to prevent message # Can't exec "gpg": No such file or directory 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 close $fh; @@ -4976,7 +4978,7 @@ sub main() { } # 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: $?"; } # find all the fingerprints of the keys apt currently @@ -5003,8 +5005,8 @@ sub main() { last; } { - open(my $fh, '-|', @gpgcmd, '--with-colons', '--show-keys', - @keyrings) // error "failed to fork(): $!"; + open(my $fh, '-|', @gpgcmd_base, @gpgcmd_enum, @keyrings) + // error "failed to fork(): $!"; while (my $line = <$fh>) { if ($line !~ /^fpr:::::::::([^:]+):/) { next; @@ -5025,8 +5027,8 @@ sub main() { # the case my @suitefingerprints = (); { - open(my $fh, '-|', @gpgcmd, '--with-colons', '--show-keys', - $keyring) // error "failed to fork(): $!"; + open(my $fh, '-|', @gpgcmd_base, @gpgcmd_enum, $keyring) + // error "failed to fork(): $!"; while (my $line = <$fh>) { if ($line !~ /^fpr:::::::::([^:]+):/) { next;