diff options
author | James Smith <james@loopj.com> | 2011-08-01 00:44:51 -0700 |
---|---|---|
committer | James Smith <james@loopj.com> | 2011-08-01 00:44:51 -0700 |
commit | 0ba398f9e1aaf05e72406d5c840f013eebb6b260 (patch) | |
tree | 66a866657780870fcfb338606ec92b29da82eb4c /plugins/gpg-agent | |
parent | a15a8c4a98bc1aff024c3ef44dec48309ff4f90b (diff) | |
parent | a738ca9b645c3cc53bdb01e8676202ceca449ccf (diff) | |
download | zsh-0ba398f9e1aaf05e72406d5c840f013eebb6b260.tar.gz zsh-0ba398f9e1aaf05e72406d5c840f013eebb6b260.tar.bz2 zsh-0ba398f9e1aaf05e72406d5c840f013eebb6b260.zip |
Merge in recent stuff
Diffstat (limited to 'plugins/gpg-agent')
-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 |