4
0

command_validate.sh 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 ""
  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. cd "${steamcmddir}" || exit
  17. # Detects if unbuffer command is available for 32 bit distributions only.
  18. info_distro.sh
  19. if [ "$(command -v stdbuf)" ]&&[ "${arch}" != "x86_64" ]; then
  20. unbuffer="stdbuf -i0 -o0 -e0"
  21. fi
  22. if [ "${appid}" == "90" ]; then
  23. ${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}"
  24. elif [ "${gamename}" == "Unturned" ]; then
  25. ${unbuffer} ./steamcmd.sh +@sSteamCmdForcePlatformBitness 32 +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" ${branch} validate +quit
  26. else
  27. ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" ${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