aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bash/bashrc.d/gnupg.bash12
-rw-r--r--gnupg/gpg.conf4
2 files changed, 14 insertions, 2 deletions
diff --git a/bash/bashrc.d/gnupg.bash b/bash/bashrc.d/gnupg.bash
index 98e3ca27..79e43776 100644
--- a/bash/bashrc.d/gnupg.bash
+++ b/bash/bashrc.d/gnupg.bash
@@ -3,6 +3,18 @@ if ! hash gpg 2>/dev/null; then
return
fi
+# Wrapper around gpg(1) to stop ``--batch'' breaking things
+gpg() {
+ case $* in
+ *--ed*|*--sign-k*)
+ command gpg --no-batch "$@"
+ ;;
+ *)
+ command gpg "$@"
+ ;;
+ esac
+}
+
# Completion for gpg with long options
_gpg() {
local word=${COMP_WORDS[COMP_CWORD]}
diff --git a/gnupg/gpg.conf b/gnupg/gpg.conf
index aa63f256..1ea3b6d1 100644
--- a/gnupg/gpg.conf
+++ b/gnupg/gpg.conf
@@ -1,6 +1,6 @@
# Prevent boilerplate about needing key decryption, which is handled by the
-# agent; occasionally this needs to be overriden with --no-batch. I like my
-# programs to be as quiet as possible unless I specifically ask them otherwise
+# agent; the gpg function in my Bash scripts overrides this for certain
+# commands where it interferes
batch
# Use SHA512 as the hash when making key signatures