check_config.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/bash
  2. # LinuxGSM check_config.sh function
  3. # Author: Daniel Gibbs
  4. # Website: https://linuxgsm.com
  5. # Description: Checks if the server config is missing and warns the user if needed.
  6. local modulename="CHECK"
  7. local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
  8. servercfgfullpath="${servercfgdir}/${servercfg}"
  9. if [ ! -f "${servercfgfullpath}" ]; then
  10. if [ "${shortname}" != "hw" ]&&[ "${shortname}" != "ut3" ]&&[ "${shortname}" != "kf2" ]; then
  11. fn_print_dots ""
  12. fn_print_warn_nl "Configuration file missing!"
  13. echo -e "${servercfgfullpath}"
  14. fn_script_log_warn "Configuration file missing!"
  15. fn_script_log_warn "${servercfgfullpath}"
  16. install_config.sh
  17. fi
  18. fi
  19. if [ "${shortname}" == "rust" ]; then
  20. if [ -z "${rconpassword}" ]; then
  21. fn_print_dots ""
  22. fn_print_fail_nl "RCON password is not set!"
  23. echo -e " * Not setting an RCON password causes issues with ${gamename}"
  24. fn_script_log_fatal "RCON password is not set"
  25. fn_script_log_fatal "Not setting an RCON password causes issues with ${gamename}"
  26. core_exit.sh
  27. elif [ "${rconpassword}" == "CHANGE_ME" ]; then
  28. fn_print_dots ""
  29. fn_print_warn_nl "Default RCON Password detected!"
  30. echo -e " * Having ${rconpassword} as a password is not very safe."
  31. fn_script_log_warn "Default RCON Password detected"
  32. fi
  33. fi