forked from OpenACD/OpenACD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhooks.sh
executable file
·79 lines (70 loc) · 1.49 KB
/
hooks.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env bash
BASEDIR="$( cd "$( dirname "$0" )" && pwd)"
REBAR="$BASEDIR/rebar"
function pre_compile {
ebinDir="$BASEDIR/ebin"
if [ ! -d "$ebinDir" ]; then
mkdir "$ebinDir"
fi
# record what commit/version openacd is at
OPENACD_COMMIT=""
if [ -d ".git" ]
then
OPENACD_COMMIT=`git log -1 --pretty=format:%H`
fi
if [ -e "include/commit_ver.hrl" ] && [ ! $OPENACD_COMMIT ]
then
exit 0
else
if [ ! $OPENACD_COMMIT ]
then
OPENACD_COMMIT="undefined"
else
OPENACD_COMMIT="\"$OPENACD_COMMIT\""
fi
fi
echo "%% automatically generated by OpenACD precompile script. Editing means
%% it will just get overwritten again.
-define(OPENACD_COMMIT, $OPENACD_COMMIT)." > include/commit_ver.hrl
}
function pre_get-deps {
if [ "${GIT_UPDATE_DISABLED}" != "1" ]; then
echo "Updating submodules..."
cd "$BASEDIR"
git submodule init && git submodule update
cd -
fi
}
function pre_generate {
# hack for reltool
oaDir="$BASEDIR/OpenACD"
if [ ! -d "$oaDir" ]; then
mkdir "$oaDir"
ln -sf ../ebin "$oaDir"/ebin
ln -sf ../src "$oaDir"/src
ln -sf ../include "$oaDir"/include
ln -sf ../priv "$oaDir"/priv
ln -sf ../deps "$oaDir"/deps
fi
}
function post_generate {
rm -rf "$BASEDIR/OpenACD"
}
case "$1" in
"pre_get-deps")
pre_get-deps;;
"post_get-deps")
post_get-deps;;
"pre_compile")
pre_compile;;
"post_compile")
post_compile;;
"pre_clean")
pre_clean;;
"post_clean")
post_clean;;
"pre_generate")
pre_generate;;
"post_generate")
post_generate;;
esac