-
Notifications
You must be signed in to change notification settings - Fork 62
/
env_cfg
29 lines (26 loc) · 1.02 KB
/
env_cfg
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
# Read and/or guess Erjang settings
PROP_FILE="$ERJANG_DIR/erjang_cfg.properties"
if [ -r "$PROP_FILE" ] ; then
shopt -s extglob # Used for trimming
# Parse properties file:
while s=""; read s || [ -n "$s" ] ; do
if [[ "$s" == "#"* ]] ; then continue; fi # Comment line
if [[ "$s" != *"="* ]] ; then continue; fi # No '='
propname=${s%%=*} ; propname=${propname%%*([[:space:]])}
propvalue=${s#*=} ; propvalue=${propvalue##*([[:space:]])}
# Set variable if it has the right prefix:
if [[ "$propname" == "erjang."* ]] ; then
varname=${propname//./_}
declare "$varname"="$propvalue"
fi
done < "$PROP_FILE"
fi
## For listing parsed property names:
# echo "${!erjang*}"
ERL_ROOT=${erjang_otp_root:-/usr/lib/erlang}
if [ -r "$ERL_ROOT/releases/start_erl.data" ] ; then
ERTS_VSN_GUESS=$(awk '{print $1}' "$ERL_ROOT/releases/start_erl.data")
OTP_VSN_GUESS=$(awk '{print $2}' "$ERL_ROOT/releases/start_erl.data")
fi
ERTS_VSN=${erjang_erts_version:-$ERTS_VSN_GUESS}
OTP_VSN=${erjang_otp_version:-$OTP_VSN_GUESS}