combine ssh-agent setup into a single file

main
Andrew Coleman 2022-05-11 08:24:27 -04:00
parent 22cf65ed86
commit 3055a07a02
2 changed files with 10 additions and 11 deletions

View File

@ -1,4 +1,14 @@
{{- if (eq .chezmoi.os "linux") -}} {{- 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" SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"
export SSH_AUTH_SOCK export SSH_AUTH_SOCK
{{ end }}
{{- end -}} {{- end -}}

View File

@ -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 -}}