improve token-handling
This commit is contained in:
parent
6acc1c4563
commit
12591e94b0
1 changed files with 15 additions and 3 deletions
18
functions.sh
18
functions.sh
|
@ -836,7 +836,7 @@ token-list-objects() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
loadagent () {
|
ssh-loadagent () {
|
||||||
|
|
||||||
# TODO: create agent if not running
|
# TODO: create agent if not running
|
||||||
cat << EOF
|
cat << EOF
|
||||||
|
@ -844,15 +844,27 @@ loadagent () {
|
||||||
SSH_AGENT_PID: ${SSH_AGENT_PID}
|
SSH_AGENT_PID: ${SSH_AGENT_PID}
|
||||||
---------------------------------------------
|
---------------------------------------------
|
||||||
EOF
|
EOF
|
||||||
ssh_identity=$1
|
ssh_identity=${1-default}
|
||||||
|
agentfile="${HOME}/.ssh/agents/agent-${ssh_identity}-$(hostname)"
|
||||||
|
echo agentfile: $agentfile
|
||||||
|
|
||||||
if [ -n "${ssh_identity+x}" ]; then
|
if [ -n "${ssh_identity+x}" ]; then
|
||||||
agentfile="${HOME}/.ssh/agents/agent-${ssh_identity}-$(hostname)"
|
|
||||||
if [ -e "$agentfile" ]; then
|
if [ -e "$agentfile" ]; then
|
||||||
. $agentfile
|
. $agentfile
|
||||||
|
if ssh-add -l >/dev/null ;then
|
||||||
|
echo agent is running
|
||||||
|
else
|
||||||
|
echo create new agent
|
||||||
|
ssh-agent > "$agentfile"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo create new agent
|
||||||
|
ssh-agent > "$agentfile"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
eval $(<$agentfile)
|
||||||
|
|
||||||
cat << EOF
|
cat << EOF
|
||||||
SSH_AUTH_SOCK: ${SSH_AUTH_SOCK}
|
SSH_AUTH_SOCK: ${SSH_AUTH_SOCK}
|
||||||
SSH_AGENT_PID: ${SSH_AGENT_PID}
|
SSH_AGENT_PID: ${SSH_AGENT_PID}
|
||||||
|
|
Loading…
Reference in a new issue