-
Notifications
You must be signed in to change notification settings - Fork 83
/
hlds_run.sh
58 lines (43 loc) · 1.74 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/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}"
START_MONEY="${START_MONEY:-800}"
BUY_TIME="${BUY_TIME:-0.25}"
FRIENDLY_FIRE="${FRIENDLY_FIRE:-1}"
OPTIONS=( "-game" "${GAME}" "+maxplayers" "${MAXPLAYERS}" "+map" "${START_MAP}" "+hostname" "\"${SERVER_NAME}\"" "+mp_startmoney" "${START_MONEY}" "+mp_friendlyfire" "${FRIENDLY_FIRE}" "+mp_buytime" "${BUY_TIME}")
if [ -z "${RESTART_ON_FAIL}" ]; then
OPTIONS+=('-norestart')
fi
if [ -n "${SERVER_PASSWORD}" ]; then
OPTIONS+=("+sv_password" "${SERVER_PASSWORD}")
fi
if [ -n "${RCON_PASSWORD}" ]; then
OPTIONS+=("+rcon_password" "${RCON_PASSWORD}")
fi
if [ -n "${ADMIN_STEAM1}" ]; then
echo "\"STEAM_${ADMIN_STEAM1}\" \"\" \"abcdefghijklmnopqrstu\" \"ce\"" >> "/opt/hlds/cstrike/addons/amxmodx/configs/users.ini"
fi
if [ -n "${ADMIN_STEAM2}" ]; then
echo "\"STEAM_${ADMIN_STEAM2}\" \"\" \"abcdefghijklmnopqrstu\" \"ce\"" >> "/opt/hlds/cstrike/addons/amxmodx/configs/users.ini"
fi
if [ -n "${ADMIN_STEAM3}" ]; then
echo "\"STEAM_${ADMIN_STEAM3}\" \"\" \"abcdefghijklmnopqrstu\" \"ce\"" >> "/opt/hlds/cstrike/addons/amxmodx/configs/users.ini"
fi
if [ -n "${ADMIN_STEAM4}" ]; then
echo "\"STEAM_${ADMIN_STEAM4}\" \"\" \"abcdefghijklmnopqrstu\" \"ce\"" >> "/opt/hlds/cstrike/addons/amxmodx/configs/users.ini"
fi
set > "${CONFIG_FILE}"
exec "${EXECUTABLE}" "${OPTIONS[@]}" "${EXTRA_OPTIONS[@]}"