From 28c2c5b07d965e84ff3591a0d88be082227a414d Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Thu, 11 Jun 2020 12:07:04 +0200 Subject: [PATCH] local/bin/homeinit: Add compatibility for non-Emacs terminals. --- .local/bin/homeinit | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.local/bin/homeinit b/.local/bin/homeinit index ef506805..69e64169 100755 --- a/.local/bin/homeinit +++ b/.local/bin/homeinit @@ -146,9 +146,10 @@ if has_gpg_keys; then ## Set up gpg-agent to authenticate to SSH_ROOT. chmod -R go-rwx ~/.gnupg export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) - if [ "$GPG_TTY" != "not a tty" ]; then - ## If a TTY, since our ~/.gnupg/gpg-agent.conf exists and specifies a - ## pinentry, we must force the TTY version or else it won't work from a TTY. + if [ "$GPG_TTY" != "not a tty" ] || [ -z "$INSIDE_EMACS" ]; then + ## If a TTY, since our ~/.gnupg/gpg-agent.conf exists and specifies the Emacs + ## pinentry, we must force the TTY version or else it won't work from a TTY. + ## Same if not in Emacs (e.g. Xterm). gpgconf --kill gpg-agent cat<"$(dirname "$PROFILE")/gpg-agent.conf" ## 1-day timeout