fn_steaminstall 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/bash
  2. # LGSM fn_steaminstall function
  3. # Author: Daniel Gibbs
  4. # Website: http://danielgibbs.co.uk
  5. # Version: 060115
  6. fn_steaminstallcommand(){
  7. counter="0"
  8. while [ "${counter}" == "0" ]||[ "$(grep -wc 0x402 .fn_steaminstall.tmp)" -ge "1" ]||[ "$(grep -wc 0x406 .fn_steaminstall.tmp)" -ge "1" ]||[ "$(grep -wc 0x6 .fn_steaminstall.tmp)" -ge "1" ]||[ "$(grep -wc 0x106 .fn_steaminstall.tmp)" -ge "1" ]; do
  9. counter=$((counter+1))
  10. if [ "${counter}" -le "10" ]; then
  11. if [ "${counter}" -ge "2" ]; then
  12. fn_printwarningnl "SteamCMD did not complete the download, retrying: Attempt ${counter}"
  13. fi
  14. ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" +quit |tee .fn_steaminstall.tmp
  15. elif [ "${counter}" -ge "11" ]; then
  16. fn_printfailurenl "SteamCMD did not complete the download, too many retrys"
  17. break
  18. fi
  19. echo "0x402" > .fn_steaminstall.tmp
  20. done
  21. rm -f .fn_steaminstall.tmp
  22. }
  23. echo ""
  24. echo "Installing ${gamename} Server"
  25. echo "================================="
  26. sleep 1
  27. mkdir -pv "${filesdir}"
  28. cd "${rootdir}/steamcmd"
  29. fn_steaminstallcommand
  30. if [ -z "${autoinstall}" ]; then
  31. echo ""
  32. echo "================================="
  33. while true; do
  34. read -p "Was the install successful? [y/N]" yn
  35. case $yn in
  36. [Yy]* ) break;;
  37. [Nn]* ) fn_retryinstall;;
  38. * ) echo "Please answer yes or no.";;
  39. esac
  40. done
  41. fi