-
-
Notifications
You must be signed in to change notification settings - Fork 859
Expand file tree
/
Copy pathfix_steamcmd.sh
More file actions
executable file
·160 lines (152 loc) · 6.1 KB
/
fix_steamcmd.sh
File metadata and controls
executable file
·160 lines (152 loc) · 6.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#!/bin/bash
# LinuxGSM fix_steamcmd.sh module
# Author: Daniel Gibbs
# Contributors: https://linuxgsm.com/contrib
# Website: https://linuxgsm.com
# Description: Resolves issues with SteamCMD.
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
# function to simplify the steamclient.so fix
# example
# fn_fix_steamclient_so 32|64 (bit) "${serverfiles}/linux32/"
fn_fix_steamclient_so() {
# $1 type of fix 32 or 64 as possible values
# $2 as destination where the lib will be copied to
if [ "$1" == "32" ]; then
# steamclient.so x86 fix.
if [ ! -f "${2}/steamclient.so" ]; then
fixname="steamclient.so x86"
fn_fix_msg_start
if [ ! -d "${2}" ]; then
mkdir -p "${2}"
fi
if [ -f "${HOME}/.steam/steamcmd/linux32/steamclient.so" ]; then
cp "${HOME}/.steam/steamcmd/linux32/steamclient.so" "${2}/steamclient.so"
elif [ -f "${steamcmddir}/linux32/steamclient.so" ]; then
cp "${steamcmddir}/linux32/steamclient.so" "${2}/steamclient.so"
elif [ -f "${HOME}/.local/share/Steam/steamcmd/linux32/steamclient.so" ]; then
cp "${HOME}/.local/share/Steam/steamcmd/linux32/steamclient.so" "${2}/steamclient.so"
fi
fn_fix_msg_end
fi
elif [ "$1" == "64" ]; then
# steamclient.so x86_64 fix.
if [ ! -f "${2}/steamclient.so" ]; then
fixname="steamclient.so x86_64"
fn_fix_msg_start
if [ ! -d "${2}" ]; then
mkdir -p "${2}"
fi
if [ -f "${HOME}/.steam/steamcmd/linux64/steamclient.so" ]; then
cp "${HOME}/.steam/steamcmd/linux64/steamclient.so" "${2}/steamclient.so"
elif [ -f "${steamcmddir}/linux64/steamclient.so" ]; then
cp "${steamcmddir}/linux64/steamclient.so" "${2}/steamclient.so"
elif [ -f "${HOME}/.local/share/Steam/steamcmd/linux64/steamclient.so" ]; then
cp "${HOME}/.local/share/Steam/steamcmd/linux64/steamclient.so" "${2}/steamclient.so"
fi
fn_fix_msg_end
fi
fi
}
# Helps fix: [S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam,or a local steamclient.so.
steamsdk64="${HOME}/.steam/sdk64"
steamclientsdk64="${steamsdk64}/steamclient.so"
# remove any old unlinked versions of steamclient.so
if [ -f "${steamclientsdk64}" ]; then
if [ "$(stat -c '%h' "${steamclientsdk64}")" -eq 1 ]; then
fixname="steamclient.so sdk64 - remove old file"
fn_fix_msg_start
rm -f "${steamclientsdk64}"
fn_fix_msg_end
fi
fi
# place new hardlink for the file to the disk
if [ ! -f "${steamclientsdk64}" ]; then
fixname="steamclient.so sdk64 hardlink"
fn_fix_msg_start
if [ ! -d "${steamsdk64}" ]; then
mkdir -p "${steamsdk64}"
fi
if [ -f "${HOME}/.steam/steamcmd/linux64/steamclient.so" ]; then
ln "${HOME}/.steam/steamcmd/linux64/steamclient.so" "${steamclientsdk64}"
elif [ -f "${steamcmddir}/linux64/steamclient.so" ]; then
ln "${steamcmddir}/linux64/steamclient.so" "${steamclientsdk64}"
elif [ -f "${HOME}/.local/share/Steam/steamcmd/linux64/steamclient.so" ]; then
ln "${HOME}/.local/share/Steam/steamcmd/linux64/steamclient.so" "${steamclientsdk64}"
else
fn_print_fail_nl "Could not copy any steamclient.so 64bit for the gameserver"
fi
fn_fix_msg_end
fi
# Helps fix: [S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam,or a local steamclient.so.
steamsdk32="${HOME}/.steam/sdk32"
steamclientsdk32="${HOME}/.steam/sdk32/steamclient.so"
if [ -f "${steamclientsdk32}" ]; then
if [ " $(stat -c '%h' "${steamclientsdk32}")" -eq 1 ]; then
fixname="steamclient.so sdk32 - remove old file"
fn_fix_msg_start
rm -f "${steamclientsdk32}"
fn_fix_msg_end
fi
fi
# place new hardlink for the file to the disk
if [ ! -f "${steamclientsdk32}" ]; then
fixname="steamclient.so sdk32 link"
fn_fix_msg_start
if [ ! -d "${steamsdk32}" ]; then
mkdir -p "${steamsdk32}"
fi
if [ -f "${HOME}/.steam/steamcmd/linux32/steamclient.so" ]; then
ln "${HOME}/.steam/steamcmd/linux32/steamclient.so" "${steamclientsdk32}"
elif [ -f "${steamcmddir}/linux32/steamclient.so" ]; then
ln "${steamcmddir}/linux32/steamclient.so" "${steamclientsdk32}"
elif [ -f "${HOME}/.local/share/Steam/steamcmd/linux32/steamclient.so" ]; then
ln "${HOME}/.local/share/Steam/steamcmd/linux32/steamclient.so" "${steamclientsdk32}"
else
fn_print_fail_nl "Could not copy any steamclient.so 32bit for the gameserver"
fi
fn_fix_msg_end
fi
# Helps fix: WARNING: Failed to load 32-bit libtinfo.so.5 or libncurses.so.5.
# On distros that ship libtinfo.so.6 (e.g. Ubuntu 22.04+, Debian 12+) but not
# libtinfo.so.5, SteamCMD prints this warning and loses readline support.
# Creating a symlink from .so.5 -> .so.6 resolves the warning without root.
libtinfo32dir="${HOME}/.steam/steamcmd"
libtinfo32so="${libtinfo32dir}/libtinfo.so.5"
if [ ! -f "${libtinfo32so}" ] && [ ! -L "${libtinfo32so}" ]; then
# Find the .so.6 in the system 32-bit lib paths
for libtinfo32so6 in /lib/i386-linux-gnu/libtinfo.so.6 /usr/lib/i386-linux-gnu/libtinfo.so.6 /lib32/libtinfo.so.6; do
if [ -f "${libtinfo32so6}" ]; then
fixname="libtinfo.so.5 32-bit symlink"
fn_fix_msg_start
ln -sf "${libtinfo32so6}" "${libtinfo32so}"
fn_fix_msg_end
break
fi
done
fi
# steamclient.so fixes
if [ "${shortname}" == "bo" ]; then
fn_fix_steamclient_so "32" "${serverfiles}/BODS_Data/Plugins/x86"
fn_fix_steamclient_so "64" "${serverfiles}/BODS_Data/Plugins/x86_64"
elif [ "${shortname}" == "cmw" ]; then
fn_fix_steamclient_so "32" "${executabledir}/lib"
elif [ "${shortname}" == "cs" ]; then
fn_fix_steamclient_so "32" "${serverfiles}"
elif [ "${shortname}" == "col" ]; then
fn_fix_steamclient_so "64" "${serverfiles}"
elif [ "${shortname}" == "ins" ]; then
fn_fix_steamclient_so "32" "${serverfiles}/bin"
elif [ "${shortname}" == "pz" ]; then
fn_fix_steamclient_so "32" "${serverfiles}/linux32"
fn_fix_steamclient_so "64" "${serverfiles}/linux64"
elif [ "${shortname}" == "pvr" ]; then
fn_fix_steamclient_so "64" "${executabledir}"
elif [ "${shortname}" == "ss3" ]; then
fn_fix_steamclient_so "32" "${serverfiles}/Bin"
elif [ "${shortname}" == "tu" ]; then
fn_fix_steamclient_so "64" "${executabledir}"
elif [ "${shortname}" == "unt" ]; then
fn_fix_steamclient_so "64" "${serverfiles}"
elif [ "${shortname}" == "wurm" ]; then
fn_fix_steamclient_so "64" "${serverfiles}/nativelibs"
fi