local/bin/homeinit: Add compatibility for non-Emacs terminals.

master
Pierre Neidhardt 2020-06-11 12:07:04 +02:00
parent 83b71b2034
commit 28c2c5b07d
1 changed files with 4 additions and 3 deletions

View File

@ -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<<EOF>"$(dirname "$PROFILE")/gpg-agent.conf"
## 1-day timeout