install_gslt.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. echo -e ""
  19. echo -e "More info: ${italic}https://docs.linuxgsm.com/steamcmd/gslt${default}"
  20. fn_script_log_info "More info: https://docs.linuxgsm.com/steamcmd/gslt"
  21. echo -e ""
  22. if [ -z "${autoinstall}" ]; then
  23. if [ "${shortname}" != "tu" ]; then
  24. echo -e "Enter token below (Can be blank)."
  25. echo -n "GSLT TOKEN: "
  26. read -r token
  27. if ! grep -q "^gslt=" "${configdirserver}/${selfname}.cfg" > /dev/null 2>&1; then
  28. echo -e "\ngslt=\"${token}\"" >> "${configdirserver}/${selfname}.cfg"
  29. else
  30. sed -i -e "s/gslt=\"[^\"]*\"/gslt=\"${token}\"/g" "${configdirserver}/${selfname}.cfg"
  31. fi
  32. fi
  33. fi
  34. if [ "${shortname}" == "tu" ]; then
  35. echo -e "The GSLT can be changed by editing: ${italic}${servercfgdir}/${servercfg}${default}"
  36. fn_script_log_info "The GSLT can be changed by editing: ${servercfgdir}/${servercfg}."
  37. else
  38. echo -e "The GSLT can be changed by editing: ${italic}${configdirserver}/${selfname}.cfg${default}"
  39. fn_script_log_info "The GSLT can be changed by editing: ${configdirserver}/${selfname}.cfg."
  40. fi
  41. fn_sleep_time_1