Added agent startup script

This commit is contained in:
Keegan 2022-08-15 11:00:40 -04:00
parent bc94309b57
commit acb8107178
2 changed files with 20 additions and 1 deletions

18
bin/agent.sh Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
# makes sure agent is active and adds keys
if [ -z $SSH_AGENT_SOCK ] ; then
# agent unset
eval $(ssh-agent -s)
if [ "$(ssh-add -l)" = "The agent has no identities." ] ; then
if [ -e ~/.ssh/id_ed25519 ] ; then
ssh-add ~/.ssh/id_ed25519
else
kill $SSH_AGENT_PID
echo -e "No ed25519 keys found! Killing $SSH_AGENT_PID!"
fi
else
kill $SSH_AGENT_PID
echo "Killing $SSH_AGENT_PID!"
fi
fi

3
zshrc
View File

@ -134,4 +134,5 @@ export PATH=$PATH:$HOME/.local/bin
# ranger alias
alias ranger="python3 $HOME/.ranger.py"
#adding ranger to path
# adding agent startup alias
alias agent="source $HOME/.dotfiles/bin/agent.sh"