-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathbootstrap
executable file
·42 lines (31 loc) · 962 Bytes
/
bootstrap
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
#!/usr/bin/env bash
set -e
log() {
local msg="$1"
echo "[BOOTSTRAP]==> $msg"
}
prefix=$(dirname $0)
. ${prefix}/includes
root=$(dirname $(dirname $0))
deproot=${1:-"${modulesPrefix}"}
pom="$root/pom.xml"
repos=$(grep '<!-- GIT ' $pom | sed -e 's/.*GIT \([^[:space:]]\{1,\}\).*/\1/g')
for repo_and_tag in $repos; do
repo=$(echo $repo_and_tag | cut -d '=' -f 1)
rev=$(echo $repo_and_tag | cut -d '=' -f 2)
dir=$(basename $repo .git)
if [ -z "$rev" -o "$rev" = "$repo" ]; then
log "WARNING: No rev given in '$repo_and_tag', using default: master"
rev="master"
fi
if [ -d "$root/$deproot/$dir" ]; then
log "Updating repository: $repo"
(cd "$root/$deproot/$dir" && git checkout master && git fetch --all --tags && git pull origin master)
else
log "Cloning repository: $repo"
git clone $repo "$root/$deproot/$dir"
fi
log "Checkout revision: $rev in $repo"
(cd "$root/$deproot/$dir" && git checkout -f -B build-$rev $rev)
done
exit 0