install_gslt.sh 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/bash
  2. # LinuxGSM install_gslt.sh module
  3. # Author: Daniel Gibbs
  4. # Contributors: https://linuxgsm.com/contrib
  5. # Website: https://linuxgsm.com
  6. # Description: Configures GSLT.
  7. moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
  8. echo -e ""
  9. echo -e "${bold}${lightyellow}Game Server Login Token${default}"
  10. fn_messages_separator
  11. if [ "${shortname}" == "csgo" ] || [ "${shortname}" == "css" ] || [ "${shortname}" == "nmrih" ] || [ "${shortname}" == "bs" ]; then
  12. echo -e "GSLT is required to run a public ${gamename} server."
  13. fn_script_log_info "GSLT is required to run a public ${gamename} server"
  14. else
  15. echo -e "GSLT is an optional feature for ${gamename} server."
  16. fn_script_log_info "GSLT is an optional feature for ${gamename} server"
  17. fi
  18. if [ "${shortname}" == "csgo" ] && [ -n "${clientappid}" ]; then
  19. echo -e "The GSLT must be created using the App ID set in clientappid (${clientappid})."
  20. fn_script_log_info "The GSLT must be created using the App ID set in clientappid (${clientappid})"
  21. fi
  22. echo -e ""
  23. echo -e "More info: ${italic}https://docs.linuxgsm.com/steamcmd/gslt${default}"
  24. fn_script_log_info "More info: https://docs.linuxgsm.com/steamcmd/gslt"
  25. echo -e ""
  26. if [ -z "${autoinstall}" ]; then
  27. if [ "${shortname}" != "tu" ]; then
  28. echo -e "Enter token below (Can be blank)."
  29. echo -n "GSLT TOKEN: "
  30. read -r token
  31. if ! grep -q "^gslt=" "${configdirserver}/${selfname}.cfg" > /dev/null 2>&1; then
  32. echo -e "\ngslt=\"${token}\"" >> "${configdirserver}/${selfname}.cfg"
  33. else
  34. sed -i -e "s/gslt=\"[^\"]*\"/gslt=\"${token}\"/g" "${configdirserver}/${selfname}.cfg"
  35. fi
  36. fi
  37. fi
  38. if [ "${shortname}" == "tu" ]; then
  39. echo -e "The GSLT can be changed by editing: ${italic}${servercfgdir}/${servercfg}${default}"
  40. fn_script_log_info "The GSLT can be changed by editing: ${servercfgdir}/${servercfg}."
  41. else
  42. echo -e "The GSLT can be changed by editing: ${italic}${configdirserver}/${selfname}.cfg${default}"
  43. fn_script_log_info "The GSLT can be changed by editing: ${configdirserver}/${selfname}.cfg."
  44. fi
  45. fn_sleep_time_1