fn_glibcfix 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #!/bin/bash
  2. # LGSM fn_glibcfix function
  3. # Author: Daniel Gibbs
  4. # Website: http://danielgibbs.co.uk
  5. # Version: 171214
  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 ldd command not detected
  25. if [ -z $(command -v ldd) ]; then
  26. echo ""
  27. echo -e "\r\033[K\e[0;31mFAIL\e[0;39m GLIBC is not detected."
  28. sleep 1
  29. echo "Install GLIBC and retry installation"
  30. sleep 1
  31. echo ""
  32. while true; do
  33. read -p "Continue install? [y/N]" yn
  34. case $yn in
  35. [Yy]* ) break;;
  36. [Nn]* ) echo Exiting; exit;;
  37. * ) echo "Please answer yes or no.";;
  38. esac
  39. done
  40. # if Glibc less than 1.15
  41. elif [ "$(ldd --version | sed -n '1 p' | tr -cd [:digit:] | tail -c 3)" -lt 215 ]; then
  42. # Blade Symphony
  43. if [ "${gamename}" == "Blade Symphony" ]; then
  44. glibcversion="2.15"
  45. fn_glibcfixmsg
  46. cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/libstdc++.so.6"
  47. # Fistful of Frags
  48. elif [ "${gamename}" == "Fistful of Frags" ]; then
  49. glibcversion="2.15"
  50. fn_glibcfixmsg
  51. cd "${filesdir}"
  52. wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/FistfulOfFrags/dependencies/libm.so.6
  53. # Garrys's Mod
  54. elif [ "${gamename}" == "Garrys's Mod" ]; then
  55. glibcversion="2.15"
  56. fn_glibcfixmsg
  57. cd "${filesdir}/bin"
  58. wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/GarrysMod/dependencies/libc.so.6
  59. wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/GarrysMod/dependencies/libm.so.6
  60. wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/GarrysMod/dependencies/libpthread.so.0
  61. cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/libstdc++.so.6"
  62. # Insurgency
  63. elif [ "${gamename}" == "Insurgency" ]; then
  64. glibcversion="2.15"
  65. fn_glibcfixmsg
  66. cd "${filesdir}/bin"
  67. wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/Insurgency/dependencies/libc.so.6
  68. wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/Insurgency/dependencies/librt.so.1
  69. wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/Insurgency/dependencies/libpthread.so.0
  70. # Natural Selection 2
  71. elif [ "${gamename}" == "Natural Selection 2" ]; then
  72. glibcversion="2.15"
  73. fn_glibcfixmsg
  74. cd "${filesdir}"
  75. wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/NaturalSelection2/dependencies/libm.so.6
  76. cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/libstdc++.so.6"
  77. # No More Room in Hell
  78. elif [ "${gamename}" == "No More Room in Hell" ]; then
  79. glibcversion="2.15"
  80. fn_glibcfixmsg
  81. cd "${filesdir}"
  82. wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/NoMoreRoomInHell/dependencies/libm.so.6
  83. cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/libstdc++.so.6"
  84. # if Glibc less than 1.13
  85. elif [ "$(ldd --version | sed -n '1 p' | tr -cd [:digit:] | tail -c 3)" -lt 213 ]; then
  86. # ARMA 3
  87. if [ "${gamename}" == "ARMA 3" ]; then
  88. glibcversion="2.13"
  89. fn_glibcfixmsg
  90. cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/libstdc++.so.6"
  91. # Just Cause 2
  92. elif [ "${gamename}" == "Just Cause 2" ]; then
  93. glibcversion="2.13"
  94. fn_glibcfixmsg
  95. cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/libstdc++.so.6"
  96. # Serious Sam 3: BFE
  97. elif [ "${gamename}" == "Serious Sam 3: BFE" ]; then
  98. glibcversion="2.13"
  99. fn_glibcfixmsg
  100. cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/Bin/libstdc++.so.6"
  101. else
  102. echo "error: Unable to detect game. Fix not applied"
  103. fi
  104. else
  105. echo "error: Unable to detect game. Fix not applied"
  106. fi
  107. fi
  108. sleep 1
  109. echo ""