Start ssh-agent when needed

This commit is contained in:
Sonny Bakker 2017-11-06 21:50:45 +01:00
parent 26c8b32b06
commit 847ccd2691
2 changed files with 22 additions and 3 deletions

View file

@ -7,14 +7,33 @@
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
VISUAL=vim
EDITOR=vim
eval "$(ssh-agent)"
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo "succeeded"
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
}
# source SSH settings, if applicable
if [ -f "${SSH_ENV}" ]; then
. "${SSH_ENV}" > /dev/null
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
start_agent;
}
else
start_agent;
fi
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
. "$HOME/.bashrc"
fi
fi

View file

@ -21,7 +21,7 @@ au BufWinLeave *.py mkview
au BufWinEnter *.py silent loadview
" file specific formatting
autocmd Filetype python setlocal tabstop=4 softtabstop=4 shiftwidth=4 expandtab autoindent fileformat=unix
autocmd Filetype python,bash,sh setlocal tabstop=4 softtabstop=4 shiftwidth=4 expandtab autoindent fileformat=unix
autocmd Filetype css,html,htmldjango,javascript setlocal tabstop=2 softtabstop=2 shiftwidth=2
" fold methods based on indents