fn_check_steamcmd 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash
  2. # LGSM fn_check_steamcmd function
  3. # Author: Daniel Gibbs
  4. # Website: http://gameservermanagers.com
  5. lgsm_version="061115"
  6. # Description: Downloads SteamCMD on install and checks if missing before running functions that require SteamCMD
  7. if [ "${gamename}" == "Unreal Tournament 99" ]||[ "${gamename}" == "Unreal Tournament 2004" ]; then
  8. : # These servers do not require SteamCMD. Check is skipped.
  9. elif [ "${modulename}" == "Starting" ]||[ "${modulename}" == "Update" ]; then
  10. # Checks if SteamCMD exists when starting or updating a server.
  11. # Re-installs if missing.
  12. steamcmddir="${rootdir}/steamcmd"
  13. if [ ! -f "${steamcmddir}/steamcmd.sh" ]; then
  14. fn_printwarnnl "SteamCMD is missing"
  15. fn_scriptlog "SteamCMD is missing"
  16. sleep 1
  17. if [ ! -d "${steamcmddir}" ]; then
  18. mkdir -v "${steamcmddir}"
  19. fi
  20. curl=$(curl --fail -o "${steamcmddir}/steamcmd_linux.tar.gz" "http://media.steampowered.com/client/steamcmd_linux.tar.gz" 2>&1)
  21. exitcode=$?
  22. echo -e "downloading steamcmd_linux.tar.gz...\c"
  23. if [ $exitcode -eq 0 ]; then
  24. fn_printokeol
  25. else
  26. fn_printfaileol
  27. echo "${curl}"
  28. echo -e "${githuburl}\n"
  29. exit $exitcode
  30. fi
  31. tar --verbose -zxf "${steamcmddir}/steamcmd_linux.tar.gz" -C "${steamcmddir}"
  32. rm -v "${steamcmddir}/steamcmd_linux.tar.gz"
  33. chmod +x "${steamcmddir}/steamcmd.sh"
  34. fi
  35. fi