From 3055a07a029efcca0f73ceb94c2ec4cbaa9b1f63 Mon Sep 17 00:00:00 2001 From: Andrew Coleman Date: Wed, 11 May 2022 08:24:27 -0400 Subject: [PATCH] combine ssh-agent setup into a single file --- dot_config/bash/ssh-agent.sh.tmpl | 10 ++++++++++ dot_config/bash/wsl-ssh-agent.sh.tmpl | 11 ----------- 2 files changed, 10 insertions(+), 11 deletions(-) delete mode 100644 dot_config/bash/wsl-ssh-agent.sh.tmpl diff --git a/dot_config/bash/ssh-agent.sh.tmpl b/dot_config/bash/ssh-agent.sh.tmpl index e74b1e3..8f526ae 100644 --- a/dot_config/bash/ssh-agent.sh.tmpl +++ b/dot_config/bash/ssh-agent.sh.tmpl @@ -1,4 +1,14 @@ {{- if (eq .chezmoi.os "linux") -}} +{{- if (contains "microsoft" .chezmoi.kernel.osrelease) -}} +if [ -z "$(pgrep ssh-agent)" ]; then + rm -rf /tmp/ssh-* + eval $(ssh-agent -s) > /dev/null +else + export SSH_AGENT_PID=$(pgrep ssh-agent) + export SSH_AUTH_SOCK=$(find /tmp/ssh-* -name agent.*) +fi +{{- else -}} SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket" export SSH_AUTH_SOCK +{{ end }} {{- end -}} diff --git a/dot_config/bash/wsl-ssh-agent.sh.tmpl b/dot_config/bash/wsl-ssh-agent.sh.tmpl deleted file mode 100644 index 16e29fe..0000000 --- a/dot_config/bash/wsl-ssh-agent.sh.tmpl +++ /dev/null @@ -1,11 +0,0 @@ -{{- if (eq .chezmoi.os "linux") -}} -{{- if (contains "microsoft" .chezmoi.kernel.osrelease) -}} -if [ -z "$(pgrep ssh-agent)" ]; then - rm -rf /tmp/ssh-* - eval $(ssh-agent -s) > /dev/null -else - export SSH_AGENT_PID=$(pgrep ssh-agent) - export SSH_AUTH_SOCK=$(find /tmp/ssh-* -name agent.*) -fi -{{- end -}} -{{- end -}}