check_config.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/bash
  2. # LinuxGSM check_config.sh module
  3. # Author: Daniel Gibbs
  4. # Contributors: http://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}" == "rust" ] && [ -v rconpassword ] && [ -z "${rconpassword}" ]; then
  16. fn_print_fail_nl "RCON password is not set"
  17. fn_script_log_warn "RCON password is not set"
  18. elif [ -v rconpassword ] && [ "${rconpassword}" == "CHANGE_ME" ]; then
  19. fn_print_warn_nl "Default RCON Password detected"
  20. fn_script_log_warn "Default RCON Password detected"
  21. fi
  22. if [ "${shortname}" == "vh" ] && [ -z "${serverpassword}" ]; then
  23. fn_print_fail_nl "serverpassword is not set"
  24. fn_script_log_fail "serverpassword is not set"
  25. elif [ "${shortname}" == "vh" ] && [ "${#serverpassword}" -le "4" ]; then
  26. fn_print_fail_nl "serverpassword is to short (min 5 chars)"
  27. fn_script_log_fail "serverpassword is to short (min 5 chars)"
  28. fi