From 7b5196ca66a28c3555f3ab32b911d009277d49bd Mon Sep 17 00:00:00 2001 From: Mauro Locatelli Date: Thu, 27 Jul 2017 11:39:22 +0200 Subject: [PATCH] ssh: check ssh-askpass presence under Linux Check the presence of `ssh-askpass`, if `/usr/lib/ssh/x11-ssh-askpass` is present I use it otherwise I require the passphrase in the standard method --- modules/ssh/init.zsh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/ssh/init.zsh b/modules/ssh/init.zsh index 6c073321..c0316d24 100644 --- a/modules/ssh/init.zsh +++ b/modules/ssh/init.zsh @@ -39,10 +39,11 @@ fi # Load identities. if ssh-add -l 2>&1 | grep -q 'The agent has no identities'; then zstyle -a ':prezto:module:ssh:load' identities '_ssh_identities' - if (( ${#_ssh_identities} > 0 )); then - ssh-add "$_ssh_dir/${^_ssh_identities[@]}" < /dev/null 2> /dev/null + # Check for Linux system and ssh-askpass presence + if [[ "$OSTYPE" == linux* ]] && [[ ! -a /usr/lib/ssh/x11-ssh-askpass ]]; then + ssh-add "${_ssh_identities:+$_ssh_dir/${^_ssh_identities[@]}}" 2> /dev/null else - ssh-add < /dev/null 2> /dev/null + ssh-add "${_ssh_identities:+$_ssh_dir/${^_ssh_identities[@]}}" < /dev/null 2> /dev/null fi fi