check_config.sh 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  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 commandname="CHECK"
  7. local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
  8. if [ ! -e "${servercfgfullpath}" ]; then
  9. if [ "${shortname}" != "hw" ]&&[ "${shortname}" != "ut3" ]&&[ "${shortname}" != "kf2" ]; then
  10. fn_print_dots ""
  11. fn_print_warn_nl "Configuration file missing!"
  12. echo -e "${servercfgfullpath}"
  13. fn_script_log_warn "Configuration file missing!"
  14. fn_script_log_warn "${servercfgfullpath}"
  15. install_config.sh
  16. fi
  17. fi
  18. if [ "${shortname}" == "rust" ]; then
  19. if [ -z "${rconpassword}" ]; then
  20. fn_print_dots ""
  21. fn_print_fail_nl "RCON password is not set!"
  22. echo -e " * Not setting an RCON password causes issues with ${gamename}"
  23. fn_script_log_fatal "RCON password is not set"
  24. fn_script_log_fatal "Not setting an RCON password causes issues with ${gamename}"
  25. core_exit.sh
  26. elif [ "${rconpassword}" == "CHANGE_ME" ]; then
  27. fn_print_dots ""
  28. fn_print_warn_nl "Default RCON Password detected!"
  29. echo -e " * Having ${rconpassword} as a password is not very safe."
  30. fn_script_log_warn "Default RCON Password detected"
  31. fi
  32. fi