commit by to_remotes 2023-10-05 09:27:39 +0200 from vmdevac
parent
7d91d1c7ea
commit
8925fc1852
30
init.sh
30
init.sh
|
|
@ -38,26 +38,26 @@ function clone_repo_with_retry(){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Oh-my-zsh compatible bash ssh-agent start script
|
||||||
|
function _start_agent() {
|
||||||
|
if [[ -f "$ssh_env_cache" ]]; then
|
||||||
|
. "$ssh_env_cache" > /dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -S "$SSH_AUTH_SOCK" ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Starting ssh-agent ..."
|
||||||
|
ssh-agent -s | sed '/^echo/d' > "$ssh_env_cache"
|
||||||
|
chmod 600 "$ssh_env_cache"
|
||||||
|
. "$ssh_env_cache" > /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
function start_ssh_agent(){
|
function start_ssh_agent(){
|
||||||
SHORT_HOST="${HOSTNAME/.*/}"
|
SHORT_HOST="${HOSTNAME/.*/}"
|
||||||
ssh_env_cache="$HOME/.ssh/environment-$SHORT_HOST"
|
ssh_env_cache="$HOME/.ssh/environment-$SHORT_HOST"
|
||||||
|
|
||||||
# Oh-my-zsh compatible bash ssh-agent start script
|
|
||||||
function _start_agent() {
|
|
||||||
if [[ -f "$ssh_env_cache" ]]; then
|
|
||||||
. "$ssh_env_cache" > /dev/null
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -S "$SSH_AUTH_SOCK" ]]; then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Starting ssh-agent ..."
|
|
||||||
ssh-agent -s | sed '/^echo/d' > "$ssh_env_cache"
|
|
||||||
chmod 600 "$ssh_env_cache"
|
|
||||||
. "$ssh_env_cache" > /dev/null
|
|
||||||
}
|
|
||||||
_start_agent
|
_start_agent
|
||||||
|
|
||||||
unset ssh_env_cache
|
unset ssh_env_cache
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue