12345678910111213141516171819 |
- #### My (demuredemeanor) sub source ssh-agent script
- # Uses tabstop=4; shiftwidth=4 tabs; foldmarker={{{,}}};
- # https://notabug.org/demure/dotfiles/
- # legacy repo http://github.com/demure/dotfiles
- # vim:set syntax=sh:
- ### GPG Agent ### {{{
- function __gpg_agent() {
- envfile="$HOME/.gnupg/gpg-agent.env"
- if [[ -e "$envfile" ]] && kill -0 $(grep GPG_AGENT_INFO "$envfile" | cut -d: -f 2) 2>/dev/null; then
- eval "$(cat "$envfile")"
- else
- eval "$(gpg-agent --daemon --enable-ssh-support --write-env-file "$envfile")"
- fi
- export GPG_AGENT_INFO # the env file does not contain the export statement
- export SSH_AUTH_SOCK # enable gpg-agent for ssh
- }
- ### End GPG Agent ### }}}
|