0
|
1 #!/bin/bash
|
|
2
|
|
3 # Usage: downloader.sh username teamname
|
|
4 REPO_FILE=${1}
|
|
5 DIR=${2}
|
|
6
|
|
7 if [ -d "$DIR" ]
|
|
8 then
|
|
9 echo "Directory already exists"
|
|
10 exit 1
|
|
11 fi
|
|
12
|
|
13 mkdir "${DIR}"
|
|
14 cd "${DIR}"
|
|
15
|
|
16 for repo in `cat "../${REPO_FILE}"`
|
|
17 do
|
|
18 local_dir=.`dirname $repo`
|
|
19 mkdir -p "$local_dir"
|
|
20 cd "$local_dir"
|
|
21
|
|
22 echo "[Cloning $repo]"
|
|
23
|
|
24 hg clone ssh://hg@bitbucket.org"$repo"
|
|
25
|
|
26 if [ $? != 0 ]
|
|
27 then
|
|
28 echo "[hg failed, trying git instead]"
|
|
29 git clone git@bitbucket.org:"$repo".git
|
|
30 fi
|
|
31
|
|
32 echo ""
|
|
33 echo ""
|
|
34
|
|
35 cd ..
|
|
36
|
|
37 # echo "Cloning" $repo
|
|
38 # if echo "$repo" | grep -q ".git"; then
|
|
39 # command="git"
|
|
40 # else
|
|
41 # command="hg"
|
|
42 # fi
|
|
43 # $command clone $repo
|
|
44 done
|
|
45
|
|
46 cd ..
|