fn_glibcfix 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #!/bin/bash
  2. # LGSM fn_glibcfix function
  3. # Author: Daniel Gibbs
  4. # Website: http://danielgibbs.co.uk
  5. # Version: 011214
  6. fn_glibcfixmsg(){
  7. echo "GLIBC Fix required"
  8. echo "============================"
  9. sleep 1
  10. echo -e "\e[0;31mWARNING!\e[0;39m ${gamename} requires GLIBC_${glibcversion} or above"
  11. sleep 1
  12. echo ""
  13. echo -e "Currently installed:\e[0;31m GLIBC_$(ldd --version |grep ldd|awk '{print $NF}')\e[0;39m"
  14. echo -e "Required: =>\e[0;32m GLIBC_${glibcversion}\e[0;39m"
  15. echo ""
  16. sleep 1
  17. echo "The installer will now detect and download the required files to allow ${gamename} server to run on a distro with less than GLIBC_${glibcversion}."
  18. echo "note: This will NOT upgrade GLIBC on your system."
  19. sleep 1
  20. echo ""
  21. echo "loading required files..."
  22. sleep 1
  23. }
  24. if [ -z $(command -v ldd) ]; then
  25. echo ""
  26. echo -e "\r\033[K\e[0;31mFAIL\e[0;39m GLIBC is not detected."
  27. sleep 1
  28. echo "Install GLIBC and retry installation"
  29. sleep 1
  30. echo ""
  31. while true; do
  32. read -p "Continue install? [y/N]" yn
  33. case $yn in
  34. [Yy]* ) break;;
  35. [Nn]* ) echo Exiting; exit;;
  36. * ) echo "Please answer yes or no.";;
  37. esac
  38. done
  39. elif [ "$(ldd --version | sed -n '1 p' | tr -cd [:digit:] | tail -c 3)" -lt 215 ]; then
  40. glibcversion="2.15"
  41. fn_glibcfixmsg
  42. # Blade Symphony
  43. if [ "${gamename}" == "Blade Symphony" ]; then
  44. cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/libstdc++.so.6"
  45. # Fistful of Frags
  46. elif [ "${gamename}" == "Fistful of Frags" ]; then
  47. cd "${filesdir}"
  48. wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/FistfulOfFrags/dependencies/libm.so.6
  49. # Garrys's Mod
  50. elif [ "${gamename}" == "Garrys's Mod" ]; then
  51. cd "${filesdir}/bin"
  52. wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/GarrysMod/dependencies/libc.so.6
  53. wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/GarrysMod/dependencies/libm.so.6
  54. wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/GarrysMod/dependencies/libpthread.so.0
  55. cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/libstdc++.so.6"
  56. # Insurgency
  57. elif [ "${gamename}" == "Insurgency" ]; then
  58. cd "${filesdir}/bin"
  59. wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/Insurgency/dependencies/libc.so.6
  60. wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/Insurgency/dependencies/librt.so.1
  61. wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/Insurgency/dependencies/libpthread.so.0
  62. # Natural Selection 2
  63. elif [ "${gamename}" == "Natural Selection 2" ]; then
  64. cd "${filesdir}"
  65. wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/NaturalSelection2/dependencies/libm.so.6
  66. cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/libstdc++.so.6"
  67. # No More Room in Hell
  68. elif [ "${gamename}" == "No More Room in Hell" ]; then
  69. cd "${filesdir}"
  70. wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/NoMoreRoomInHell/dependencies/libm.so.6
  71. cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/libstdc++.so.6"
  72. elif [ "$(ldd --version | sed -n '1 p' | tr -cd [:digit:] | tail -c 3)" -lt 213 ]; then
  73. glibcversion="2.13"
  74. fn_glibcfixmsg
  75. # ARMA 3
  76. if [ "${gamename}" == "ARMA 3" ]; then
  77. cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/libstdc++.so.6"
  78. # Just Cause 2
  79. elif [ "${gamename}" == "Just Cause 2" ]; then
  80. cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/libstdc++.so.6"
  81. else
  82. echo "error: Unable to detect game. Fix not applied"
  83. fi
  84. sleep 1
  85. echo ""
  86. echo "GLIBC fix has been applied!"
  87. sleep 1
  88. echo ""
  89. else
  90. echo "error: Unable to detect game. Fix not applied"
  91. fi
  92. sleep 1
  93. echo ""
  94. echo "GLIBC fix has been applied!"
  95. sleep 1
  96. echo ""
  97. fi