From aee7cacaf400d16805b89a507db67b4fcc9ae0ae Mon Sep 17 00:00:00 2001 From: David Tomaschik Date: Thu, 9 Feb 2017 19:49:56 -0800 Subject: [PATCH 1/2] Remove unused git aliases. --- dotfiles/zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotfiles/zshrc b/dotfiles/zshrc index b1f4c9d..5df662e 100644 --- a/dotfiles/zshrc +++ b/dotfiles/zshrc @@ -29,7 +29,7 @@ if [ -d $HOME/.oh-my-zsh ] ; then ZSH=$HOME/.oh-my-zsh ZSH_THEME="matir" ZSH_CUSTOM="$HOME/.zsh_custom" - plugins=(git encode64 gpg-agent pep8 pip python tmux urltools extract sudo virsh virtualenv jekyll) + plugins=(encode64 gpg-agent pep8 pip python tmux urltools extract sudo virsh virtualenv jekyll) test -f /usr/share/virtualenvwrapper/virtualenvwrapper.sh && plugins+=(virtualenvwrapper) source $ZSH/oh-my-zsh.sh unset ZSH_THEME From cabdaac7a68b728aa468ce2ba1b0728f3d4b19a3 Mon Sep 17 00:00:00 2001 From: David Tomaschik Date: Thu, 23 Feb 2017 12:32:52 -0800 Subject: [PATCH 2/2] Rely entirely on oh-my-zsh to start gpg-agent. --- dotfiles/gnupg/gpg-agent.conf | 1 - dotfiles/profile | 16 ---------------- .../plugins/gpg-agent/gpg-agent.plugin.zsh | 5 +++++ 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/dotfiles/gnupg/gpg-agent.conf b/dotfiles/gnupg/gpg-agent.conf index 2456c52..ab47375 100644 --- a/dotfiles/gnupg/gpg-agent.conf +++ b/dotfiles/gnupg/gpg-agent.conf @@ -1,4 +1,3 @@ -enable-ssh-support use-standard-socket default-cache-ttl 7200 default-cache-ttl-ssh 7200 diff --git a/dotfiles/profile b/dotfiles/profile index d1f8b4d..e492c29 100644 --- a/dotfiles/profile +++ b/dotfiles/profile @@ -1,20 +1,4 @@ # Always load ENV test -f "$HOME/.env" && . "$HOME/.env" -# Setup GPG Agent -if ! gpg-connect-agent --quiet /bye > /dev/null 2> /dev/null; then - GPG_AGENT_INFO_PATH=$HOME/.gnupg/gpg-agent.env - if test -f $GPG_AGENT_INFO_PATH && kill -0 `cut -d: -f 2 $GPG_AGENT_INFO_PATH` 2>/dev/null ; then - . $GPG_AGENT_INFO_PATH - export GPG_AGENT_INFO SSH_AUTH_SOCK SSH_AGENT_PID - else - if which gpg-agent >/dev/null 2>&1 ; then - gpg-agent -q 2>/dev/null || eval `gpg-agent --daemon --enable-ssh-support --write-env-file $GPG_AGENT_INFO_PATH` 2>/dev/null - fi - fi - unset GPG_AGENT_INFO_PATH - export GPG_TTY=`tty` -fi -# End GPG - test -f "${HOME}/.profile.local" && . "${HOME}/.profile.local" diff --git a/dotfiles/zsh_custom/plugins/gpg-agent/gpg-agent.plugin.zsh b/dotfiles/zsh_custom/plugins/gpg-agent/gpg-agent.plugin.zsh index 54f16e5..6e467e8 100644 --- a/dotfiles/zsh_custom/plugins/gpg-agent/gpg-agent.plugin.zsh +++ b/dotfiles/zsh_custom/plugins/gpg-agent/gpg-agent.plugin.zsh @@ -20,6 +20,8 @@ function start_agent_withssh { if ! gpg-connect-agent --agent-program /dev/null --quiet /bye > /dev/null 2> /dev/null; then # source settings of old agent, if applicable if [ -f "${GPG_ENV}" ]; then + # This can be clobbered by the file + local OLD_SSH_AUTH_SOCK=${SSH_AUTH_SOCK} . ${GPG_ENV} > /dev/null export GPG_AGENT_INFO export SSH_AUTH_SOCK @@ -29,6 +31,9 @@ if ! gpg-connect-agent --agent-program /dev/null --quiet /bye > /dev/null 2> /de # check again if another agent is running using the newly sourced settings if ! gpg-connect-agent --agent-program /dev/null --quiet /bye > /dev/null 2> /dev/null; then # check for existing ssh-agent + if [ -n "${OLD_SSH_AUTH_SOCK}" ] ; then + SSH_AUTH_SOCK=${OLD_SSH_AUTH_SOCK};export SSH_AUTH_SOCK + fi if ssh-add -l > /dev/null 2> /dev/null; then # ssh-agent running, start gpg-agent without ssh support start_agent_nossh;