diff options
author | Patrick Simianer <pks@pks.rocks> | 2018-10-27 23:30:05 +0200 |
---|---|---|
committer | Patrick Simianer <pks@pks.rocks> | 2018-10-27 23:30:05 +0200 |
commit | db942546e2b3e1c24026a0f2617cbbd6dc7f6fad (patch) | |
tree | c923086e2eb6f2d23c95a88ca46ea4cfd062dcfc | |
parent | e57327ddaf6e52b2784d0878e3d4fff5e7d9baf9 (diff) |
zsh: ssh-agent
-rw-r--r-- | zsh/.zshrc | 34 |
1 files changed, 29 insertions, 5 deletions
@@ -30,6 +30,30 @@ ZDIR=~/.zsh/ _HOST_TYPE=$(uname) # ############################################################################# +# ssh-agent +# ############################################################################# + +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; +} + +if [ -f "${SSH_ENV}" ]; then + . "${SSH_ENV}" > /dev/null + ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || { + start_agent; + } +else + start_agent; +fi + +# ############################################################################# # functions # ############################################################################# @@ -213,11 +237,11 @@ if [[ $(on_gcloud) == "yes" ]]; then fi # aws -if [[ $(on_aws) == "yes" ]]; then - HOSTCOLOR_BG=yellow - HOSTCOLOR_FG=black - alias tmux="tmux -f ~/.tmux.aws.conf" -fi +#if [[ $(on_aws) == "yes" ]]; then +# HOSTCOLOR_BG=yellow +# HOSTCOLOR_FG=black +# alias tmux="tmux -f ~/.tmux.aws.conf" +#fi function chpwd { |