about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-10-15 18:23:26 +0530
committerAndinus <andinus@nand.sh>2020-10-15 18:23:26 +0530
commit5924071b7c85e90f37b61ddfb755483686de76a1 (patch)
tree3d71e759b89f4464dd184b6998b5f6a0db4d8248
parent561874a1000dfb4ab60fa4e679c50e869896b976 (diff)
downloadleo-5924071b7c85e90f37b61ddfb755483686de76a1.tar.gz
Add option to specify gpg recipients
-rwxr-xr-xleo.pl12
1 files 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};