command_validate.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. 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 [ "${appid}" == "90" ]; 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. elif [ "${gamename}" == "Unturned" ]; then
  26. ${unbuffer} /steamcmd.sh +@sSteamCmdForcePlatformBitness 32 +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" ${branch} validate +quit
  27. else
  28. ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" ${branch} validate +quit | tee -a "${lgsmlog}"
  29. fi
  30. if [ $? != 0 ]; then
  31. fn_print_fail_nl "Validating files: SteamCMD"
  32. fn_script_log_fatal "Validating files: SteamCMD: FAIL"
  33. else
  34. fn_print_ok_nl "Validating files: SteamCMD"
  35. fn_script_log_pass "Validating files: SteamCMD: OK"
  36. fi
  37. fix.sh
  38. }
  39. fn_print_dots "Validating files:"
  40. sleep 0.5
  41. fn_print_dots "Validating files: SteamCMD"
  42. sleep 0.5
  43. check.sh
  44. check_status.sh
  45. if [ "${status}" != "0" ]; then
  46. exitbypass=1
  47. command_stop.sh
  48. fn_validation "${appid}"
  49. exitbypass=1
  50. command_start.sh
  51. else
  52. fn_validation
  53. fi
  54. core_exit.sh