forked from artem-panchenko/counter-strike-docker
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhlds_run.sh
executable file
·37 lines (27 loc) · 960 Bytes
/
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
#!/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:-valve}"
MAXPLAYERS="${MAXPLAYERS:-5}"
START_MAP="${START_MAP:-bounce}"
SERVER_NAME="${SERVER_NAME:-'Half-Life 1.6 Server'}"
INSECURE="${INSECURE:-}"
NOMASTERS="${NOMASTERS:-}"
OPTIONS=( "-game" "${GAME}" "+maxplayers" "${MAXPLAYERS}" "+map" "${START_MAP}" "+hostname" "\"${SERVER_NAME}\"" "${INSECURE}" "${NOMASTERS}")
if [ -z "${RESTART_ON_FAIL}" ]; then
OPTIONS+=('-norestart')
fi
if [ -n "${ADMIN_NAME}" ]; then
echo "\"${ADMIN_NAME}\" \"${ADMIN_PASS}\" \"abcdefghijklmnopqrstu\" \"a\"" >> "/opt/hlds/valve/addons/amxmodx/configs/users.ini"
fi
set > "${CONFIG_FILE}"
exec "${EXECUTABLE}" "${OPTIONS[@]}" "${EXTRA_OPTIONS[@]}"