about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-11-11 15:32:47 +0530
committerAndinus <andinus@nand.sh>2020-11-11 15:32:47 +0530
commit4113886bf2e30bf80333d28011f5f2a53ba6ac22 (patch)
treec6c547b5d150ce5d518775dbd1d7aa79a5546b5c
parent546488b794abbc187fd070ccf54dd11842dec071 (diff)
downloadleo-4113886bf2e30bf80333d28011f5f2a53ba6ac22.tar.gz
Sign the encrypted file with signify
Earlier signify would sign the tar file, now it'll sign the encrypted
file if it was encrypted.
-rwxr-xr-xleo.pl18
1 files changed, 6 insertions, 12 deletions
diff --git a/leo.pl b/leo.pl
index 1a12070..6730950 100755
--- a/leo.pl
+++ b/leo.pl
@@ -97,19 +97,13 @@ foreach my $prof ( @ARGV ) {
         path("$backup_dir/${prof}")->mkpath; # Create backup directory.
         backup($prof, $file);
 
-        unless ($options{signify_and_gnupg_warning_disable}) {
-            warn "
-[WARN] signify will sign `.tar' & gnupg will delete it to create `.tar.gpg'.
-The signature should be valid after decrypting the `.tar' archive.
-Add `signify_and_gnupg_warning_disable = 1` in your config file to disable this
-warning.
-\n"
-                if ($profile{$prof}{signify}
-                    and ($profile{$prof}{encrypt} or $profile{$prof}{sign}));
-    }
+        encrypt_sign($prof, $file) if $profile{$prof}{sign} or $profile{$prof}{encrypt};
 
+        # gpg would've removed the `.tar' file so we sign the
+        # encrypted file instead.
+        my $encrypted_file = "${file}.gpg";
+        $file = $encrypted_file if $profile{$prof}{sign} or $profile{$prof}{encrypt};
         signify($prof, $file) if $profile{$prof}{signify};
-        encrypt_sign($prof, $file) if $profile{$prof}{sign} or $profile{$prof}{encrypt};
     } else {
         warn "[WARN] leo: no such profile :: `$prof' \n";
     }
@@ -157,7 +151,7 @@ sub backup {
         # Print absolute paths for all backup files/directories.
         : say path($_)->absolute('/'), " backed up." foreach @backup_paths;
 
-    print "File was compress with gzip(1)\n" if $profile{$prof}{gzip};
+    print "File was compressed with gzip(1)\n" if $profile{$prof}{gzip};
 
     print "\n" and tar_list($tar_file) if $options{verbose};
 }