check_config.sh 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/bash
  2. # LinuxGSM check_config.sh module
  3. # Author: Daniel Gibbs
  4. # Contributors: https://linuxgsm.com/contrib
  5. # Website: https://linuxgsm.com
  6. # Description: Checks if the server config is missing and warns the user if needed.
  7. moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
  8. if [ -n "${servercfgfullpath}" ] && [ ! -f "${servercfgfullpath}" ]; then
  9. fn_print_warn_nl "Configuration file missing!"
  10. echo -e "${servercfgfullpath}"
  11. fn_script_log_warn "Configuration file missing!"
  12. fn_script_log_warn "${servercfgfullpath}"
  13. install_config.sh
  14. fi
  15. if [ "${shortname}" == "ti" ] && [[ "${startparameters}" != *"DedicatedServerClientId"* ]] && [ ! -f "${servercfgdir}/Engine.ini" ]; then
  16. fn_print_warn_nl "Configuration file missing!"
  17. echo -e "${servercfgdir}/Engine.ini"
  18. fn_script_log_warn "Configuration file missing!"
  19. fn_script_log_warn "${servercfgdir}/Engine.ini"
  20. install_config.sh
  21. fi
  22. if [ "${shortname}" == "rust" ] && [ -v rconpassword ] && [ -z "${rconpassword}" ]; then
  23. fn_print_fail_nl "RCON password is not set"
  24. fn_script_log_warn "RCON password is not set"
  25. elif [ -v rconpassword ] && [ "${rconpassword}" == "CHANGE_ME" ]; then
  26. fn_print_warn_nl "Default RCON password detected"
  27. fn_script_log_warn "Default RCON password detected"
  28. elif [ -v httppassword ] && [ "${httppassword}" == "CHANGE_ME" ]; then
  29. fn_print_warn_nl "Default Web password detected"
  30. fn_script_log_warn "Default Web password detected"
  31. elif [ -v adminpassword ] && [ "${adminpassword}" == "CHANGE_ME" ]; then
  32. fn_print_warn_nl "Default Admin password detected"
  33. fn_script_log_warn "Default Admin password detected"
  34. fi
  35. if [ "${shortname}" == "vh" ] && [ -z "${serverpassword}" ]; then
  36. fn_print_fail_nl "serverpassword is not set"
  37. fn_script_log_fail "serverpassword is not set"
  38. elif [ "${shortname}" == "vh" ] && [ "${#serverpassword}" -le "4" ]; then
  39. fn_print_fail_nl "serverpassword is to short (min 5 chars)"
  40. fn_script_log_fail "serverpassword is to short (min 5 chars)"
  41. fi