check_glibc.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash
  2. # LGSM check_glibc.sh function
  3. # Author: Daniel Gibbs
  4. # Website: https://gameservermanagers.com
  5. # Description: Checks if server has correct glibc or has a fix available.
  6. local commandnane="CHECK"
  7. local commandaction="Checking"
  8. # Cannot have selfname as breaks the function.
  9. #local selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
  10. info_glibc.sh
  11. info_distro.sh
  12. if [ "${glibcrequired}" == "NOT REQUIRED" ]; then
  13. :
  14. elif [ "${glibcrequired}" == "UNKNOWN" ]; then
  15. fn_print_info_nl "Glibc fix: \e[0;31m${glibcrequired}\e[0m"
  16. echo -e " * glibc required: \e[0;31m${glibcrequired}\e[0m"
  17. echo -e " * glibc installed: ${glibcversion}"
  18. elif [ "$(printf '%s\n'${glibcrequired}'\n' ${glibcversion} | sort -V | head -n 1)" != "${glibcrequired}" ]; then
  19. if [ "${glibcfix}" == "yes" ]; then
  20. if [ "${selfname}" != "command_install.sh" ]; then
  21. fn_print_info_nl "Glibc fix: \e[0;32mUsing Glibc fix\e[0m"
  22. echo -e " * glibc required: \e[0;31m${glibcrequired}\e[0m"
  23. echo -e " * glibc installed: ${glibcversion}"
  24. fix_glibc.sh
  25. fi
  26. else
  27. fn_print_warn_nl "Glibc fix: \e[0;31mNo Glibc fix available!\e[0m"
  28. echo -en "\n"
  29. echo -e " * glibc required: ${glibcrequired}"
  30. echo -e " * glibc installed: \e[0;31m${glibcversion}\e[0m"
  31. echo -en "\n"
  32. fn_print_infomation "The game server will probably not work. A distro upgrade is required!"
  33. sleep 5
  34. fi
  35. fi