]> git.donarmstrong.com Git - zsh.git/blob - .zsh/zshrc/64_ssh
add ~/.local/bin to PATH
[zsh.git] / .zsh / zshrc / 64_ssh
1 # -*- mode: sh -*-
2
3 # set up ssh-agent
4 if which gpg-connect-agent >/dev/null && [ -n "$GPG_AGENT_INFO" ]; then
5     SSH_AUTH_SOCK=$(gpg-connect-agent -q 'getinfo ssh_socket_name' '/bye'|
6                         awk -F'D ' '/.ssh$/{print $2}')
7     export SSH_AUTH_SOCK;
8 elif which ssh-agent >/dev/null && [ -d ~/.ssh ] &&  \
9     [ -z "$SSH_CONNECTION" ] &&  [ -z "$SSH_CLIENT" ]; then 
10     if [ -e ~/.ssh/ssh_agent_info ] && \
11         [ -n "$(awk -F '[=;]' '/^SSH_AGENT_PID/{print $2}' ~/.ssh/ssh_agent_info)" ] && \
12         kill -0 "$(awk -F '[=;]' '/^SSH_AGENT_PID/{print $2}' ~/.ssh/ssh_agent_info)" >/dev/null 2>&1; then
13         . ~/.ssh/ssh_agent_info > /dev/null
14     elif [ -e ~/.ssh/ssh_agent_info_$(hostname) ] && \
15         kill -0 "$(awk -F '[=;]' '/^SSH_AGENT_PID/{print $2}' ~/.ssh/ssh_agent_info_$(hostname))" >/dev/null 2>&1; then
16         . ~/.ssh/ssh_agent_info_$(hostname) > /dev/null
17     else
18         ssh-agent -s > ~/.ssh/ssh_agent_info_$(hostname)
19         . ~/.ssh/ssh_agent_info_$(hostname) > /dev/null
20     fi;
21 fi;
22