ssh-agent setup/teardown for host only
This commit is contained in:
parent
df3583d9e5
commit
f9031a775d
|
@ -5,22 +5,6 @@ systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT
|
|||
# Load aliases
|
||||
source ${HOME}/.dotfiles/bash/bash_aliases
|
||||
|
||||
# Configure static SSH Agent
|
||||
export SSH_AUTH_SOCK=$HOME/.spool/ssh-agent.sock
|
||||
if [ -e $SSH_AUTH_SOCK ]; then
|
||||
rm $SSH_AUTH_SOCK
|
||||
fi
|
||||
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`
|
||||
|
||||
export LANG="C"
|
||||
export LC_ALL="C"
|
||||
export LC_CTYPE="C"
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
export SWAYSOCK="${HOME}/.spool/sway-ipc.sock"
|
|
@ -0,0 +1,15 @@
|
|||
# Configure static SSH Agent
|
||||
export SSH_AUTH_SOCK=$HOME/.spool/ssh-agent.sock
|
||||
if [ -e $SSH_AUTH_SOCK ]; then
|
||||
rm $SSH_AUTH_SOCK
|
||||
fi
|
||||
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`
|
|
@ -1,17 +1,5 @@
|
|||
# vim: ft=sh
|
||||
|
||||
if [ ! $SSH_TTY ]; then
|
||||
# Remove socket files
|
||||
rm $SSH_AUTH_SOCK
|
||||
rm $HOME/.spool/ssh-agent.env
|
||||
rm $SWAYSOCK
|
||||
fi
|
||||
|
||||
# when leaving the console clear the screen to increase privacy
|
||||
if [ "$SHLVL" = 1 ]; then
|
||||
[ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
|
||||
fi
|
||||
|
||||
if [ -f "/run/.containerenv" ] && grep -oP "(?<=name=\")[^\";]+" /run/.containerenv; then
|
||||
source $HOME/.dotfiles/bash/bash_logout.distrobox
|
||||
else
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
if [ ! $SSH_TTY ]; then
|
||||
# Remove socket files
|
||||
rm $SSH_AUTH_SOCK
|
||||
rm $HOME/.spool/ssh-agent.env
|
||||
rm $SWAYSOCK
|
||||
fi
|
||||
|
||||
# when leaving the console clear the screen to increase privacy
|
||||
if [ "$SHLVL" = 1 ]; then
|
||||
[ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
|
||||
fi
|
12
bash/bashrc
12
bash/bashrc
|
@ -92,18 +92,6 @@ export TERM="xterm"
|
|||
# Set initial title
|
||||
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
|
||||
|
||||
if [ -f "/run/.containerenv" ] && grep -oP "(?<=name=\")[^\";]+" /run/.containerenv; then
|
||||
source $HOME/.dotfiles/bash/bashrc.distrobox
|
||||
else
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
export 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
|
||||
|
|
@ -5,10 +5,6 @@
|
|||
# Background utilities
|
||||
################################################################################
|
||||
|
||||
# SSH Add - Should be started by profile instead
|
||||
# exec eval `ssh-agent -a ${SSH_AUTH_SOCK}`
|
||||
exec ssh-add &
|
||||
|
||||
# Automatically restore last used output configuration
|
||||
# TODO: Need to add fail-safe to script in case the outputs are unavailable
|
||||
exec $HOME/scripts/sway/displays.pl &
|
||||
|
|
Loading…
Reference in New Issue