Simplified SSH interaction.
This commit is contained in:
parent
89d0686a43
commit
ab1abfe496
24
.bashrc
24
.bashrc
|
@ -89,28 +89,10 @@ export GOPATH=${HOME}/src/go
|
||||||
#--------------------------------------------------------------------------------
|
#--------------------------------------------------------------------------------
|
||||||
# Run an SSH agent, if possible
|
# Run an SSH agent, if possible
|
||||||
#--------------------------------------------------------------------------------
|
#--------------------------------------------------------------------------------
|
||||||
SSH_ENV="$HOME/.ssh/environment"
|
|
||||||
|
|
||||||
function start_agent {
|
|
||||||
echo -n "Initialising new SSH agent... "
|
|
||||||
ssh-agent 2> /dev/null | sed 's/^echo/#echo/' > "${SSH_ENV}"
|
|
||||||
pgrep ssh-agent > /dev/null && echo "succeeded" || echo "failed"
|
|
||||||
chmod 0600 "${SSH_ENV}"
|
|
||||||
. "${SSH_ENV}" > /dev/null
|
|
||||||
ssh-add ~/.ssh/scott@wallace.sh
|
|
||||||
}
|
|
||||||
|
|
||||||
# Check if we already have an agent running and sourced
|
# Check if we already have an agent running and sourced
|
||||||
if [ -z "${SSH_AUTH_SOCK}" -a -n "${PS1}" ]; then
|
if [ -z "${SSH_AUTH_SOCK}" ]; then
|
||||||
# Source SSH settings, if applicable
|
eval `ssh-agent -s`
|
||||||
if [ -f "${SSH_ENV}" ]; then
|
ssh-add
|
||||||
. "${SSH_ENV}" > /dev/null
|
|
||||||
pgrep ssh-agent | grep -E "^${SSH_AGENT_PID}" > /dev/null || {
|
|
||||||
start_agent
|
|
||||||
}
|
|
||||||
else
|
|
||||||
start_agent
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
#--------------------------------------------------------------------------------
|
#--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,6 @@ function install_osx_software {
|
||||||
mosh
|
mosh
|
||||||
python3
|
python3
|
||||||
vim
|
vim
|
||||||
homebrew/dupes/openssh
|
|
||||||
EOF
|
EOF
|
||||||
#-------------------------------
|
#-------------------------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue