command_validate.sh 2.0 KB

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