about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-11-22 00:04:31 +0530
committerAndinus <andinus@nand.sh>2020-11-22 00:04:31 +0530
commitaa6b728bd818e682b71a04163c8ef216f91774c3 (patch)
tree4e787154ce6c4264f981dacf5d0254a2f5ea3c36
parent74a7bb3c5f5ff529a308542e1470125ef199892f (diff)
downloadleo-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.
-rwxr-xr-xleo.pl18
-rw-r--r--share/leo.conf8
2 files changed, 19 insertions, 7 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 {
diff --git a/share/leo.conf b/share/leo.conf
index 4fe8903..34c422c 100644
--- a/share/leo.conf
+++ b/share/leo.conf
@@ -8,7 +8,6 @@ signify_seckey = /home/andinus/redacted.sec
 # Profile names in [].
 [emacs]
 L_GnuPG = 1
-
 # Paths to backup. '=' after path is important.
 /home/andinus/.emacs.d =
 # Exclude directories with `exclude' value.
@@ -17,3 +16,10 @@ L_GnuPG = 1
 [emacs/elpa]
 L_GnuPG = 1
 /home/andinus/.emacs.d/elpa =
+
+[irclogs]
+L_GnuPG = 1
+# Don't sign this.
+L_GnuPG_no_sign = 1
+
+/home/andinus/irc-logs =