forked from ge-semtk/semtk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configWebapps.sh
executable file
·39 lines (32 loc) · 1006 Bytes
/
configWebapps.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
#!/bin/bash
#
# must be run from current folder
#
# Stop if any command goes bad
set -e
if [ "$#" -ne 1 ] && [ "$#" -ne 2 ] && [ "$#" -ne 4 ]; then
echo "Usage: ${BASH_SOURCE[0]} webapps_path [filter [search replace]]"
exit 1
fi
# Get args
WEBAPPS="$1"
OPT_VARNAME_FILTER="${2:-^WEB_}"
OPT_VARNAME_SEARCH="$3"
OPT_VARNAME_REPLACE="$4"
if [ ! -d "${WEBAPPS}" ]; then
echo "WEBAPPS is not a valid directory: ${WEBAPPS}"
exit 1
fi
. ./.fun
# define array of versioned files
declare -a VERSIONED=("sparqlGraph/main-oss/sparqlgraphconfigOss.js"
"sparqlGraph/main-oss/KDLEasyLoggerConfigOss.js"
"sparqlForm/main-oss/sparqlformconfig.js"
"sparqlForm/main-oss/KDLEasyLoggerConfig.js")
# replace versioned files
for v in "${VERSIONED[@]}"
do
echo ${v}
cp "./sparqlGraphWeb/${v}" "${WEBAPPS}/${v}"
replace_vars_in_file "${WEBAPPS}/${v}" "${OPT_VARNAME_FILTER}" "${OPT_VARNAME_SEARCH}" "${OPT_VARNAME_REPLACE}"
done