Revamp SSH_AUTH_SOCK
This commit is contained in:
parent
742a3db2e1
commit
eb5b21e2e8
|
@ -6,11 +6,17 @@ systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT
|
|||
source ${HOME}/.dotfiles/bash/bash_aliases
|
||||
|
||||
# Configure static SSH Agent
|
||||
export SSH_AUTH_SOCK=~/.spool/ssh-agent.sock
|
||||
export SSH_AUTH_SOCK=$HOME/.spool/ssh-agent.sock
|
||||
if [ -e $SSH_AUTH_SOCK ]; then
|
||||
rm $SSH_AUTH_SOCK
|
||||
fi
|
||||
ssh-agent -a "$SSH_AUTH_SOCK" >/dev/null
|
||||
if [ -e $HOME/.spool/ssh-agent.env ]; then
|
||||
rm $HOME/.spool/ssh-agent.env
|
||||
fi
|
||||
if [[ "`pgrep ssh-agent`" ]]; then
|
||||
pkill ssh-agent
|
||||
fi
|
||||
. $HOME/scripts/ssh-agent.sh
|
||||
|
||||
# Static/predictable Sway socket
|
||||
export SWAYSOCK=`sway --get-socketpath`
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
|
||||
if [ ! $SSH_TTY ]; then
|
||||
# Remove socket files
|
||||
rm SSH_AUTH_SOCK
|
||||
rm SWAYSOCK
|
||||
rm $SSH_AUTH_SOCK
|
||||
rm $HOME/.spool/ssh-agent.env
|
||||
rm $SWAYSOCK
|
||||
fi
|
||||
|
||||
# when leaving the console clear the screen to increase privacy
|
||||
|
|
10
bash/bashrc
10
bash/bashrc
|
@ -93,6 +93,16 @@ export TERM="xterm"
|
|||
echo -e -n "\033]2;Welcome to Bash\007"
|
||||
|
||||
SSH_AUTH_SOCK="$HOME/.spool/ssh-agent.sock"
|
||||
if [ -z $SSH_AGENT_PID ]; then
|
||||
if [ -f "$HOME/.spool/ssh-agent.env" ]; then
|
||||
source $HOME/.spool/ssh-agent.env >/dev/null
|
||||
else
|
||||
if [ ! -f $SSH_AUTH_SOCK ]; then
|
||||
touch $SSH_AUTH_SOCK
|
||||
fi
|
||||
$HOME/scripts/ssh-agent.sh
|
||||
fi
|
||||
fi
|
||||
|
||||
# Distrobox only
|
||||
if [ -f "/run/.containerenv" ]; then
|
||||
|
|
Loading…
Reference in New Issue