m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2014-12-24 11:38:34 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2014-12-24 11:38:34 +0100
commit8b326ddc8db2e1271917ef47470a4b2cead7ceff (patch)
treeea7f97ebc327b016e9c57d49d32ae1ab5da496a0
parent1057be995c9c850a39eb1044a264168be052064e (diff)
Keep track of correct TTY for pinentry at start of script, in case we take over stdin later.
-rwxr-xr-xsrc/password-store.sh1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/password-store.sh b/src/password-store.sh
index d44b005..1bf6306 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -8,6 +8,7 @@ set -o pipefail
GPG_OPTS=( "--quiet" "--yes" "--compress-algo=none" )
GPG="gpg"
+export GPG_TTY="${GPG_TTY:-$(tty 2>/dev/null)}"
which gpg2 &>/dev/null && GPG="gpg2"
[[ -n $GPG_AGENT_INFO || $GPG == "gpg2" ]] && GPG_OPTS+=( "--batch" "--use-agent" )