From c053d052378175d140e79b2dd4f332c5e5fce5b1 Mon Sep 17 00:00:00 2001 From: Marco Thomas Date: Sat, 24 Jul 2021 20:24:12 +0200 Subject: [PATCH] Update ssh agent things --- files/.bashrc | 6 ++---- files/.profile | 4 +--- files/.zprofile | 1 - files/.zshrc | 13 +++---------- 4 files changed, 6 insertions(+), 18 deletions(-) delete mode 100755 files/.zprofile diff --git a/files/.bashrc b/files/.bashrc index 4a66609..85add80 100644 --- a/files/.bashrc +++ b/files/.bashrc @@ -29,11 +29,9 @@ alias cp='cp -i' # ask before removal alias mv='mv -i' # ask before removal # ============================== SSH-Agent -if [ -f ~/.ssh/agent.env ]; then - . ~/.ssh/agent.env > /dev/null -else +if ! [ -S /tmp/marc-agent.sock ]; then echo "Starting ssh-agent" - eval `ssh-agent | tee ~/.ssh/agent.env` + ssh-agent -a /tmp/marc-agent.sock ssh-add fi diff --git a/files/.profile b/files/.profile index 3dd4044..aa2a763 100755 --- a/files/.profile +++ b/files/.profile @@ -4,9 +4,7 @@ export PATH=$PATH:$HOME/scripts:$HOME/.cargo/bin:$HOME/.cabal/bin:$HOME/.ghcup/bin:$HOME/.local/bin # ssh -if [ -f ~/.ssh/agent.env ] ; then - . ~/.ssh/agent.env > /dev/null -fi +export SSH_AUTH_SOCK=/tmp/marc-agent.sock # editor export EDITOR="vim" diff --git a/files/.zprofile b/files/.zprofile deleted file mode 100755 index a2c42ef..0000000 --- a/files/.zprofile +++ /dev/null @@ -1 +0,0 @@ -. ~/.profile diff --git a/files/.zshrc b/files/.zshrc index c989199..5bef00a 100644 --- a/files/.zshrc +++ b/files/.zshrc @@ -98,17 +98,10 @@ setopt share_history # share command history data inside tmux export HISTFILE="$HOME/.zsh_history" export SAVEHIST=5000 -# ============================== SSH-Agent -if [ -f ~/.ssh/agent.env ] ; then - . ~/.ssh/agent.env > /dev/null - if ! kill -0 $SSH_AGENT_PID > /dev/null 2>&1; then - echo "Stale agent file found. Spawning a new agent. " - eval `ssh-agent | tee ~/.ssh/agent.env` - ssh-add - fi -else +# ============================== ssh-agent +if ! [ -S /tmp/marc-agent.sock ]; then echo "Starting ssh-agent" - eval `ssh-agent | tee ~/.ssh/agent.env` + ssh-agent -a /tmp/marc-agent.sock ssh-add fi