forked from fabric8-analytics/fabric8-analytics-deployment
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·60 lines (51 loc) · 1.32 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash -e
function print_help {
cat << \EOF
This script helps you with checking out all repositories for local development.
Usage: setup.sh [-h|--help] [-r|--remotes NAME] [repo] ...
Arguments:
-h|--help Print this help
-r|--remotes NAME Add remote "fork" ("NAME" is a GitHub user) to all repos
repo ... Work only on specified repositories
(works on all repositories by default)
EOF
}
repos=""
remotes=""
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-h|--help)
print_help
exit 0
;;
-r|--remotes)
remotes=$2
shift
;;
*)
repos="$key $repos"
;;
esac
shift
done
if [[ -z "$repos" ]]; then
repos="worker server jobs pgbouncer data-model"
fi
for repo in $repos; do
fullrepo=fabric8-analytics-${repo}
if ! `ls $fullrepo &>/dev/null`; then
git clone "[email protected]:fabric8-analytics/${fullrepo}.git"
fi
if [[ -n "$remotes" ]]; then
pushd $fullrepo &>/dev/null
if ! `git remote show | grep "^fork$" &>/dev/null`; then
git remote add fork "[email protected]:${remotes}/${fullrepo}.git"
fi
popd &>/dev/null
fi
done
echo "Setup done. To run the system locally, run:"
echo "docker-compose up"
echo "If you want to mount source code inside the containers, run:"
echo "./docker-compose.sh up"