-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathinstallcss.sh
254 lines (212 loc) · 9.94 KB
/
installcss.sh
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
#!/usr/bin/env bash
# This script was built using Debian 11 OpenVZ server
# This script will download and install Steam Server, Sourcemod, Metamod, and compile and install War3Source-EVO for CSS
# You should install using a SUDO USER and not root user for security purposes.
# SUDO is needed for apt-get install and for getting the public ip address for this server via ifconfig.
# CSS - 232330
# CSGO - 740
# FOF - 295230
# TF2 - 232250
# L4D - 222840
# L4D2 - 222860
serverAPPid="232330"
gamePath1="css"
gamePath2="cstrike"
RNAME="hlserver"
# Game switcher for War3Source-EVO compiling
# either CSS or CSGO or TF2 or FOF
GAME_SWITCHER="CSS"
# example /home/steamgameserver
# CPATH actually will install in what ever directory you start this script in,
# not really your home path, otherwise you can change $PWD to $HOME
# if you prefer the home path.
CPATH=$PWD
# spaceREQ
# CSGO 35
# TF2 10
# CSS 3
# FOF 4
spaceREQ=3
HDspace=$(df --output=avail -h ${CPATH} | sed '1d;s/[^0-9]//g')
if [[ $HDspace -le $spaceREQ ]]; then
echo "You will need at least ${spaceREQ}GB of hard drive space before installing ${GAME_SWITCHER}!"
echo "You only have ${HDspace}GB hard drive free space on ${CPATH}"
df -h
exit
fi
# example /home/steamgameserver/hlserver
installPath="$CPATH/$RNAME"
# example /home/steamgameserver/hlserver/steamcmd/css.txt
steamcmdFile="${installPath}/steamcmd/${gamePath1}.txt"
# example /home/steamgameserver/hlserver/css
gameInstallPath="${installPath}/${gamePath1}"
# example /home/steamgameserver/hlserver/css/cstrike
SourceMetaModWar3InstallPath="${gameInstallPath}/${gamePath2}"
echo '*************************************************************************'
echo '*'
echo '* STEAMCMD / METAMOD / SOURCEMOD / WAR3SOURCE-EVO INSTALLER'
echo '*'
echo 'SUDO user is required to install libraries needed'
echo 'for SteamCMD, SourceMod, MetaMod, and to compile War3Source'
echo
echo 'Know that installing this as root is a security risk! SUDO user is HIGHLY RECOMMENDED!'
echo 'Know that installing this as root is a security risk! SUDO user is HIGHLY RECOMMENDED!'
echo 'Know that installing this as root is a security risk! SUDO user is HIGHLY RECOMMENDED!'
echo
echo 'You will need to type in your password, even if your not root to exit on some systems. ctrl+c does not always exit.'
echo
read -p "[${GAME_SWITCHER}] Press ENTER to continue" readTMP
echo
sudo apt-get update
sudo dpkg --add-architecture i386
sudo apt-get install wget
sudo apt-get install git
sudo apt-get install tar
sudo apt-get install screen
sudo apt-get install nano
sudo apt-get install lib32gcc1
sudo apt-get install lib32gcc-s1
sudo apt-get install lib32stdc++6
sudo apt-get install libc6-i386
sudo apt-get install linux-libc-dev:i386
#
# You may need these libraries for your linux server
# Uncomment if you want to see if they help you install or run the steam server
#
#sudo apt-get install clang
#sudo apt-get install lib32z1
#sudo apt-get install libbz2-1.0:i386
#sudo apt-get install libncurses5:i386
#sudo apt-get install libtinfo5:i386
#sudo apt-get install libcurl3-gnutls:i386
#sudo apt-get install libsdl2-2.0-0:i386
#sudo apt-get install libc6-dev-i386
echo
echo 'Some systems may complain about not see all files for apt-get,'
echo 'try to install anyhow, your system may not need them.'
echo
echo 'Just hit enter key for defaults, unless you want to change them.'
echo 'Defaults will be surrounded by () unless it says (required)'
echo
echo 'What directory would you like to install in?'
echo
read -p "[${GAME_SWITCHER}] Install Directory ($installPath)" readInstallPath
if [[ "$readInstallPath" ]]; then
$installPath = $readInstallPath
fi
echo
echo "SteamCMD Directory is ${installPath}"
echo "${GAME_SWITCHER} Game Directory is ${gameInstallPath}"
echo "Sourcemod/MetaMod/War3Source Directory is ${SourceMetaModWar3InstallPath}"
echo
echo
# Create directories
test -e "${installPath}" || mkdir "${installPath}"
test -e "${installPath}/steamcmd" || mkdir "${installPath}/steamcmd"
test -e "${gameInstallPath}" || mkdir "${gameInstallPath}"
test -e "${SourceMetaModWar3InstallPath}" || mkdir "${SourceMetaModWar3InstallPath}"
# uncomment below if you want to stop at this point
#read -p "Press ENTER to continue" readTMP
# Download and Extract SteamCMD
test -e "steamcmd_linux.tar.gz" || wget "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" -O steamcmd_linux.tar.gz
tar -zxvf steamcmd_linux.tar.gz --directory "${installPath}"
# Create SteamCMD Script file
echo "force_install_dir ${gameInstallPath}" > "${steamcmdFile}"
echo "login anonymous" >> "${steamcmdFile}"
echo "app_update ${serverAPPid}" >> "${steamcmdFile}"
echo "quit" >> "${steamcmdFile}"
# Give Permissions
SCRIPT_PATH="${installPath}/steamcmd.sh"
chmod a+x "${SCRIPT_PATH}"
# RUN steamCMD installer
SCRIPT_RUN="${SCRIPT_PATH} +runscript ${steamcmdFile}"
bash -c "${SCRIPT_RUN}"
# uncomment below if you want to stop at this point
#read -p "Press ENTER to continue" readTMP
# git clone War3Source
git clone https://github.com/War3Evo/War3Source-EVO.git
cp -vrf ./War3Source-EVO/cfg "${SourceMetaModWar3InstallPath}"
# uncomment below if you want to stop at this point
#read -p "Press ENTER to continue" readTMP
cp -vrf ./War3Source-EVO/addons "${SourceMetaModWar3InstallPath}"
# uncomment below if you want to stop at this point
#read -p "Press ENTER to continue" readTMP
cp -vrf ./War3Source-EVO/sound "${SourceMetaModWar3InstallPath}"
rm -rf ./War3Source-EVO
# uncomment below if you want to stop at this point
#read -p "Press ENTER to continue" readTMP
# Get SourceMod Required to compile War3Source-EVO
wget "http://www.sourcemod.net/latest.php?version=1.9&os=linux" -O "${SourceMetaModWar3InstallPath}/sourcemod-1.9-linux.tar.gz"
tar -zxvf "${SourceMetaModWar3InstallPath}/sourcemod-1.9-linux.tar.gz" --directory "${SourceMetaModWar3InstallPath}"
# uncomment below if you want to stop at this point
#read -p "Press ENTER to continue" readTMP
# Extract SourceMod as List
tar --list -f "${SourceMetaModWar3InstallPath}/sourcemod-1.9-linux.tar.gz" > "${SourceMetaModWar3InstallPath}/smlist19.txt"
# uncomment below if you want to stop at this point
#read -p "Press ENTER to continue" readTMP
#
# COMPILE WAR3SOURCE-EVO
#
# Give spcomp the required permissions
chmod a+x "${SourceMetaModWar3InstallPath}/addons/sourcemod/scripting/spcomp_1.9.0.6261"
chmod a+x "${SourceMetaModWar3InstallPath}/addons/sourcemod/scripting/game_switcher_${GAME_SWITCHER}.sh"
chmod a+x "${SourceMetaModWar3InstallPath}/addons/sourcemod/scripting/compile_for_github_action.sh"
bash -c "${SourceMetaModWar3InstallPath}/addons/sourcemod/scripting/game_switcher_${GAME_SWITCHER}.sh"
bash -c "${SourceMetaModWar3InstallPath}/addons/sourcemod/scripting/compile_for_github_action.sh" || true
# uncomment below if you want to stop at this point
#read -p "Press ENTER to continue" readTMP
# Clean up & Remove SM 1.9
xargs rm -f < "${SourceMetaModWar3InstallPath}/smlist19.txt" || true
rm -rf ./War3Source-EVO
rm -rf .github
rm -rf .git
# uncomment below if you want to stop at this point
#read -p "BEFORE SOURCMOE 1.11 ** Press ENTER to continue" readTMP
# Download SourceMod
test -e "sourcemod-1.11-linux.tar.gz" || wget "http://www.sourcemod.net/latest.php?version=1.11&os=linux" -O sourcemod-1.11-linux.tar.gz
# Extract SourceMod
tar -zxvf sourcemod-1.11-linux.tar.gz --directory "${SourceMetaModWar3InstallPath}"
# uncomment below if you want to stop at this point
#read -p "Press ENTER to continue" readTMP
# Download MetaMod
test -e "metamod-1.11-linux.tar.gz" || wget "https://www.metamodsource.net/latest.php?version=1.11&os=linux" -O metamod-1.11-linux.tar.gz
# Extract Metamod
tar --overwrite -zxvf metamod-1.11-linux.tar.gz --directory "${SourceMetaModWar3InstallPath}"
# Steam Account ID
echo "You can get your ${GAME_SWITCHER} Steam Game Server Account from here:"
echo "https://steamcommunity.com/dev/managegameservers"
read -p "[${GAME_SWITCHER}] Please enter Steam Game Server Account (required):" readSteamAccount
publicIPaddress=$(sudo ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1');
read -p "[${GAME_SWITCHER}] Server IP Address (${publicIPaddress}):" readServerIPAddress
read -p "[${GAME_SWITCHER}] Server Port (27015):" readServerPort
ServerIP=$publicIPaddress
if [[ "$readServerIPAddress" ]]; then
$ServerIP=$readServerIPAddress
fi
ServerPort=27015
if [[ "$readServerPort" ]]; then
$ServerPort=$readServerPort
fi
if [[ "$readSteamAccount" ]]; then
echo "screen -mS css ${gameInstallPath}/srcds_run -game cstrike -secure -console -usercon +map de_dust +ip ${ServerIP} +port ${ServerPort} -autoupdate +sv_consistency 0 +sv_pure 0 +map de_dust2 +maxplayers 32 +exec server.cfg +sv_setsteamaccount ${readSteamAccount} -steam_dir ${installPath} -steamcmd_script ${steamcmdFile}" > "${installPath}/start${GAME_SWITCHER}.sh"
chmod a+x "${installPath}/start${GAME_SWITCHER}.sh"
echo "*******************************************************************"
echo "${installPath}/start${GAME_SWITCHER}.sh has been created for you:"
cat "${installPath}/start${GAME_SWITCHER}.sh"
echo "*******************************************************************"
echo "*******************************************************************"
echo "[READ EVERYTHING FIRST]"
echo "Then to run server type this below and press enter:"
echo "${installPath}/start${GAME_SWITCHER}.sh"
echo "*******************************************************************"
echo "*******************************************************************"
echo "ctrl + a then press d to leave server running in the background"
echo "to resume the server that is in background type: screen -r"
echo "*******************************************************************"
echo "ctrl + c to exit screen & terminate server."
echo "Best Results: Type in quit and then press enter, before using ctrl + c."
echo "*******************************************************************"
fi
echo DONE
echo FINISHED
echo COMPLETED