From aa6b728bd818e682b71a04163c8ef216f91774c3 Mon Sep 17 00:00:00 2001 From: Andinus Date: Sun, 22 Nov 2020 00:04:31 +0530 Subject: Make signing optional Users might not want to store the private key on remote servers. But they should be able to encrypt it so we make it optional. --- leo.pl | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'leo.pl') diff --git a/leo.pl b/leo.pl index 135b3d7..3836bbe 100755 --- a/leo.pl +++ b/leo.pl @@ -10,8 +10,8 @@ use POSIX qw(strftime); die "usage: leo [-hpvV] \n" unless scalar @ARGV; -my ($VERBOSE, $PRINT_PROFILES); -my $VERSION = "v0.5.0"; +my ($VERBOSE, $PRINT_PROFILES, $PRINT_PROFILES_VERBOSE); +my $VERSION = "v0.5.1"; # Dispatch table to be parsed before url. my %dispatch = ( @@ -19,6 +19,7 @@ my %dispatch = ( '-v' => sub { $VERBOSE = 1; }, '-h' => \&HelpMessage, '-p' => sub { $PRINT_PROFILES = 1; }, + '-P' => sub { $PRINT_PROFILES = 1; $PRINT_PROFILES_VERBOSE = 1; }, ); if (exists $dispatch{$ARGV[0]}) { # shift @ARGV to get profile in next shift. @@ -132,7 +133,7 @@ sub run_gnupg { my $prof = shift @_; my $file = shift @_; - my @options = ( "--sign", "--encrypt", + my @options = ( "--encrypt", "--yes", "-o", "${file}.gpg" ); @@ -142,6 +143,8 @@ sub run_gnupg { "--recipient", $options{gpg_fingerprint} if $options{gpg_fingerprint}; + push @options, "--sign" unless $profile{$prof}{L_GnuPG_no_sign}; + # Add recipients. my @gpg_recipients; @gpg_recipients = split / /, $options{gpg_recipients} @@ -180,12 +183,15 @@ sub PrintProfiles { foreach my $prof (sort keys %profile) { print " $prof"; print " [GnuPG]" if $profile{$prof}{L_GnuPG}; + print " [No Sign]" if $profile{$prof}{L_GnuPG_no_sign}; print " [Signify]" if $profile{$prof}{L_signify}; print "\n"; - print " + $_\n" foreach $profile{$prof}{backup}->@*; - print " - $_\n" foreach $profile{$prof}{exclude}->@*; - print "\n"; + if ($PRINT_PROFILES_VERBOSE) { + print " + $_\n" foreach $profile{$prof}{backup}->@*; + print " - $_\n" foreach $profile{$prof}{exclude}->@*; + print "\n"; + } } } sub HelpMessage { -- cgit 1.4.1-2-gfad0