Configure 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # Script to correctly configure the tool
  2. set -xuve
  3. WORKING_DIR=$(readlink -f "`dirname \"$0\"`")
  4. function clean () {
  5. rm -f Makefile
  6. rm -f namelist_mpp
  7. }
  8. cd $WORKING_DIR
  9. # Check if binary is compiled, compile if not and exit if fails.
  10. # Try all the options
  11. if [ ! -f bin/mpp_domain_decomposition.exe ]; then
  12. for file in src/Makefiles/* ; do
  13. cp $file Makefile
  14. make && break
  15. done
  16. #[ 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 ;}
  17. [ ! -f bin/mpp_domain_decomposition.exe ] && { echo "No valid Makefile found in src/Makefiles/. Add one." 1>&2 && clean && exit 1 ;}
  18. fi
  19. clean
  20. #rm -f Makefile
  21. # Find if SCRIPTPATH is correctly set and modify it if not.
  22. [[ $(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 ; }
  23. # Link bathymetries
  24. ./src/link_bathymetries.sh &> /dev/null
  25. # Check if bathymetries are linked (only will happen in MN3)
  26. ls bathymetries/* &> /dev/null && echo "Configured!" || echo "Tool compiled but bathymetries not found"
  27. set +xuve