command_validate.sh 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. 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 0.5
  18. cd "${steamcmddir}" || exit
  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 "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" ${branch} +app_update "${appid}" ${branch} validate +quit | tee -a "${lgsmlog}"
  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. sleep 0.5
  40. fn_print_dots "Validating files: SteamCMD"
  41. sleep 0.5
  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