X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=default_plugins%2Fssh%2Fssh.zshrc;h=1afc7f469116c1996f816127ca176add79dff17a;hb=2ddebb388326d38d99b04303397ecadc185ccc58;hp=234459f38663eec2b29b1668bb45da4da8f99f9e;hpb=d860c647f2cf271af84f345627b7cd8336f1dc4c;p=ax-zsh.git diff --git a/default_plugins/ssh/ssh.zshrc b/default_plugins/ssh/ssh.zshrc index 234459f..1afc7f4 100644 --- a/default_plugins/ssh/ssh.zshrc +++ b/default_plugins/ssh/ssh.zshrc @@ -11,6 +11,7 @@ ssh-autoadd() { [[ -z "$SSH_AUTH_SOCK" ]] && return 0 ssh-add -l >/dev/null && return 0 [[ $? -eq 2 ]] && return 2 + [[ "$1" = "-v" ]] && echo "SSH agent is running, but has no identities." ssh-add } @@ -26,8 +27,21 @@ ax_hostname_prompt_functions=($ax_hostname_prompt_functions _ax_ssh_prompt) # file becomes invalid when the session has been disconnected. [[ ! -r "$SSH_AUTH_SOCK" ]] && unset SSH_AUTH_SOCK +# Look for common socket locations ... +if [[ -z "$SSH_AUTH_SOCK" ]]; then + for s ( + /mnt/c/Local/$LOGNAME/ssh-agent.sock + ); do + if [[ -r "$s" ]]; then + export SSH_AUTH_SOCK=$s + break + fi + done + unset s +fi + # Save SSH environment when available: -if [[ -n "$SSH_AUTH_SOCK" ]]; then +if [[ -n "$SSH_AUTH_SOCK" && -d "$XDG_RUNTIME_DIR" ]]; then # Save current environment when no state exists or is invalid. if [[ -r "$XDG_RUNTIME_DIR/ssh-env.sh" ]]; then (