diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-08-13 01:57:30 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-08-13 01:58:30 +0200 |
commit | 396e509716ae5b334f4d588a9b425476770577ea (patch) | |
tree | 169fb91c846d20dbe0df33a7f7d09e48b2b61920 /bin/guiscripts | |
parent | 8a2272e0f5f4b43f7ba3fa11f5887880299573b3 (diff) |
[mpass] added test for connecting to agent
Diffstat (limited to 'bin/guiscripts')
-rwxr-xr-x | bin/guiscripts/keyadd | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/bin/guiscripts/keyadd b/bin/guiscripts/keyadd index 4613b8f..e0a1661 100755 --- a/bin/guiscripts/keyadd +++ b/bin/guiscripts/keyadd @@ -31,7 +31,15 @@ notify () SSHFOLDER="$HOME/.ssh" -if test -z "${key:=$1}" +# Test if can connect to ssh-agent +ssh-add -l > /dev/null 2>&1 +if [ $? -gt 1 ] # ignore if there are no identities +then + notify "could not connect to agent." + exit 1 +fi + +if [ -z "${key:=$1}" ] then key="$(find "$SSHFOLDER" -iname "*.pub" | sed "s,$SSHFOLDER/,," | # Clean |