#!/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 -f $ds_dir/datasource.json_sample $ds_dir/datasource.json 2> /dev/null else echo "DISABLE_MASTER:$p" mv -f $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