forked from kudelskisecurity/scannerl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·19 lines (19 loc) · 1.12 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh
if [ $(dpkg-query -W -f='${Status}' erlang 2> /dev/null | grep -c "ok installed") -eq 0 ]; then
echo "Install erlang"
elif [ $(erl -eval 'erlang:display(list_to_integer(erlang:system_info(otp_release))), halt().' -noshell) -lt 18 ]; then
echo "Your erlang version is too old, you should update it"
elif [ $(dpkg-query -W -f='${Status}' erlang-src 2> /dev/null | grep -c "ok installed") -eq 0 ]; then
echo "Install erlang-src"
elif hash rebar 2>/dev/null; then
# Updating fpmodules list
for i in `ls -1 ./src/fpmodules -I fp_module.erl`; do x="${i%.*erl}"; echo $x | sed 's/^fp_//g'; done | tr '\n' ',' | sed 's/^/\-define(FP_MODULES_LIST, [/' | sed 's/,$/])./' > ./src/includes/fpmodules.hrl
# Updating outmodules list
for i in `ls -1 ./src/outmodules -I out_behavior.erl`; do x="${i%.*erl}"; echo $x | sed 's/^out_//g'; done | tr '\n' ',' | sed 's/^/\-define(OUT_MODULES_LIST, [/' | sed 's/,$/])./' > ./src/includes/outmodules.hrl
# update git hash
echo "-define(GIT_SHORT_HASH, \"`git rev-parse --short HEAD`\")." > ./src/includes/githash.hrl
# Compile
rebar compile escriptize
else
echo "Install rebar"
fi