[FIX][SHELL] Inherit keychain's ssh-agent from env

I also use this opportunity to make it use a different directory, to
avoid polluting my $HOME.
This commit is contained in:
Bruno BELANYI 2020-09-11 13:06:18 +02:00
parent 59893b6a00
commit 13702a21e7
1 changed files with 4 additions and 1 deletions

View File

@ -45,6 +45,9 @@ if { [ -n "$BASH_VERSION" ] && shopt -q login_shell; } ||
# Use this path for `remind` calendar
export DOTREMINDERS="$HOME/.config/remind/reminders.rem"
# Use my ssh-agent service's socket
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"
elif { [ -n "$BASH_VERSION" ] || [ -n "$ZSH_VERSION" ] ; } &&
[[ $- == *i* ]]; then # When interactive, deactivate terminal freezes
stty -ixon
@ -54,7 +57,7 @@ fi
unset SSH_ASKPASS
# Use keychain to handle ssh-agent, in interactive shell too
eval "$(keychain --eval id_rsa --eval shared_rsa --quiet)"
eval "$(keychain --dir ~/.cache/keychain --inherit any-once --eval id_rsa --eval shared_rsa --quiet)"
# Use my localrc script to automatically source/unsource local configurations
source ~/.scripts/localrc