dotfiles

Personal dotfiles
git clone https://git.bracken.jp/dotfiles.git
Log | Files | Refs | LICENSE

commit 7b190935b485a5dbe621dc58a14e72f0c662e323
parent 9a3a228daa980f209c3ba3b7a38302a18c9abf33
Author: Chris Bracken <chris@bracken.jp>
Date:   Fri,  1 May 2020 11:18:10 -0700

Clean up ssh-agent config

Write the socket file to ~/.local/tmp which is more XDG directory layout
compliant.

Trap shell exit and run ssh-agent -k to kill the agent on logout.

Diffstat:
M.zprofile | 12++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/.zprofile b/.zprofile @@ -3,9 +3,17 @@ # Set the terminal size if we're on a serial line. if [[ -x /usr/bin/resizewin ]]; then /usr/bin/resizewin -z; fi +# Add temporary environment. +DAEMON_RUNTIME_HOME="$HOME/.local/tmp" + # Start ssh-agent daemon. -export SSH_AUTH_SOCK=~/.ssh/ssh-agent.$HOST.sock +export SSH_AUTH_SOCK="$DAEMON_RUNTIME_HOME/ssh-agent.sock" ssh-add -l 2>/dev/null >/dev/null if [ $? -ge 2 ]; then - ssh-agent -a "$SSH_AUTH_SOCK" >/dev/null + mkdir -p "$DAEMON_RUNTIME_HOME" + eval $(ssh-agent -s -a "$SSH_AUTH_SOCK") > /dev/null + trap 'ssh-agent -k > /dev/null' EXIT fi + +# Clean up temporary environment. +unset DAEMON_RUNTIME_HOME