check_glibc.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. # Cannot have selfname as breaks the function.
  8. #local selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
  9. info_glibc.sh
  10. info_distro.sh
  11. if [ "${glibcrequired}" == "NOT REQUIRED" ]; then
  12. :
  13. elif [ "${glibcrequired}" == "UNKNOWN" ]; then
  14. fn_print_error_nl "Glibc fix: ${red}${glibcrequired}${default}"
  15. echo -e " * glibc required: ${red}${glibcrequired}${default}"
  16. echo -e " * glibc installed: ${glibcversion}"
  17. elif [ "$(printf '%s\n'${glibcrequired}'\n' ${glibcversion} | sort -V | head -n 1)" != "${glibcrequired}" ]; then
  18. if [ "${glibcfix}" == "yes" ]; then
  19. if [ "${selfname}" != "command_install.sh" ]; then
  20. fn_print_info_nl "Glibc fix: ${green}Using Glibc fix${default}"
  21. echo -e " * glibc required: ${red}${glibcrequired}${default}"
  22. echo -e " * glibc installed: ${glibcversion}"
  23. fix_glibc.sh
  24. fi
  25. else
  26. fn_print_error_nl "Glibc fix: ${red}No Glibc fix available!${default}"
  27. echo -en "\n"
  28. echo -e " * glibc required: ${glibcrequired}"
  29. echo -e " * glibc installed: ${red}${glibcversion}${default}"
  30. echo -en "\n"
  31. fn_print_infomation "The game server will probably not work. A distro upgrade is required!"
  32. sleep 5
  33. fi
  34. fi