command_update_functions.sh 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/bash
  2. # LinuxGSM command_update_functions.sh function
  3. # Author: Daniel Gibbs
  4. # Website: https://gameservermanagers.com
  5. # Description: Deletes the functions dir to allow re-downloading of functions from GitHub.
  6. local commandname="UPDATE LinuxGSM"
  7. local commandaction="Update LinuxGSM"
  8. local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
  9. fn_print_dots "Updating functions"
  10. sleep 1
  11. check.sh
  12. fn_script_log_info "Updating functions"
  13. echo -ne "\n"
  14. echo -ne " checking _default.cfg...\c"
  15. function_file_diff=$(diff "${configdirdefault}/config-lgsm/${servername}/_default.cfg" <(${curlpath} -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/config-default/config-lgsm/${servername}/_default.cfg"))
  16. if [ "${function_file_diff}" != "" ]; then
  17. fn_print_update_eol_nl
  18. fn_script_log_info "checking ${functionfile}: UPDATE"
  19. rm -rf "${configdirdefault}/config-lgsm/${servername}/_default.cfg"
  20. fn_fetch_config "lgsm/config-default/config-lgsm/${servername}" "_default.cfg" "${configdirdefault}/config-lgsm/${servername}" "_default.cfg" "noexecutecmd" "norun" "noforce" "nomd5"
  21. else
  22. fn_print_ok_eol_nl
  23. fi
  24. if [ -n "${functionsdir}" ]; then
  25. if [ -d "${functionsdir}" ]; then
  26. cd "${functionsdir}"
  27. for functionfile in *
  28. do
  29. echo -ne " checking ${functionfile}...\c"
  30. function_file_diff=$(diff "${functionsdir}/${functionfile}" <(${curlpath} -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${functionfile}"))
  31. if [ "${function_file_diff}" != "" ]; then
  32. fn_print_update_eol_nl
  33. fn_script_log_info "checking ${functionfile}: UPDATE"
  34. rm -rf "${functionsdir}/${functionfile}"
  35. fn_update_function
  36. else
  37. fn_print_ok_eol_nl
  38. fi
  39. done
  40. fi
  41. fi
  42. if [ "${exitcode}" != "0" ]&&[ -n "${exitcode}" ]; then
  43. fn_print_fail "Updating functions"
  44. fn_script_log_fatal "Updating functions"
  45. else
  46. fn_print_ok "Updating functions"
  47. fn_script_log_pass "Updating functions"
  48. fi
  49. echo -ne "\n"
  50. core_exit.sh