19 lines
490 B
Bash
19 lines
490 B
Bash
#!/bin/bash
|
|
|
|
if ! which gpg-connect-agent > /dev/null 2>&1; then
|
|
# GPG-agent is not installed on this machine, don't do anything.
|
|
return
|
|
fi
|
|
|
|
mkdir -p ~/.gnupg
|
|
|
|
# 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
|
|
# Set SSH to use gpg-agent
|
|
unset SSH_AGENT_PID
|
|
export SSH_AUTH_SOCK="/run/user/$UID/gnupg/S.gpg-agent.ssh"
|
|
export GPG_TTY=$(tty)
|
|
gpg-connect-agent updatestartuptty /bye >/dev/null
|
|
|