forked from holatuwol/liferay-faster-deploy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
repopass
executable file
·42 lines (32 loc) · 1.31 KB
/
repopass
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
#!/bin/bash
repopass() {
# Make sure the repository password is up to date
local LOCAL_BRANCH=
if [ -f "$GIT_ROOT/build.properties" ]; then
LOCAL_BRANCH=$(grep -F git.working.branch.name= "$GIT_ROOT/build.properties" | cut -d'=' -f 2)
elif [ -f "$GIT_ROOT/working.dir.properties" ]; then
ant -f build-working-dir.xml
LOCAL_BRANCH=$(grep -F git.working.branch.name= "$GIT_ROOT/build.properties" | cut -d'=' -f 2)
else
return 0
fi
if [ "" == "$LOCAL_BRANCH" ] || [ "ee-7.0.x" == "$LOCAL_BRANCH" ]; then
LOCAL_BRANCH=7.0.x
fi
local UPSTREAM_BRANCH=$(git for-each-ref --format='%(refname)' refs/remotes/ | grep "/upstream[^/]*/$LOCAL_BRANCH-private$" | cut -d'/' -f 3,4)
if [ "" == "$UPSTREAM_BRANCH" ]; then
return 0
fi
if [ ! -f "$GIT_ROOT/build.$USER.properties" ]; then
python $(dirname ${BASH_SOURCE[0]})/repopass.py ${UPSTREAM_BRANCH} > "$GIT_ROOT/build.$USER.properties"
else
mv "$GIT_ROOT/build.$USER.properties" "$GIT_ROOT/build.$USER.properties.bak"
grep -vF build.repository.private. "$GIT_ROOT/build.$USER.properties.bak" > "$GIT_ROOT/build.$USER.properties"
rm "$GIT_ROOT/build.$USER.properties.bak"
python $(dirname ${BASH_SOURCE[0]})/repopass.py ${UPSTREAM_BRANCH} >> "$GIT_ROOT/build.$USER.properties"
fi
}
setopts() {
. $(dirname "${BASH_SOURCE[0]}")/setopts
}
setopts && repopass