check_config.sh 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 [ "${shortname}" == "orar" ] && [ ! -d "${servercfgdir}" ]; then
  9. install_config.sh
  10. fi
  11. if [ -n "${servercfgfullpath}" ] && [ ! -f "${servercfgfullpath}" ]; then
  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. if [ "${shortname}" == "ti" ] && [[ "${startparameters}" != *"DedicatedServerClientId"* ]] && [ ! -f "${servercfgdir}/Engine.ini" ]; then
  19. fn_print_warn_nl "Configuration file missing!"
  20. echo -e "${servercfgdir}/Engine.ini"
  21. fn_script_log_warn "Configuration file missing!"
  22. fn_script_log_warn "${servercfgdir}/Engine.ini"
  23. install_config.sh
  24. fi
  25. if [ "${shortname}" == "rust" ] && [ -v rconpassword ] && [ -z "${rconpassword}" ]; then
  26. fn_print_fail_nl "RCON password is not set"
  27. fn_script_log_warn "RCON password is not set"
  28. elif [ -v rconpassword ] && [ "${rconpassword}" == "CHANGE_ME" ]; then
  29. fn_print_warn_nl "Default RCON password detected"
  30. fn_script_log_warn "Default RCON password detected"
  31. elif [ -v httppassword ] && [ "${httppassword}" == "CHANGE_ME" ]; then
  32. fn_print_warn_nl "Default Web password detected"
  33. fn_script_log_warn "Default Web password detected"
  34. elif [ -v adminpassword ] && [ "${adminpassword}" == "CHANGE_ME" ]; then
  35. fn_print_warn_nl "Default Admin password detected"
  36. fn_script_log_warn "Default Admin password detected"
  37. fi
  38. if [ "${shortname}" == "vh" ] && [ -z "${serverpassword}" ]; then
  39. fn_print_fail_nl "serverpassword is not set"
  40. fn_script_log_fail "serverpassword is not set"
  41. elif [ "${shortname}" == "vh" ] && [ "${#serverpassword}" -le "4" ]; then
  42. fn_print_fail_nl "serverpassword is to short (min 5 chars)"
  43. fn_script_log_fail "serverpassword is to short (min 5 chars)"
  44. fi