fix_steamcmd.sh 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #!/bin/bash
  2. # LinuxGSM fix_steamcmd.sh function
  3. # Author: Daniel Gibbs
  4. # Website: https://linuxgsm.com
  5. # Description: Resolves various issues related to SteamCMD.
  6. functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
  7. # function to simplify the steamclient.so fix
  8. # example
  9. # fn_fix_steamclient_so 32|64 (bit) "${serverfiles}/linux32/"
  10. fn_fix_steamclient_so(){
  11. # $1 type of fix 32 or 64 as possible values
  12. # $2 as destination where the lib will be copied to
  13. if [ "$1" == "32" ]; then
  14. # steamclient.so x86 fix.
  15. if [ ! -f "${2}/steamclient.so" ]; then
  16. fixname="steamclient.so x86"
  17. fn_fix_msg_start
  18. if [ ! -d "${2}" ]; then
  19. mkdir -p "${2}"
  20. fi
  21. if [ -f "${HOME}/.steam/steamcmd/linux32/steamclient.so" ]; then
  22. cp "${HOME}/.steam/steamcmd/linux32/steamclient.so" "${2}/steamclient.so"
  23. elif [ -f "${steamcmddir}/linux32/steamclient.so" ]; then
  24. cp "${steamcmddir}/linux32/steamclient.so" "${2}/steamclient.so"
  25. fi
  26. fn_fix_msg_end
  27. fi
  28. elif [ "$1" == "64" ]; then
  29. # steamclient.so x86_64 fix.
  30. if [ ! -f "${2}/steamclient.so" ]; then
  31. fixname="steamclient.so x86_64"
  32. fn_fix_msg_start
  33. if [ ! -d "${2}" ]; then
  34. mkdir -p "${2}"
  35. fi
  36. if [ -f "${HOME}/.steam/steamcmd/linux64/steamclient.so" ]; then
  37. cp "${HOME}/.steam/steamcmd/linux64/steamclient.so" "${2}/steamclient.so"
  38. elif [ -f "${steamcmddir}/linux64/steamclient.so" ]; then
  39. cp "${steamcmddir}/linux64/steamclient.so" "${2}/steamclient.so"
  40. fi
  41. fn_fix_msg_end
  42. fi
  43. fi
  44. }
  45. # Helps fix: [S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam,or a local steamclient.so.
  46. if [ ! -f "${HOME}/.steam/sdk64/steamclient.so" ]; then
  47. fixname="steamclient.so sdk64"
  48. fn_fix_msg_start
  49. mkdir -p "${HOME}/.steam/sdk64"
  50. if [ -f "${HOME}/.steam/steamcmd/linux64/steamclient.so" ]; then
  51. cp "${HOME}/.steam/steamcmd/linux64/steamclient.so" "${HOME}/.steam/sdk64/steamclient.so"
  52. elif [ -f "${steamcmddir}/linux64/steamclient.so" ]; then
  53. cp "${steamcmddir}/linux64/steamclient.so" "${HOME}/.steam/sdk64/steamclient.so"
  54. fi
  55. fn_fix_msg_end
  56. fi
  57. # Helps fix: [S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam,or a local steamclient.so.
  58. if [ ! -f "${HOME}/.steam/sdk32/steamclient.so" ]; then
  59. fixname="steamclient.so sdk32"
  60. fn_fix_msg_start
  61. mkdir -p "${HOME}/.steam/sdk32"
  62. if [ -f "${HOME}/.steam/steamcmd/linux32/steamclient.so" ]; then
  63. cp "${HOME}/.steam/steamcmd/linux32/steamclient.so" "${HOME}/.steam/sdk32/steamclient.so"
  64. elif [ -f "${steamcmddir}/linux32/steamclient.so" ]; then
  65. cp "${steamcmddir}/linux32/steamclient.so" "${HOME}/.steam/sdk32/steamclient.so"
  66. fi
  67. fn_fix_msg_end
  68. fi
  69. # steamclient.so fixes
  70. if [ "${shortname}" == "bo" ]; then
  71. fn_fix_steamclient_so "32" "${serverfiles}/BODS_Data/Plugins/x86"
  72. fn_fix_steamclient_so "64" "${serverfiles}/BODS_Data/Plugins/x86_64"
  73. elif [ "${shortname}" == "cmw" ]; then
  74. fn_fix_steamclient_so "32" "${executabledir}/lib"
  75. elif [ "${shortname}" == "cs" ]; then
  76. fn_fix_steamclient_so "32" "${serverfiles}"
  77. elif [ "${shortname}" == "col" ]; then
  78. fn_fix_steamclient_so "64" "${serverfiles}"
  79. elif [ "${shortname}" == "ins" ]; then
  80. fn_fix_steamclient_so "32" "${serverfiles}/bin"
  81. elif [ "${shortname}" == "pz" ]; then
  82. fn_fix_steamclient_so "32" "${serverfiles}/linux32"
  83. fn_fix_steamclient_so "64" "${serverfiles}/linux64"
  84. elif [ "${shortname}" == "pvr" ]; then
  85. fn_fix_steamclient_so "64" "${executabledir}"
  86. elif [ "${shortname}" == "ss3" ]; then
  87. fn_fix_steamclient_so "32" "${serverfiles}/Bin"
  88. elif [ "${shortname}" == "tu" ];then
  89. fn_fix_steamclient_so "64" "${executabledir}"
  90. elif [ "${shortname}" == "unt" ]; then
  91. fn_fix_steamclient_so "64" "${serverfiles}"
  92. elif [ "${shortname}" == "wurm" ]; then
  93. fn_fix_steamclient_so "64" "${serverfiles}/nativelibs"
  94. fi