]> WPIA git - infra.git/blob - manager/fetch
upd: cleanup inclusion of config and document config elements
[infra.git] / manager / fetch
1 #!/bin/bash
2 targetHost=$1
3 targetHost=${targetHost%/}
4 source config
5 source "$targetHost/config"
6
7 echo "To: $to"
8 echo "Agent: $SSH_AGENT_PID"
9 oldpid=$SSH_AGENT_PID
10 if [[ $oldpid == "" ]]; then
11     eval $(ssh-agent)
12     ssh-add vm-key
13 fi
14 command=$(basename -- "$0")
15 echo "Action: $command"
16 if [[ $command == "push" ]]; then
17     git push -f "$to:" "HEAD:refs/remotes/manager/master"
18 else
19     git fetch "$to:" "+HEAD:refs/remotes/$targetHost/master"
20 fi
21 if [[ $oldpid == "" ]]; then
22     eval $(ssh-agent -k)
23 fi
24