2016-01-22 19:06:27 -05:00
|
|
|
#-*- mode: sh; -*-
|
2016-02-02 20:09:16 -05:00
|
|
|
|
2017-09-05 11:28:15 -04:00
|
|
|
source $HOME/.zshenv
|
2016-02-02 20:09:16 -05:00
|
|
|
|
|
|
|
# Gnupg setup
|
2019-12-25 21:27:17 -05:00
|
|
|
if hash gpg-agent 2>/dev/null
|
|
|
|
then
|
|
|
|
# Start the gpg-agent if not already running
|
|
|
|
if ! pgrep -x -u "${USER}" gpg-agent >/dev/null 2>&1; then
|
|
|
|
gpg-connect-agent /bye >/dev/null 2>&1
|
|
|
|
fi
|
2016-02-02 20:09:16 -05:00
|
|
|
|
2019-12-25 21:27:17 -05:00
|
|
|
# Set SSH to use gpg-agent
|
|
|
|
unset SSH_AGENT_PID
|
|
|
|
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
|
|
|
|
export SSH_AUTH_SOCK="/run/user/$UID/gnupg/S.gpg-agent.ssh"
|
|
|
|
fi
|
2016-02-02 20:09:16 -05:00
|
|
|
|
2019-12-25 21:27:17 -05:00
|
|
|
# Set GPG TTY
|
|
|
|
GPG_TTY=$(tty)
|
|
|
|
export GPG_TTY
|
2016-02-02 20:09:16 -05:00
|
|
|
|
2019-12-25 21:27:17 -05:00
|
|
|
# Refresh gpg-agent tty in case user switches into an X session
|
|
|
|
gpg-connect-agent updatestartuptty /bye >/dev/null
|
|
|
|
fi
|