mirror of
https://github.com/cmderdev/cmder.git
synced 2024-11-10 09:49:12 +08:00
32 lines
875 B
Plaintext
32 lines
875 B
Plaintext
# use this file to run your own startup commands for msys2 bash'
|
|
|
|
# To add a new vendor to the path, do something like:
|
|
# export PATH=${CMDER_ROOT}/vendor/whatever:${PATH}
|
|
|
|
function launch_ssh_agent {
|
|
# Copied from (https://help.github.com/articles/working-with-ssh-key-passphrases)
|
|
env=~/.ssh/agent.env
|
|
|
|
agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; }
|
|
|
|
agent_start () {
|
|
(umask 077; ssh-agent >| "$env")
|
|
. "$env" >| /dev/null ; }
|
|
|
|
agent_load_env
|
|
|
|
# agent_run_state: 0=agent running w/ key; 1=agent w/o key; 2= agent not running
|
|
agent_run_state=$(ssh-add -l >| /dev/null 2>&1; echo $?)
|
|
|
|
if [ ! "$SSH_AUTH_SOCK" ] || [ $agent_run_state = 2 ]; then
|
|
agent_start
|
|
ssh-add
|
|
elif [ "$SSH_AUTH_SOCK" ] && [ $agent_run_state = 1 ]; then
|
|
ssh-add
|
|
fi
|
|
|
|
unset env
|
|
}
|
|
|
|
# Run ssh-agent automatically when you open your first bash terminal
|
|
# launch_ssh_agent |