summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Lemon <matt@matthewlemon.com>2022-07-04 07:01:19 +0100
committerMatthew Lemon <matt@matthewlemon.com>2022-07-04 07:01:19 +0100
commitd7a14fe4a9e724c786f972e434d1290cbe947c75 (patch)
tree6d8aab7b0724a4cb0974ac451a7dbd77c141f68c
parentce97065da1242c9bdfb0fa85eb69c55300d37e37 (diff)
added correct ssh-agent invocation now to start agent once
-rw-r--r--profile_vm_provisioning15
1 files changed, 14 insertions, 1 deletions
diff --git a/profile_vm_provisioning b/profile_vm_provisioning
index 1b8fc5b..806a66f 100644
--- a/profile_vm_provisioning
+++ b/profile_vm_provisioning
@@ -2,7 +2,20 @@
#
# sh/ksh initialization
-eval `ssh-agent -s`
+# if we have private ssh key(s), start ssh-agent and add the key(s)
+id1=$HOME/$USER/.ssh/identity
+id2=$HOME/$USER/.ssh/id_dsa
+id3=$HOME/$USER/.ssh/id_rsa
+id4=$HOME/$USER/.ssh/id_ecdsa
+id5=$HOME/$USER/.ssh/id_ed25519
+if [ -z "$SSH_AGENT_PID" ];
+then
+ if [ -x /usr/bin/ssh-agent ] && [ -f $id1 -o -f $id2 -o -f $id3 -o -f $id4 -o -f $id5 ];
+ then
+ eval `ssh-agent -s`
+ ssh-add < /dev/null
+ fi
+fi
PATH=$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games