l4d2-docker/start.sh

46 lines
1.5 KiB
Bash
Raw Permalink Normal View History

2021-04-12 13:54:25 +00:00
#!/bin/bash
set -e
2021-11-14 23:01:25 +00:00
/home/steam/steamcmd/steamcmd.sh +login anonymous +force_install_dir "$HOME/server" +app_update 222860 +quit
if [ ! -e "$HOME/server/left4dead2/addons/metamod.vdf" ]; then
echo "Installing Metamod"
2021-11-16 15:55:36 +00:00
curl "$METAMOD_DL_URL" -o /tmp/metamod.tar.gz
2021-11-14 23:01:25 +00:00
tar -xf /tmp/metamod.tar.gz -C "$HOME/server/left4dead2"
rm /tmp/metamod.tar.gz
echo "Install Sourcemod"
2021-11-16 15:55:36 +00:00
curl "$SOURCEMOD_DL_URL" -o /tmp/sourcemod.tar.gz
2021-11-14 23:01:25 +00:00
tar -xf /tmp/sourcemod.tar.gz -C "$HOME/server/left4dead2"
rm /tmp/sourcemod.tar.gz
fi
2021-04-12 13:54:25 +00:00
2021-11-16 20:05:27 +00:00
mkdir -p "$HOME/server/left4dead2/addons/sourcemod/configs/"
echo "// Autogenerated. DO NOT EDIT. Sourcemod admin can be added with the SM_ADMIN environment variable" \
> "$HOME/server/left4dead2/addons/sourcemod/configs/admins_simple.ini"
for id in $(echo "$SM_ADMIN" | sed 's/,/\n/g')
do
echo "\"$id\" \"99:z\"" >> "$HOME/server/left4dead2/addons/sourcemod/configs/admins_simple.ini"
done
2021-11-01 14:53:00 +00:00
echo -n "$MOTD_FILE_CONTENT" > "$HOME/server/left4dead2/motd.txt"
2021-04-12 13:54:25 +00:00
2021-11-01 14:53:00 +00:00
echo -n "$HOST_FILE_CONTENT" > "$HOME/server/left4dead2/host.txt"
2021-04-12 13:54:25 +00:00
2021-11-01 14:53:00 +00:00
env | awk -F "=" '/^CVAR_/ {sub("CVAR_","",$1); print tolower($1),($2 ~ /^[0-9]+$/)?$2:"\""$2"\""}' > /home/steam/server/left4dead2/cfg/server.cfg
2021-04-12 13:54:25 +00:00
2021-11-01 14:53:00 +00:00
cat /home/steam/server/left4dead2/cfg/server.cfg
2021-04-18 13:25:45 +00:00
2021-11-14 23:02:04 +00:00
SRCDS_ARGS=""
if [ -n "$INSECURE" ]; then
SRCDS_ARGS="${SRCDS_ARGS} -insecure"
echo "Running with VAC disabled."
fi
"$HOME/server/srcds_run" -console -game left4dead2 +maxplayers 16 -maxclients 16 -ip 0.0.0.0 $SRCDS_ARGS