From 940162fab6b072b183dac0e230c90c41da61fb67 Mon Sep 17 00:00:00 2001 From: Anthony Perkins Date: Thu, 25 Aug 2022 10:30:17 +0100 Subject: [PATCH] Load ssh-agent on login if not running --- roles/home-cli/files/shrc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/roles/home-cli/files/shrc b/roles/home-cli/files/shrc index 89c3ed2..4a10d0c 100644 --- a/roles/home-cli/files/shrc +++ b/roles/home-cli/files/shrc @@ -152,6 +152,13 @@ fi alias prun='podman run --rm --interactive --tty --security-opt label=disable --volume "$HOME":"$HOME" --volume "$XDG_RUNTIME_DIR":"$XDG_RUNTIME_DIR" --env XDG_RUNTIME_DIR="$XDG_RUNTIME_DIR" --env XDG_SESSION_TYPE=wayland --ipc host' alias pruncerts='prun --volume /etc/pki/ca-trust:/etc/pki/ca-trust:ro --volume /etc/ssl/certs:/etc/ssl/certs:ro' +if [ -z "$SSH_AUTH_SOCK" ] && [ -z "$SSH_AGENT_PID" ] +then + export SSH_AUTH_SOCK="$XDG_STATE_HOME/ssh-agent.socket" + export SSH_AGENT_PID="$XDG_STATE_HOME/ssh-agent.pid" + ssh-agent -a "$SSH_AUTH_SOCK" +fi + mkcd () { if [ $# -ne 1 ] then