-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall.sh
executable file
·153 lines (127 loc) · 3.92 KB
/
install.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
#!/bin/bash
# ReHLDS URL
rehlds_url="https://github.com/dreamstalker/rehlds/releases/download/3.13.0.788/rehlds-bin-3.13.0.788.zip"
# ReGameDLL URL
regamedll_url="https://github.com/s1lentq/ReGameDLL_CS/releases/download/5.26.0.668/regamedll-bin-5.26.0.668.zip"
# ReAPI URL
reapi_url="https://github.com/s1lentq/reapi/releases/download/5.24.0.300/reapi-bin-5.24.0.300.zip"
# Metamod URL
metamod_url="https://www.amxmodx.org/release/metamod-1.21.1-am.zip"
# Metamod-R URL
metamodr_url="https://github.com/theAsmodai/metamod-r/releases/download/1.3.0.149/metamod-bin-1.3.0.149.zip"
# AMXModX Base URL
amxmodx_base_url="https://www.amxmodx.org/amxxdrop/1.10/amxmodx-1.10.0-git5467-base-linux.tar.gz"
# AMXModX CStrike URL
amxmodx_cstrike_url="https://www.amxmodx.org/amxxdrop/1.10/amxmodx-1.10.0-git5467-cstrike-linux.tar.gz"
## Legacy GameDLL URL
legacy_gamedll_url="https://raw.githubusercontent.com/hollacs/CS-1.6-Server-Install/main/dlls/cs.so"
# Download folder name
downloaded_dir=".downloads"
# Max steamcmd download retries
max_retry=3
dest=${PWD}
rehlds=false
regamedll=false
for i in "$@"; do
case $i in
--rehlds)
rehlds=true
shift
;;
--regamedll)
rehlds=true
regamedll=true
shift
;;
-*|--*)
echo "Unknown option $i"
exit 1
;;
*)
;;
esac
done
if [ -n $1 ]; then
dest=$1
if [ "${dest%"${dest#?}"}" = "." ]; then
dest="${PWD}${dest#?}"
fi
fi
if [ -z $dest ]; then
dest="${PWD}${dest#?}"
fi
# download HLDS from steamcmd
echo "Downloading HLDS..."
retry=0
while [ $retry -lt $max_retry ]; do
if steamcmd +login anonymous +force_install_dir $dest +app_update 90 -beta steam_legacy validate +quit | grep -q 'Success'; then
echo "Downloaded!";
break;
fi
echo "Failed, Retrying...($retry/$max_retry)";
retry=$((retry + 1))
done
if [ $retry -ge $max_retry ]; then
echo "Failed to download HLDS from steamcmd."
exit 1
fi
cd $dest
mkdir $downloaded_dir
cd $downloaded_dir
# ReHLDS
if $rehlds; then
echo "Downloading ReHLDS..."
wget $rehlds_url
echo "Extracting ReHLDS..."
unzip rehlds-bin-*.zip 'bin/linux32/*' -d rehlds
cp -rf ./rehlds/bin/linux32/* ../
# Metamod-R
echo "Downloading Metamod-R..."
wget $metamodr_url
echo "Extracting Metamod-R..."
unzip metamod-bin-*.zip 'addons/*' -d metamod
mkdir -p ../cstrike/addons/metamod/dlls
cp -f ./metamod/addons/metamod/*.ini ../cstrike/addons/metamod
cp -f ./metamod/addons/metamod/*.so ../cstrike/addons/metamod/dlls
echo "Editing liblist.gam"
sed -i 's/gamedll_linux.*/gamedll_linux "addons\/metamod\/dlls\/metamod_i386.so"/' ../cstrike/liblist.gam
else
# Metamod
echo "Downloading Metamod..."
wget $metamod_url
echo "Extracting Metamod..."
unzip metamod-*-am.zip -d metamod
cp -rf ./metamod/addons ../cstrike
echo "Editing liblist.gam"
sed -i 's/gamedll_linux.*/gamedll_linux "addons\/metamod\/dlls\/metamod.so"/' ../cstrike/liblist.gam
fi
# ReGameDLL
if $regamedll; then
echo "Downloading ReGameDLL and ReAPI..."
wget $regamedll_url
wget $reapi_url
unzip regamedll-bin-*.zip 'bin/linux32/*' -d regamedll
unzip reapi-bin-*.zip -d ./regamedll/bin/linux32/cstrike
cp -rf ./regamedll/bin/linux32/cstrike ../
else
wget $legacy_gamedll_url
cp -f cs.so ../cstrike/dlls
fi
# AMXModX
echo "Downloading AMXModX..."
wget $amxmodx_base_url
wget $amxmodx_cstrike_url
echo "Extracting AMXModX..."
mkdir amxx
tar -zxf amxmodx-*-base-linux.tar.gz -C amxx
tar --overwrite -zxf amxmodx-*-cstrike-linux.tar.gz -C amxx
cp -rf ./amxx/addons ../cstrike
echo "Creating metamod/plugins.ini"
echo "linux addons/amxmodx/dlls/amxmodx_mm_i386.so" >> ../cstrike/addons/metamod/plugins.ini
# Mark executeable
chmod +x ../hlds_linux
# Clean up downloaded files
echo "Cleaning up..."
cd ..
rm -rf $downloaded_dir
echo "Done!"