commit 7db2645f724444ae2378c5bce94e620929a3d834
parent 7b533ca248ae86826217964463392fc968001c5d
Author: Chris Bracken <chris@bracken.jp>
Date: Mon, 9 Oct 2023 11:51:13 -0700
Use XDG_RUNTIME_DIR for ssh sock on FreeBSD
Since we set and create XDG_RUNTIME_DIR in .zshenv if it's not already
set by the OS, use that for the location to create the ssh-agent socket
when necessary.
Diffstat:
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/.config/zsh/.zprofile b/.config/zsh/.zprofile
@@ -4,18 +4,12 @@
if [[ -x /usr/bin/resizewin ]]; then /usr/bin/resizewin -z; fi
if [[ "$(uname)" == "FreeBSD" ]]; then
- # Add temporary environment.
- DAEMON_RUNTIME_HOME="$HOME/.local/tmp"
-
# Start ssh-agent daemon.
- export SSH_AUTH_SOCK="$DAEMON_RUNTIME_HOME/ssh-agent.sock"
+ export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.sock"
ssh-add -l 2>/dev/null >/dev/null
if [ $? -ge 2 ]; then
- mkdir -p "$DAEMON_RUNTIME_HOME"
+ # If not already running, start ssh-agent. Stop on shell exit.
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
fi