From 5924071b7c85e90f37b61ddfb755483686de76a1 Mon Sep 17 00:00:00 2001 From: Andinus Date: Thu, 15 Oct 2020 18:23:26 +0530 Subject: Add option to specify gpg recipients --- leo.pl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/leo.pl b/leo.pl index da0af3b..074223a 100755 --- a/leo.pl +++ b/leo.pl @@ -70,6 +70,7 @@ $backup_dir .= "/$ymd"; path($backup_dir)->mkpath; # Create backup directory. my $gpg_fingerprint = $options{gpg_fingerprint} || "`nil'"; +my @gpg_recipients = split / /, $options{gpg_recipient}; my $gpg_bin = $options{gpg_bin} || "gpg"; # Print help. @@ -142,8 +143,15 @@ sub encrypt_sign { my $file = "$backup_dir/${prof}.tar"; my @options = (); - push @options, "--recipient", $gpg_fingerprint, "--encrypt" - if $profile{$prof}{encrypt}; + push @options, "--default-key", $gpg_fingerprint; + + if ( $profile{$prof}{encrypt} ) { + push @options, "--encrypt"; + push @options, "--recipient", $gpg_fingerprint; + push @options, "--recipient", $_ + foreach @gpg_recipients; + } + push @options, "--sign" if $profile{$prof}{sign}; push @options, "--verbose" if $options{verbose}; -- cgit 1.4.1-2-gfad0