mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
added code to the ssh-agent plugin (last commit was an empty file...)
This commit is contained in:
parent
271d6af798
commit
e5ceb22b3f
1 changed files with 34 additions and 0 deletions
|
|
@ -0,0 +1,34 @@
|
||||||
|
# Load ssh-agent/keychain (taken from asyd configuration, available at http://asyd.net/home/zsh )
|
||||||
|
|
||||||
|
function ssh_key_manage() {
|
||||||
|
if [[ -x $(which keychain) ]] && [ -r ~/.ssh/id_?sa ]; then
|
||||||
|
# run keychain
|
||||||
|
keychain --nogui ~/.ssh/id_?sa
|
||||||
|
[[ -r ~/.ssh-agent-`hostname` ]] && source ~/.ssh-agent-`hostname`
|
||||||
|
[[ -r ~/.keychain/`hostname`-sh ]] && source ~/.keychain/`hostname`-sh
|
||||||
|
else
|
||||||
|
if [ -x $(which ssh-agent) -a -f $HOME/.ssh/id_?sa ]; then
|
||||||
|
if [[ -r $HOME/.ssh/agent-pid ]]; then
|
||||||
|
if [[ -d /proc/$(< $HOME/.ssh/agent-pid) ]]; then
|
||||||
|
source $HOME/.ssh/agent
|
||||||
|
else
|
||||||
|
ssh-agent -s > $HOME/.ssh/agent
|
||||||
|
source $HOME/.ssh/agent
|
||||||
|
echo $SSH_AGENT_PID > $HOME/.ssh/agent-pid
|
||||||
|
ssh-add $HOME/.ssh/id_?sa
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
ssh-agent -s > $HOME/.ssh/agent
|
||||||
|
source $HOME/.ssh/agent
|
||||||
|
echo $SSH_AGENT_PID > $HOME/.ssh/agent-pid
|
||||||
|
ssh-add $HOME/.ssh/id_?sa
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ "$USER" != "root" ]]; then
|
||||||
|
ssh_key_manage
|
||||||
|
fi
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue