2020-01-02 23:57:06 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
2020-01-03 06:28:07 +08:00
|
|
|
STORE_PATH=/tmp
|
|
|
|
if [ ! -z "$1" ]; then
|
|
|
|
# This allows us to work with things like gitlab.
|
|
|
|
# where the same thing might be running concurrently.
|
|
|
|
# If default, it only stores in /tmp/, but if a path is added, it's interpolated.
|
|
|
|
STORE_PATH="$STORE_PATH/$1"
|
|
|
|
mkdir -p "$STORE_PATH"
|
|
|
|
fi
|
|
|
|
|
2020-01-02 23:57:06 +08:00
|
|
|
# Start the SSH agent if it isn't already.
|
|
|
|
if [ -z "$SSH_AGENT_PID" ]; then
|
2020-01-03 01:06:16 +08:00
|
|
|
eval "$(ssh-agent)" > /dev/null
|
2020-01-03 06:28:07 +08:00
|
|
|
echo "$SSH_AGENT_PID" > "$STORE_PATH"/ssh-agent-id
|
|
|
|
echo "$SSH_AUTH_SOCK" > "$STORE_PATH"/ssh-auth-sock
|
2020-01-02 23:57:06 +08:00
|
|
|
fi
|