| 1 | #!/bin/sh |
| 2 | |
| 3 | set -e |
| 4 | |
| 5 | usage() { |
| 6 | echo "usage: dcp-runenv REPODIR RUNDIR" |
| 7 | } |
| 8 | |
| 9 | if [ $# -lt 2 ]; then |
| 10 | usage >&2 |
| 11 | exit 1 |
| 12 | fi |
| 13 | |
| 14 | repodir="$1" |
| 15 | rundir="$2" |
| 16 | shift 2 |
| 17 | |
| 18 | if [ ! -d "$rundir" ]; then mkdir "$rundir"; fi |
| 19 | |
| 20 | git clone -q "$repodir" "$rundir/repo" |
| 21 | for b in "$rundir/repo/.git/refs/remotes/origin"/*; do |
| 22 | b="${b##*/}" |
| 23 | if [ "$b" = HEAD -o "$b" = master ]; then continue; fi |
| 24 | (cd "$rundir/repo"; git branch "$b" "origin/$b") || false |
| 25 | done |
| 26 | cp -a "$rundir/repo/control" "$rundir" |
| 27 | mkdir "$rundir/output" |