Fix for Linux and make consistent

This commit is contained in:
Loic Nageleisen 2021-03-02 12:41:07 +01:00
parent e317caaa8f
commit 9ca56d83c7
42 changed files with 106 additions and 52 deletions

13
shell/ssh Normal file → Executable file
View file

@ -1,6 +1,11 @@
# ssh keychain, if no agent set
if [ -z "$SSH_AUTH_SOCK" ]; then
if which envoy 2>&1 >/dev/null; then
source <(envoy -p)
# start ssh agent, if no agent set
if [[ -n "${XDG_RUNTIME_DIR}" && -z "${SSH_AUTH_SOCK}" ]]; then
if ! pgrep -u "$USER" ssh-agent > /dev/null; then
ssh-agent -t 1h > "${XDG_RUNTIME_DIR}/ssh-agent.env"
fi
if [[ ! -S "${SSH_AUTH_SOCK}" ]] && [[ -f "${XDG_RUNTIME_DIR}/ssh-agent.env" ]]; then
source "${XDG_RUNTIME_DIR}/ssh-agent.env" > /dev/null
fi
fi
# vim: ft=bash