Update ssh agent things

This commit is contained in:
Marco Thomas
2021-07-24 20:24:12 +02:00
parent 1f14fe1638
commit c053d05237
4 changed files with 6 additions and 18 deletions

View File

@@ -29,11 +29,9 @@ alias cp='cp -i' # ask before removal
alias mv='mv -i' # ask before removal alias mv='mv -i' # ask before removal
# ============================== SSH-Agent # ============================== SSH-Agent
if [ -f ~/.ssh/agent.env ]; then if ! [ -S /tmp/marc-agent.sock ]; then
. ~/.ssh/agent.env > /dev/null
else
echo "Starting ssh-agent" echo "Starting ssh-agent"
eval `ssh-agent | tee ~/.ssh/agent.env` ssh-agent -a /tmp/marc-agent.sock
ssh-add ssh-add
fi fi

View File

@@ -4,9 +4,7 @@
export PATH=$PATH:$HOME/scripts:$HOME/.cargo/bin:$HOME/.cabal/bin:$HOME/.ghcup/bin:$HOME/.local/bin export PATH=$PATH:$HOME/scripts:$HOME/.cargo/bin:$HOME/.cabal/bin:$HOME/.ghcup/bin:$HOME/.local/bin
# ssh # ssh
if [ -f ~/.ssh/agent.env ] ; then export SSH_AUTH_SOCK=/tmp/marc-agent.sock
. ~/.ssh/agent.env > /dev/null
fi
# editor # editor
export EDITOR="vim" export EDITOR="vim"

View File

@@ -1 +0,0 @@
. ~/.profile

View File

@@ -98,17 +98,10 @@ setopt share_history # share command history data inside tmux
export HISTFILE="$HOME/.zsh_history" export HISTFILE="$HOME/.zsh_history"
export SAVEHIST=5000 export SAVEHIST=5000
# ============================== SSH-Agent # ============================== ssh-agent
if [ -f ~/.ssh/agent.env ] ; then if ! [ -S /tmp/marc-agent.sock ]; 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
echo "Starting ssh-agent" echo "Starting ssh-agent"
eval `ssh-agent | tee ~/.ssh/agent.env` ssh-agent -a /tmp/marc-agent.sock
ssh-add ssh-add
fi fi