dotfiles

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

commit aea5260950f3cd7905a2ec9cfaf84ed3d3aeabda
parent 971ec352abbdc2a690318f18a3fec2153a754023
Author: Chris Bracken <chris@bracken.jp>
Date:   Thu, 12 Oct 2023 10:05:18 -0700

Only set SSH_AUTH_SOCK via systemd on Linux

And even then, only when it's not already set, and even then, only when
it's actually already set by systemd. Realistically, we should probably
fall back to manually starting the agent if it's not running on Linux,
but this works for now.

Diffstat:
M.config/zsh/.zprofile | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/.config/zsh/.zprofile b/.config/zsh/.zprofile @@ -3,9 +3,11 @@ # Set the terminal size if we're on a serial line. if [[ -x /usr/bin/resizewin ]]; then /usr/bin/resizewin -z; fi -if [[ "$(uname)" == "Linux" || "$(uname)" == "FreeBSD" ]]; then +if [[ "$(uname)" == "Linux" && -z "$SSH_AUTH_SOCK" ]]; then # ssh-agent is started by systemd; add the socket path to the environment. - export "$(systemctl --user show-environment | grep '^SSH_AUTH_SOCK=')" + SOCK_VAR="$(systemctl --user show-environment | grep '^SSH_AUTH_SOCK=')" + [ ! -z "$SOCK_VAR" ] && export "$SOCK_VAR" + unset SOCK_VAR elif [[ "$(uname)" == "FreeBSD" ]]; then # Start ssh-agent daemon. export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"