# Script to correctly configure the tool set -xuve WORKING_DIR=$(readlink -f "`dirname \"$0\"`") function clean () { rm -f Makefile rm -f namelist_mpp } cd $WORKING_DIR # Check if binary is compiled, compile if not and exit if fails. # Try all the options if [ ! -f bin/mpp_domain_decomposition.exe ]; then for file in src/Makefiles/* ; do cp $file Makefile make && break done #[ 0 -eq $( bin/mpp_domain_decomposition.exe 2>&1 | grep -c "file.*namelist_mpp" ) ] && { echo "Not properly compiled, check libary paths and enviroment" 1>&2 && rm bin/mpp_domain_decomposition.exe && clean && exit 1 ;} [ ! -f bin/mpp_domain_decomposition.exe ] && { echo "No valid Makefile found in src/Makefiles/. Add one." 1>&2 && clean && exit 1 ;} fi clean #rm -f Makefile # Find if SCRIPTPATH is correctly set and modify it if not. [[ $(grep $WORKING_DIR ELPiNv2.cmd -c ) -ne 0 ]] || { cp ELPiNv2.cmd ELPiNv2.cmd_$(date +%d%m%Y-%H:%M)_backup && sed -i "s#SCRIPTPATH=.*#SCRIPTPATH=${WORKING_DIR}#g" ELPiNv2.cmd ; } # Link bathymetries ./src/link_bathymetries.sh &> /dev/null # Check if bathymetries are linked (only will happen in MN3) ls bathymetries/* &> /dev/null && echo "Configured!" || echo "Tool compiled but bathymetries not found" set +xuve