aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Löthberg <johannes@kyriasis.com>2014-04-20 15:47:46 +0000
committerJohannes Löthberg <johannes@kyriasis.com>2014-04-20 16:13:14 +0000
commit5b2e318b98db9de4d83c2d2291111905bdb6d2a8 (patch)
treef7e40d1ce999f86483dfeae37228144119a28090
parentdf6ae96cfeec9dda6e50706f9349e22670838944 (diff)
downloaddotfiles-5b2e318b98db9de4d83c2d2291111905bdb6d2a8.tar.xz
zshrc: Fix setting of ssh/gpg keyring variables
Use test with -S to check for the existance of the gpg and ssh gnome-keyring sockets, if they exist set the ssh/gpg-agent variables correctly. Old behavior overwrote the already existing versions of the variables if the keyring sockets didn't exist.
-rw-r--r--zsh/.zshrc6
1 files changed, 2 insertions, 4 deletions
diff --git a/zsh/.zshrc b/zsh/.zshrc
index 01f2285..c46b2cc 100644
--- a/zsh/.zshrc
+++ b/zsh/.zshrc
@@ -147,7 +147,5 @@ sprfile() {
curl -F "sprunge=<$1" http://sprunge.us
}
-GPG_AGENT_INFO=$(ss -xl | grep -o '/run/user/1000/keyring/gpg')
-[ -z "$GPG_AGENT_INFO" ] || export GPG_AGENT_INFO=$GPG_AGENT_INFO:0:1
-SSH_AUTH_SOCK=$(ss -xl | grep -o '/run/user/1000/keyring/ssh')
-[ -z "$SSH_AUTH_SOCK" ] || export SSH_AUTH_SOCK
+[[ -S '/run/user/1000/keyring/gpg' ]] && export GPG_AGENT_INFO='/run/user/1000/keyring/gpg:0:1'
+[[ -S '/run/user/1000/keyring/ssh' ]] && export SSH_AUTH_SOCK='/run/user/1000/keyring/ssh'