install_steamcmd.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/bash
  2. # LGSM install_steamcmd.sh function
  3. # Author: Daniel Gibbs
  4. # Website: http://gameservermanagers.com
  5. lgsm_version="271215"
  6. # Description: Downloads SteamCMD on install.
  7. echo ""
  8. echo "Installing SteamCMD"
  9. echo "================================="
  10. sleep 1
  11. steamcmddir="${rootdir}/steamcmd"
  12. if [ ! -f "${steamcmddir}/steamcmd.sh" ]; then
  13. if [ ! -d "${steamcmddir}" ]; then
  14. mkdir -v "${steamcmddir}"
  15. fi
  16. curl=$(curl --fail -o "${steamcmddir}/steamcmd_linux.tar.gz" "http://media.steampowered.com/client/steamcmd_linux.tar.gz" 2>&1)
  17. exitcode=$?
  18. echo -e "downloading steamcmd_linux.tar.gz...\c"
  19. if [ $exitcode -eq 0 ]; then
  20. fn_printokeol
  21. else
  22. fn_printfaileol
  23. echo "${curl}"
  24. echo -e "${githuburl}\n"
  25. exit $exitcode
  26. fi
  27. tar --verbose -zxf "${steamcmddir}/steamcmd_linux.tar.gz" -C "${steamcmddir}"
  28. rm -v "${steamcmddir}/steamcmd_linux.tar.gz"
  29. chmod +x "${steamcmddir}/steamcmd.sh"
  30. else
  31. echo "SteamCMD already installed!"
  32. fi
  33. # Checks that steamcmd is working correctly and will prompt Steam Guard if required.
  34. "${steamcmddir}"/steamcmd.sh +login "${steamuser}" "${steampass}" +quit
  35. if [ $? -ne 0 ]; then
  36. fn_printfailurenl "Error running SteamCMD"
  37. fi
  38. sleep 1