2025-07-31 18:13:22 +10:00

51 lines
2.4 KiB
Bash
Executable File

#!/bin/bash
set -eux
# Are we in a metamod container and is the metamod folder missing?
if [ ! -z "$METAMOD_VERSION" ] && [ ! -d "${STEAMAPPDIR}/${STEAMAPP}/addons/metamod" ]; then
LATESTMM=$(wget -qO- https://mms.alliedmods.net/mmsdrop/"${METAMOD_VERSION}"/mmsource-latest-linux)
wget -qO- https://mms.alliedmods.net/mmsdrop/"${METAMOD_VERSION}"/"${LATESTMM}" | tar xvzf - -C "${STEAMAPPDIR}/${STEAMAPP}"
fi
# Are we in a sourcemod container and is the sourcemod folder missing?
if [ ! -z "$SOURCEMOD_VERSION" ] && [ ! -d "${STEAMAPPDIR}/${STEAMAPP}/addons/sourcemod" ]; then
LATESTSM=$(wget -qO- https://sm.alliedmods.net/smdrop/"${SOURCEMOD_VERSION}"/sourcemod-latest-linux)
wget -qO- https://sm.alliedmods.net/smdrop/"${SOURCEMOD_VERSION}"/"${LATESTSM}" | tar xvzf - -C "${STEAMAPPDIR}/${STEAMAPP}"
fi
# Is the config missing?
if [ -f "${STEAMAPPDIR}/${STEAMAPP}/cfg/server.cfg" ]; then
# Change hostname on first launch (you can comment this out if it has done its purpose)
sed -i -e 's/{{SERVER_HOSTNAME}}/'"${SRCDS_HOSTNAME}"'/g' "${STEAMAPPDIR}/${STEAMAPP}/cfg/server.cfg"
fi
# Believe it or not, if you don't do this srcds_run shits itself
cd "${STEAMAPPDIR}"
SERVER_SECURITY_FLAG="";
if [ "$SRCDS_SECURED" -eq 0 ]; then
SERVER_SECURITY_FLAG="-insecure";
fi
bash "${STEAMAPPDIR}/srcds_run_64" -game "${STEAMAPP}" -console -autoupdate \
-steam_dir "${STEAMCMDDIR}" \
-steamcmd_script "${HOMEDIR}/${STEAMAPP}_update.txt" \
-usercon \
+fps_max "${SRCDS_FPSMAX}" \
-tickrate "${SRCDS_TICKRATE}" \
-port "${SRCDS_PORT}" \
+tv_port "${SRCDS_TV_PORT}" \
+clientport "${SRCDS_CLIENT_PORT}" \
+maxplayers "${SRCDS_MAXPLAYERS}" \
+map "${SRCDS_STARTMAP}" \
+sv_setsteamaccount "${SRCDS_TOKEN}" \
+rcon_password "${SRCDS_RCONPW}" \
+sv_password "${SRCDS_PW}" \
+sv_region "${SRCDS_REGION}" \
-ip "${SRCDS_IP}" \
-authkey "${SRCDS_WORKSHOP_AUTHKEY}" \
+servercfgfile "${SRCDS_CFG}" \
+mapcyclefile "${SRCDS_MAPCYCLE}" \
${SERVER_SECURITY_FLAG}