install_dst_token.sh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/bash
  2. # LinuxGSM install_dst_token.sh function
  3. # Author: Daniel Gibbs & Marvin Lehmann (marvinl97)
  4. # Website: https://gameservermanagers.com
  5. # Description: Configures Don't Starve Together cluster with given token.
  6. local commandname="INSTALL"
  7. local commandaction="Install"
  8. local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
  9. echo ""
  10. echo "Enter ${gamename} Cluster Token"
  11. echo "================================="
  12. sleep 1
  13. echo "A cluster token is required to run this server!"
  14. echo "Follow the instructions in this link to obtain this key:"
  15. echo "https://gameservermanagers.com/dst-auth-token"
  16. echo ""
  17. if [ -z "${autoinstall}" ]; then
  18. overwritetoken="true"
  19. if [ -s "${clustercfgdir}/cluster_token.txt" ]; then
  20. echo "The cluster token is already set. Do you want to overwrite it?"
  21. fn_script_log_info "Don't Starve Together cluster token is already set"
  22. if fn_prompt_yn "Continue?" N; then
  23. overwritetoken="true"
  24. else
  25. overwritetoken="false"
  26. fi
  27. fi
  28. if [ "${overwritetoken}" == "true" ]; then
  29. echo "Once you have the cluster token, enter it below"
  30. echo -n "Cluster Token: "
  31. read token
  32. mkdir -pv "${clustercfgdir}"
  33. echo "${token}" > "${clustercfgdir}/cluster_token.txt"
  34. if [ -f "${clustercfgdir}/cluster_token.txt" ]; then
  35. echo "Don't Starve Together cluster token created"
  36. fn_script_log_info "Don't Starve Together cluster token created"
  37. fi
  38. unset overwritetoken
  39. fi
  40. else
  41. echo "You can add your cluster token using the following command"
  42. echo "./${selfname} cluster-token"
  43. fi
  44. echo ""