command_validate.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
  9. fn_validation(){
  10. fn_print_info "Validating files: SteamCMD"
  11. echo -e ""
  12. echo -e "* Validating may overwrite some customised files."
  13. echo -e "* https://docs.linuxgsm.com/commands/validate"
  14. fn_script_log_info "Validating files: SteamCMD"
  15. sleep 3
  16. if [ -d "${steamcmddir}" ]; then
  17. cd "${steamcmddir}" || exit
  18. fi
  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 [ "${appid}" == "90" ]; then
  25. ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_info_print 70 +app_set_config 90 mod "${appidmod}" +app_update "${appid}" "${branch}" +app_update "${appid}" -beta "${branch}" validate +quit | tee -a "${lgsmlog}"
  26. else
  27. ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" validate +quit | tee -a "${lgsmlog}"
  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. fn_print_dots "Validating files: SteamCMD"
  40. check.sh
  41. check_status.sh
  42. if [ "${status}" != "0" ]; then
  43. exitbypass=1
  44. command_stop.sh
  45. fn_validation "${appid}"
  46. exitbypass=1
  47. command_start.sh
  48. else
  49. fn_validation
  50. fi
  51. core_exit.sh