fix_steamcmd.sh 3.8 KB

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