diff options
author | Roman Kamyk <roman.kamyk@gmail.com> | 2011-09-15 12:56:40 +0200 |
---|---|---|
committer | Roman Kamyk <roman.kamyk@gmail.com> | 2011-09-15 12:56:40 +0200 |
commit | 2b55ee07534ec34a699805dc35ca83ad8e22fc7a (patch) | |
tree | 97f464ca865626aea1aa135e7eb9f629f4017171 /plugins/gpg-agent/gpg-agent.plugin.zsh | |
parent | f71647fa85267d558d0d69034902f53aeeed67ad (diff) | |
parent | 762b55bb2bc0452ce3f5f2f21bc22b61936ef704 (diff) | |
download | zsh-2b55ee07534ec34a699805dc35ca83ad8e22fc7a.tar.gz zsh-2b55ee07534ec34a699805dc35ca83ad8e22fc7a.tar.bz2 zsh-2b55ee07534ec34a699805dc35ca83ad8e22fc7a.zip |
Merge branch 'master' of http://github.com/robbyrussell/oh-my-zsh
Diffstat (limited to 'plugins/gpg-agent/gpg-agent.plugin.zsh')
-rw-r--r-- | plugins/gpg-agent/gpg-agent.plugin.zsh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/plugins/gpg-agent/gpg-agent.plugin.zsh b/plugins/gpg-agent/gpg-agent.plugin.zsh new file mode 100644 index 000000000..8cc71fd57 --- /dev/null +++ b/plugins/gpg-agent/gpg-agent.plugin.zsh @@ -0,0 +1,26 @@ +# Based on ssh-agent code + +local GPG_ENV=$HOME/.gnupg/gpg-agent.env + +function start_agent { + /usr/bin/env gpg-agent --daemon --enable-ssh-support --write-env-file ${GPG_ENV} > /dev/null + chmod 600 ${GPG_ENV} + . ${GPG_ENV} > /dev/null +} + +# Source GPG agent settings, if applicable +if [ -f "${GPG_ENV}" ]; then + . ${GPG_ENV} > /dev/null + ps -ef | grep ${SSH_AGENT_PID} | grep gpg-agent > /dev/null || { + start_agent; + } +else + start_agent; +fi + +export GPG_AGENT_INFO +export SSH_AUTH_SOCK +export SSH_AGENT_PID + +GPG_TTY=$(tty) +export GPG_TTY |