carlosmscabral | f40ecd1 | 2013-02-01 18:15:58 -0200 | [diff] [blame] | 1 | SSH_ENV="$HOME/.ssh/environment" |
| 2 | |
| 3 | function start_agent { |
| 4 | echo "Initialising new SSH agent..." |
| 5 | /usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}" |
| 6 | echo succeeded |
| 7 | chmod 600 "${SSH_ENV}" |
| 8 | . "${SSH_ENV}" > /dev/null |
| 9 | /usr/bin/ssh-add; |
| 10 | } |
| 11 | |
| 12 | # Source SSH settings, if applicable |
| 13 | |
| 14 | if [ -f "${SSH_ENV}" ]; then |
| 15 | . "${SSH_ENV}" > /dev/null |
| 16 | #ps ${SSH_AGENT_PID} doesn't work under cywgin |
| 17 | ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || { |
| 18 | start_agent; |
| 19 | } |
| 20 | else |
| 21 | start_agent; |
| 22 | fi |
| 23 | |
| 24 | source ~/.bashrc |