Sorin Ionescu
12 years ago
6 changed files with 49 additions and 80 deletions
@ -1,25 +0,0 @@
@@ -1,25 +0,0 @@
|
||||
GPG-Agent |
||||
========= |
||||
|
||||
Provides for an easier use of [gpg-agent][1]. |
||||
|
||||
Settings |
||||
-------- |
||||
|
||||
### SSH-Agent Protocol Emulation |
||||
|
||||
To enable SSH-Agent protocol emulation, add the following line to *zpreztorc*: |
||||
|
||||
zstyle ':prezto:module:gpg-agent' ssh-support 'yes' |
||||
|
||||
Authors |
||||
------- |
||||
|
||||
*The authors of this module should be contacted via the [issue tracker][2].* |
||||
|
||||
- [Florian Walch](https://github.com/fwalch) |
||||
- [Sorin Ionescu](https://github.com/sorin-ionescu) |
||||
|
||||
[1]: http://linux.die.net/man/1/gpg-agent |
||||
[2]: https://github.com/sorin-ionescu/prezto/issues |
||||
|
@ -1,46 +0,0 @@
@@ -1,46 +0,0 @@
|
||||
# |
||||
# Provides for an easier use of gpg-agent. |
||||
# |
||||
# Authors: |
||||
# Florian Walch <florian.walch@gmx.at> |
||||
# Sorin Ionescu <sorin.ionescu@gmail.com> |
||||
# neersighted <neersighted@myopera.com> |
||||
# |
||||
|
||||
# Return if requirements are not found. |
||||
if (( ! $+commands[gpg-agent] )); then |
||||
return 1 |
||||
fi |
||||
|
||||
# Make sure to use the $GNUPGHOME first. |
||||
_gpg_env="${GNUPGHOME:-$HOME/.gnupg}/gpg-agent.env" |
||||
|
||||
function _gpg-agent-start { |
||||
local ssh_support |
||||
|
||||
zstyle -b ':prezto:module:gpg-agent' ssh-support 'ssh_support' \ |
||||
|| ssh_support='' |
||||
|
||||
gpg-agent \ |
||||
--daemon \ |
||||
${ssh_support:+'--enable-ssh-support'} \ |
||||
--write-env-file "${_gpg_env}" > /dev/null |
||||
|
||||
chmod 600 "${_gpg_env}" |
||||
source "${_gpg_env}" > /dev/null |
||||
} |
||||
|
||||
# Source GPG agent settings, if applicable. |
||||
if [[ -s "${_gpg_env}" ]]; then |
||||
source "${_gpg_env}" > /dev/null |
||||
ps -ef | grep "${SSH_AGENT_PID}" | grep -q 'gpg-agent' || { |
||||
_gpg-agent-start |
||||
} |
||||
else |
||||
_gpg-agent-start |
||||
fi |
||||
|
||||
export GPG_AGENT_INFO |
||||
export SSH_AUTH_SOCK |
||||
export SSH_AGENT_PID |
||||
export GPG_TTY="$(tty)" |
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
GPG |
||||
=== |
||||
|
||||
Provides for an easier use of [GPG][1] by setting up [gpg-agent][2]. |
||||
|
||||
Authors |
||||
------- |
||||
|
||||
*The authors of this module should be contacted via the [issue tracker][3].* |
||||
|
||||
- [Sorin Ionescu](https://github.com/sorin-ionescu) |
||||
|
||||
[1]: http://www.gnupg.org |
||||
[2]: http://linux.die.net/man/1/gpg-agent |
||||
[3]: https://github.com/sorin-ionescu/prezto/issues |
||||
|
@ -0,0 +1,31 @@
@@ -0,0 +1,31 @@
|
||||
# |
||||
# Provides for an easier use of GPG by setting up gpg-agent. |
||||
# |
||||
# Authors: |
||||
# Sorin Ionescu <sorin.ionescu@gmail.com> |
||||
# |
||||
|
||||
# Return if requirements are not found. |
||||
if (( ! $+commands[gpg-agent] )); then |
||||
return 1 |
||||
fi |
||||
|
||||
# Set the default path to the gpg-agent-info file. |
||||
_gpg_agent_info="$HOME/.gpg-agent-info" |
||||
|
||||
# Start gpg-agent if not started. |
||||
ps -U "$USER" -o ucomm | grep -q gpg-agent \ |
||||
|| gpg-agent --daemon >! "$_gpg_agent_info" |
||||
|
||||
# Export environment variables. |
||||
export GPG_TTY="$(tty)" |
||||
source "$_gpg_agent_info" |
||||
|
||||
# Clean up. |
||||
unset _gpg_agent_info |
||||
|
||||
# Disable GUI prompts inside SSH. |
||||
if [[ -n "$SSH_CONNECTION" ]]; then |
||||
export PINENTRY_USER_DATA='USE_CURSES=1' |
||||
fi |
||||
|
Loading…
Reference in new issue