fn_install_steamcmd 1.2 KB

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