From 4113886bf2e30bf80333d28011f5f2a53ba6ac22 Mon Sep 17 00:00:00 2001 From: Andinus Date: Wed, 11 Nov 2020 15:32:47 +0530 Subject: Sign the encrypted file with signify Earlier signify would sign the tar file, now it'll sign the encrypted file if it was encrypted. --- leo.pl | 18 ++++++------------ 1 file 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}; } -- cgit 1.4.1-2-gfad0