aboutsummaryrefslogtreecommitdiff
path: root/ssh-agent-loadkey
diff options
context:
space:
mode:
Diffstat (limited to 'ssh-agent-loadkey')
-rwxr-xr-xssh-agent-loadkey15
1 files changed, 11 insertions, 4 deletions
diff --git a/ssh-agent-loadkey b/ssh-agent-loadkey
index e02bd1f..1207a05 100755
--- a/ssh-agent-loadkey
+++ b/ssh-agent-loadkey
@@ -5,8 +5,10 @@
# Parameters
BASENAME="`basename $0`"
+KEYS="$HOME/.ssh/keys"
TYPE="$1"
HANDLE="$2"
+KEY="$KEYS/$TYPE/$HANDLE"
# Check
if [ -z "$HANDLE" ]; then
@@ -15,10 +17,15 @@ if [ -z "$HANDLE" ]; then
echo ""
( cd $HOME/.ssh/keys && find -name '*.pub' ) | grep -v decomissioned | sed -e 's/^/\t/'
exit 1
-elif [ ! -e "$HOME/.ssh/keys/$TYPE/$HANDLE" ]; then
- echo "$BASENAME: file not found: $HOME/.ssh/keys/$TYPE/$HANDLE"
+elif [ ! -e "$KEY" ]; then
+ echo "$BASENAME: file not found: $KEY"
exit 1
fi
-# Dispatch
-ssh-add $HOME/.ssh/keys/$TYPE/$HANDLE
+# Check if the selected option has a custom procedure (monkeysphere, keyringer, etc)
+if [ -x "$KEY.askpass" ]; then
+ # SSH-ADD(1) says: "Note that on some machines it may be necessary to redirect the input from /dev/null to make this work".
+ SSH_ASKPASS="$KEYS.askpass" ssh-add $KEY < /dev/null
+else
+ ssh-add $KEY
+fi