aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md0
-rw-r--r--TODO.md0
-rwxr-xr-xssh-agent-eval46
3 files changed, 46 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/README.md
diff --git a/TODO.md b/TODO.md
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TODO.md
diff --git a/ssh-agent-eval b/ssh-agent-eval
new file mode 100755
index 0000000..2edf711
--- /dev/null
+++ b/ssh-agent-eval
@@ -0,0 +1,46 @@
+#!/bin/bash
+#
+# Initializes the ssh-agent
+#
+
+# SSH Agent
+#SSHAGENT=/usr/bin/ssh-agent
+#SSHAGENTARGS="-s"
+#
+#function ssh_agent_eval_run {
+# eval `$SSHAGENT $SSHAGENTARGS` &> /dev/null
+# trap "ps $SSH_AGENT_PID &> /dev/null && kill $SSH_AGENT_PID" 0
+#}
+#
+#if [ "$1" == "-f" ]; then
+# echo "Starting a new ssh-agent..."
+# ssh_agent_eval_run
+#elif [ -z "$SSH_AUTH_SOCK" -a -x "$SSHAGENT" ]; then
+# ssh_agent_eval_run
+#fi
+
+# See http://mah.everybody.org/docs/ssh
+
+SSH_ENV="$HOME/.ssh/environment"
+
+function start_agent {
+ echo "Initialising new SSH agent..."
+ /usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
+ echo succeeded
+ chmod 600 "${SSH_ENV}"
+ . "${SSH_ENV}" > /dev/null
+ /usr/bin/ssh-add;
+ /usr/bin/monkeysphere subkey-to-ssh-agent
+}
+
+# Source SSH settings, if applicable
+
+if [ -f "${SSH_ENV}" ]; then
+ . "${SSH_ENV}" > /dev/null
+ #ps ${SSH_AGENT_PID} doesn't work under cywgin
+ ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
+ start_agent;
+ }
+else
+ start_agent;
+fi