Added colour to warning. Removed 'tput set AF' colour codes.
This commit is contained in:
parent
dae5b0fdaa
commit
6b794373f2
2 changed files with 8 additions and 8 deletions
|
|
@ -21,7 +21,7 @@ hash ssh-add ssh-agent >/dev/null 2>&1 && {
|
||||||
[[ ! -z "$SSH_AUTH_SOCK" ]] && (( ${_SSH_AGENT_REG_FAILED:-0} == 0 )) && {
|
[[ ! -z "$SSH_AUTH_SOCK" ]] && (( ${_SSH_AGENT_REG_FAILED:-0} == 0 )) && {
|
||||||
_lock_agents_file && {
|
_lock_agents_file && {
|
||||||
_pop_agent_sock || {
|
_pop_agent_sock || {
|
||||||
echo -e "$(tput setaf 1 || tput AF 1)Failed to clean up agents file!$(tput op)"
|
echo -e "$(tput setaf 1)Failed to clean up agents file!$(tput op)"
|
||||||
_SLEEP=3
|
_SLEEP=3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -32,7 +32,7 @@ hash ssh-add ssh-agent >/dev/null 2>&1 && {
|
||||||
(( $SHLVL == 1 )) && {
|
(( $SHLVL == 1 )) && {
|
||||||
[[ ! -z "$SSH_AGENT_PID" ]] && {
|
[[ ! -z "$SSH_AGENT_PID" ]] && {
|
||||||
ssh-agent -k >/dev/null 2>&1 || {
|
ssh-agent -k >/dev/null 2>&1 || {
|
||||||
echo -e "$(tput setaf 1 || tput AF 1)Failed to kill ssh-agent!$(tput op)"
|
echo -e "$(tput setaf 1)Failed to kill ssh-agent!$(tput op)"
|
||||||
_SLEEP=3
|
_SLEEP=3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
12
.bashrc
12
.bashrc
|
|
@ -17,7 +17,7 @@ _agent_prompt_command() {
|
||||||
echo "Connected to alternate ssh-agent - you may need to re-add keys."
|
echo "Connected to alternate ssh-agent - you may need to re-add keys."
|
||||||
_SSH_AGENT_REG_FAILED=0
|
_SSH_AGENT_REG_FAILED=0
|
||||||
else
|
else
|
||||||
echo "Connected to, but failed to register, alternate ssh-agent - you may need to re-add keys."
|
echo "$(tput setaf 3)Connected to, but failed to register, alternate ssh-agent - you may need to re-add keys.$(tput op)"
|
||||||
_SSH_AGENT_REG_FAILED=1
|
_SSH_AGENT_REG_FAILED=1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
@ -26,13 +26,13 @@ _agent_prompt_command() {
|
||||||
else
|
else
|
||||||
if [[ -z "$(egrep -v '^$' ~/.ssh/agents)" ]]; then
|
if [[ -z "$(egrep -v '^$' ~/.ssh/agents)" ]]; then
|
||||||
((${_SSH_PROMPT_ERROR_ISSUED:-0} == 0)) && {
|
((${_SSH_PROMPT_ERROR_ISSUED:-0} == 0)) && {
|
||||||
echo "$(tput setaf 1 || tput AF 1)Lost connection to ssh-agent - no alternate available!$(tput op)"
|
echo "$(tput setaf 1)Lost connection to ssh-agent - no alternate available!$(tput op)"
|
||||||
unset SSH_AUTH_SOCK
|
unset SSH_AUTH_SOCK
|
||||||
_SSH_PROMPT_ERROR_ISSUED=1
|
_SSH_PROMPT_ERROR_ISSUED=1
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
((${_SSH_PROMPT_ERROR_ISSUED:-0} == 0)) && {
|
((${_SSH_PROMPT_ERROR_ISSUED:-0} == 0)) && {
|
||||||
echo "$(tput setaf 1 || tput AF 1)Lost connection to ssh-agent - failed to connect to new agent!$(tput op)"
|
echo "$(tput setaf 1)Lost connection to ssh-agent - failed to connect to new agent!$(tput op)"
|
||||||
unset SSH_AUTH_SOCK
|
unset SSH_AUTH_SOCK
|
||||||
_SSH_PROMPT_ERROR_ISSUED=1
|
_SSH_PROMPT_ERROR_ISSUED=1
|
||||||
}
|
}
|
||||||
|
|
@ -84,7 +84,7 @@ _lock_agents_file() {
|
||||||
if exec 9>~/.ssh/agents.lock && flock -E 10 -w 0.5 9; then
|
if exec 9>~/.ssh/agents.lock && flock -E 10 -w 0.5 9; then
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
echo "$(tput setaf 1 || tput AF 1)Failed to obtain lockfile!$(tput op)"
|
echo "$(tput setaf 1)Failed to obtain lockfile!$(tput op)"
|
||||||
fi
|
fi
|
||||||
elif [[ "$_PLATFORM" == "Darwin" ]]; then
|
elif [[ "$_PLATFORM" == "Darwin" ]]; then
|
||||||
# Do locking the sucky way on OSX.
|
# Do locking the sucky way on OSX.
|
||||||
|
|
@ -95,9 +95,9 @@ _lock_agents_file() {
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
[[ "${_GOT_LOCK:-0}" == "0" ]] && echo "$(tput setaf 1 || tput AF 1)Failed to obtain lockfile!$(tput op)"
|
[[ "${_GOT_LOCK:-0}" == "0" ]] && echo "$(tput setaf 1)Failed to obtain lockfile!$(tput op)"
|
||||||
else
|
else
|
||||||
echo "$(tput setaf 1 || tput AF 1)File locking unsupported - skipping update of agents file!$(tput op)"
|
echo "$(tput setaf 1)File locking unsupported - skipping update of agents file!$(tput op)"
|
||||||
fi
|
fi
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue