btrbk: use no-default-recipient on gpg encrypt

In case the user has set a default recipient in his gpg config file,
ignore it.
pull/485/head
Axel Burri 2022-05-29 16:57:52 +02:00
parent b824d62449
commit a70248376f
1 changed files with 3 additions and 2 deletions

5
btrbk
View File

@ -1750,8 +1750,9 @@ sub btrfs_send_to_file($$$;$$)
my @gpg_options = ( '--batch', '--no-tty', '--no-random-seed-file', '--trust-model', 'always' );
push @gpg_options, ( '--compress-algo', 'none' ) if($compress); # NOTE: if --compress-algo is not set, gpg might still compress according to OpenPGP standard.
push(@gpg_options, ( '--no-default-keyring', '--keyring', { unsafe => $encrypt->{keyring} } )) if($encrypt->{keyring});
foreach(@$encrypt->{recipient} // []) {
push(@gpg_options, ('--recipient', $_));
if($encrypt->{recipient}) {
push(@gpg_options, '--no-default-recipient');
push(@gpg_options, map +( '--recipient', $_ ), @{$encrypt->{recipient}});
}
push @cmd_pipe, {
cmd => [ 'gpg', @gpg_options, '--encrypt' ],