check_config.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  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. functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
  8. if [ -n "${servercfgfullpath}" ] && [ ! -f "${servercfgfullpath}" ]; then
  9. fn_print_dots ""
  10. fn_print_warn_nl "Configuration file missing!"
  11. echo -e "${servercfgfullpath}"
  12. fn_script_log_warn "Configuration file missing!"
  13. fn_script_log_warn "${servercfgfullpath}"
  14. install_config.sh
  15. fi
  16. if [ "${shortname}" == "rust" ] && [ -v rconpassword ] && [ -z "${rconpassword}" ]; then
  17. fn_print_dots ""
  18. fn_print_fail_nl "RCON password is not set"
  19. fn_script_log_warn "RCON password is not set"
  20. elif [ -v rconpassword ] && [ "${rconpassword}" == "CHANGE_ME" ]; then
  21. fn_print_dots ""
  22. fn_print_warn_nl "Default RCON Password detected"
  23. fn_script_log_warn "Default RCON Password detected"
  24. fi
  25. if [ "${shortname}" == "vh" ] && [ -z "${serverpassword}" ]; then
  26. fn_print_fail_nl "serverpassword is not set"
  27. fn_script_log_fatal "serverpassword is not set"
  28. elif [ "${shortname}" == "vh" ] && [ "${#serverpassword}" -le "4" ]; then
  29. fn_print_fail_nl "serverpassword is to short (min 5 chars)"
  30. fn_script_log_fatal "serverpassword is to short (min 5 chars)"
  31. fi