diff options
author | Andinus <andinus@nand.sh> | 2020-11-22 00:04:31 +0530 |
---|---|---|
committer | Andinus <andinus@nand.sh> | 2020-11-22 00:04:31 +0530 |
commit | aa6b728bd818e682b71a04163c8ef216f91774c3 (patch) | |
tree | 4e787154ce6c4264f981dacf5d0254a2f5ea3c36 /leo.pl | |
parent | 74a7bb3c5f5ff529a308542e1470125ef199892f (diff) | |
download | leo-aa6b728bd818e682b71a04163c8ef216f91774c3.tar.gz |
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.
Diffstat (limited to 'leo.pl')
-rwxr-xr-x | leo.pl | 18 |
1 files changed, 12 insertions, 6 deletions
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] <profile>\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 { |