command_validate.sh 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/bin/bash
  2. # LinuxGSM command_validate.sh function
  3. # Author: Daniel Gibbs
  4. # Website: https://gameservermanagers.com
  5. # Description: Runs a server validation.
  6. local commandname="VALIDATE"
  7. local commandaction="Validate"
  8. local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
  9. fn_validation(){
  10. appid="${1}"
  11. echo ""
  12. echo -e " * Validating may overwrite some customised files."
  13. echo -en " * https://developer.valvesoftware.com/wiki/SteamCMD#Validate"
  14. sleep 3
  15. echo -en "\n"
  16. fn_script_log_info "Validating files: SteamCMD"
  17. sleep 1
  18. cd "${rootdir}/steamcmd"
  19. # Detects if unbuffer command is available for 32 bit distributions only.
  20. info_distro.sh
  21. if [ $(command -v stdbuf) ]&&[ "${arch}" != "x86_64" ]; then
  22. unbuffer="stdbuf -i0 -o0 -e0"
  23. fi
  24. if [ "${engine}" == "goldsource" ]; then
  25. ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" ${branch} +app_update "${appid}" ${branch} validate +quit| tee -a "${scriptlog}"
  26. else
  27. ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" ${branch} validate +quit| tee -a "${scriptlog}"
  28. fi
  29. if [ $? != 0 ]; then
  30. fn_print_fail_nl "Validating files: SteamCMD"
  31. fn_script_log_fatal "Validating files: SteamCMD: FAIL"
  32. else
  33. fn_print_ok_nl "Validating files: SteamCMD"
  34. fn_script_log_pass "Validating files: SteamCMD: OK"
  35. fi
  36. fix.sh
  37. }
  38. fn_print_dots "Validating files:"
  39. sleep 0.5
  40. fn_print_dots "Validating files: SteamCMD"
  41. sleep 1
  42. check.sh
  43. check_status.sh
  44. if [ "${status}" != "0" ]; then
  45. exitbypass=1
  46. command_stop.sh
  47. fn_validation "${appid}"
  48. # will also check for second appid
  49. if [ "${gamename}" == "Classic Offensive" ]; then
  50. fn_validation "${appid_co}"
  51. fi
  52. exitbypass=1
  53. command_start.sh
  54. else
  55. fn_validation
  56. # will also check for second appid
  57. if [ "${gamename}" == "Classic Offensive" ]; then
  58. fn_validation "${appid_co}"
  59. fi
  60. fi
  61. core_exit.sh