forked from mvlm/counter-strike-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hlds_run.sh
executable file
·41 lines (31 loc) · 1.01 KB
/
hlds_run.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
#!/usr/bin/env bash
set -axe
CONFIG_FILE="/opt/hlds/startup.cfg"
if [ -r "${CONFIG_FILE}" ]; then
# TODO: make config save/restore mechanism more solid
set +e
# shellcheck source=/dev/null
source "${CONFIG_FILE}"
set -e
fi
EXTRA_OPTIONS=( "$@" )
EXECUTABLE="/opt/hlds/hlds_run"
GAME="${GAME:-cstrike}"
MAXPLAYERS="${MAXPLAYERS:-32}"
START_MAP="${START_MAP:-de_dust2}"
SERVER_NAME="${SERVER_NAME:-Counter-Strike 1.6 Server}"
if [ "${HLTV}" == "true" ]; then
EXECUTABLE="/opt/hlds/hltv"
OPTIONS=( "+connect" "${HLTV_SERVER}" "-port" "${HLTV_PORT}")
else
OPTIONS=( "-game" "${GAME}" "+maxplayers" "${MAXPLAYERS}" "+map" "${START_MAP}" "+hostname" "\"${SERVER_NAME}\"")
fi
if [ -z "${RESTART_ON_FAIL}" ]; then
OPTIONS+=('-norestart')
fi
for ADMIN_STEAM in ${STEAM_ADMINS}
do
echo "\"STEAM_${ADMIN_STEAM}\" \"\" \"abcdefghijklmnopqrstu\" \"ce\"" >> "/opt/hlds/cstrike/addons/amxmodx/configs/users.ini"
done
set > "${CONFIG_FILE}"
exec "${EXECUTABLE}" "${OPTIONS[@]}" "${EXTRA_OPTIONS[@]}"