From 87dc698f31f6165ef0bcf06c454283813313bb79 Mon Sep 17 00:00:00 2001 From: David Tomaschik Date: Fri, 12 Feb 2016 21:08:23 -0800 Subject: [PATCH] Rearrange GPG startup. --- dotfiles/profile | 24 +++++++++++------------- dotfiles/zshrc | 12 +++++++----- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/dotfiles/profile b/dotfiles/profile index 218c72a..f76d4d3 100644 --- a/dotfiles/profile +++ b/dotfiles/profile @@ -1,17 +1,15 @@ # Setup GPG Agent -GPG_AGENT_INFO_PATH=$HOME/.gnupg/gpg-agent-info-`hostname` -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 +if ! gpg-connect-agent --quiet /bye > /dev/null 2> /dev/null; then + GPG_AGENT_INFO_PATH=$HOME/.gnupg/gpg-agent-info-`hostname` + 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 -unset GPG_AGENT_INFO_PATH -export GPG_TTY=`tty` # End GPG - -export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting - -[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* diff --git a/dotfiles/zshrc b/dotfiles/zshrc index 63b71d4..ae160f9 100644 --- a/dotfiles/zshrc +++ b/dotfiles/zshrc @@ -20,11 +20,6 @@ esac autoload -U colors && colors PS1="%{%(!.$fg[red].$fg[green])%}%n%{$fg[white]%}@%{$fg[cyan]%}%m%{$fg[white]%}:%{$fg[green]%}%32<...<%~%<<%{$fg[white]%}%#%{$reset_color%} " -# .profile is universal -. ~/.profile -# Deduplicate the path -typeset -U path - # LS Colors alias ls='ls --color' zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} @@ -40,6 +35,13 @@ if [ -d $HOME/.oh-my-zsh ] ; then unset ZSH_CUSTOM fi +# .profile is universal +# but after oh-my-zsh to use anything setup there +. ~/.profile +# Deduplicate the path +typeset -U path + + # Keybindings bindkey '^[[A' history-search-backward bindkey '^[[B' history-search-forward