install_gslt.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/bash
  2. # LinuxGSM install_gslt.sh function
  3. # Author: Daniel Gibbs
  4. # Website: https://linuxgsm.com
  5. # Description: Configures GSLT.
  6. local commandname="INSTALL"
  7. local commandaction="Install"
  8. local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
  9. echo -e ""
  10. echo -e "${lightyellow}Game Server Login Token${default}"
  11. echo -e "================================="
  12. fn_sleep_time
  13. if [ "${shortname}" == "csgo" ]||[ "${shortname}" == "css" ]||[ "${shortname}" == "nmrih" ]||[ "${shortname}" == "bs" ]; then
  14. echo -e "GSLT is required to run a public ${gamename} server"
  15. fn_script_log_info "GSLT is required to run a public ${gamename} server"
  16. else
  17. echo -e "GSLT is an optional feature for ${gamename} server"
  18. fn_script_log_info "GSLT is an optional feature for ${gamename} server"
  19. fi
  20. echo -e "Get more info and a token here:"
  21. echo -e "https://docs.linuxgsm.com/steamcmd/gslt"
  22. fn_script_log_info "Get more info and a token here:"
  23. fn_script_log_info "https://docs.linuxgsm.com/steamcmd/gslt"
  24. echo -e ""
  25. if [ -z "${autoinstall}" ]; then
  26. if [ "${shortname}" != "tu" ]; then
  27. echo -e "Enter token below (Can be blank)."
  28. echo -n "GSLT TOKEN: "
  29. read -r token
  30. if ! grep -q "^gslt=" "${configdirserver}/${selfname}.cfg" > /dev/null 2>&1; then
  31. echo -e "\ngslt=\"${token}\"" >> "${configdirserver}/${selfname}.cfg"
  32. else
  33. sed -i -e "s/gslt=\"[^\"]*\"/gslt=\"${token}\"/g" "${configdirserver}/${selfname}.cfg"
  34. fi
  35. fi
  36. fi
  37. fn_sleep_time
  38. if [ "${shortname}" == "tu" ]; then
  39. echo -e "The GSLT can be changed by editing ${servercfgdir}/${servercfg}."
  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 ${configdirserver}/${selfname}.cfg."
  43. fn_script_log_info "The GSLT can be changed by editing ${configdirserver}/${selfname}.cfg."
  44. fi
  45. echo -e ""