diff options
Diffstat (limited to 'bin/dev_tools/master_app.sh')
-rwxr-xr-x | bin/dev_tools/master_app.sh | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/bin/dev_tools/master_app.sh b/bin/dev_tools/master_app.sh new file mode 100755 index 00000000..4681e7fc --- /dev/null +++ b/bin/dev_tools/master_app.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# +# Set the master app by: +# (a) renaming the other master(s) datasource files +# (b) enabling the master datasource file +# + +master_app=$1 +if [ -z "$master_app" ] ; then + master_app="yp" +fi +if [ ! -d "./bin/$master_app" ] ; then + echo "ERROR: master app directory missing" + exit 1 +fi + +FS=$'\n' # make newlines the only separator +for p in $(find bin -name srtool_env.sh -exec grep -l "SRT_MAIN_APP" {} \;) ; do + if [ "${p}" != "${p/bin\/yp/}" ] ; then + # Always leave the 'yp' directory alone + continue + fi + echo "Check:$p" + ds_dir=$(dirname $p) + if [ "${p}" != "${p/bin\/$master_app/}" ] ; then + echo "SET_MASTER:$p" + mv $ds_dir/datasource.json_sample $ds_dir/datasource.json 2> /dev/null + else + echo "DISABLE_MASTER:$p" + mv $ds_dir/datasource.json $ds_dir/datasource.json_sample 2> /dev/null + fi +done + +if [ "yp" = "$master_app" ] ; then + echo "SET_MASTER:./bin/$master_app" +fi |