mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-25 15:20:08 +00:00
Added gpg-agent plugin
Based on ssh-agent plugin.
This commit is contained in:
parent
dc12853b0c
commit
60b560fc9a
1 changed files with 26 additions and 0 deletions
26
plugins/gpg-agent/gpg-agent.plugin.zsh
Normal file
26
plugins/gpg-agent/gpg-agent.plugin.zsh
Normal file
|
@ -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
|
Loading…
Reference in a new issue