145 lines
5 KiB
Bash
145 lines
5 KiB
Bash
#!/bin/bash
|
|
|
|
set -xeuo pipefail
|
|
|
|
# -- DEFINE FUNCTIONS AND VARIABLES -- #
|
|
|
|
function steam() {
|
|
# for systemd, so it can terminate the process (for other things sudo would have been enough)
|
|
setpriv --reuid=steam --regid=steam --init-groups "$@" <&0
|
|
export HOME=/opt/l4d2/steam
|
|
}
|
|
|
|
declare -A addons=(
|
|
[Ions_Vocalizer]=698857882
|
|
[EMS_Admin_System]=1376314661
|
|
)
|
|
|
|
function install_addon() {
|
|
local overlay="$1"
|
|
local addon_name="$2"
|
|
local addon_id="${addons[${addon_name}]}"
|
|
steam mkdir -p "/opt/l4d2/overlays/${overlay}/left4dead2/addons"
|
|
test -f "/opt/l4d2/overlays/${overlay}/left4dead2/addons/${addon_id}.vpk" || \
|
|
steam /opt/l4d2/steam-workshop-download "${addon_id}" --out "/opt/l4d2/overlays/${overlay}/left4dead2/addons"
|
|
}
|
|
|
|
function install_admin_system() {
|
|
local overlay="$1"
|
|
install_addon "${overlay}" EMS_Admin_System
|
|
steam mkdir -p "/opt/l4d2/overlays/${overlay}/left4dead2/ems/admin system"
|
|
steam echo "STEAM_1:0:12376499" > "/opt/l4d2/overlays/${overlay}/left4dead2/ems/admin system/admins.txt"
|
|
}
|
|
|
|
function install_tickrate_enabler() {
|
|
local overlay="$1"
|
|
steam mkdir -p "/opt/l4d2/overlays/${overlay}/left4dead2/addons"
|
|
for file in tickrate_enabler.dll tickrate_enabler.so tickrate_enabler.vdf
|
|
do
|
|
curl -L "https://github.com/SirPlease/L4D2-Competitive-Rework/raw/refs/heads/master/addons/${file}" -o "/opt/l4d2/overlays/${overlay}/left4dead2/addons/${file}"
|
|
done
|
|
}
|
|
|
|
# -- PREPARE SYSTEM -- #
|
|
|
|
getent passwd steam >/dev/null || useradd -M -d /opt/l4d2 -s /bin/bash steam
|
|
mkdir -p /opt/l4d2 /tmp/dumps
|
|
chown steam:steam /opt/l4d2 /tmp/dumps
|
|
dpkg --add-architecture i386
|
|
apt update
|
|
DEBIAN_FRONTEND=noninteractive apt install -y libc6:i386 lib32z1
|
|
|
|
# -- STEAM -- #
|
|
|
|
steam mkdir -p /opt/l4d2/steam
|
|
test -f /opt/l4d2/steam/steamcmd_linux.tar.gz || \
|
|
steam wget http://media.steampowered.com/installer/steamcmd_linux.tar.gz -P /opt/l4d2/steam
|
|
test -f /opt/l4d2/steam/steamcmd.sh || \
|
|
steam tar -xvzf /opt/l4d2/steam/steamcmd_linux.tar.gz -C /opt/l4d2/steam
|
|
|
|
# fix for: /opt/l4d2/.steam/sdk32/steamclient.so: cannot open shared object file: No such file or directory
|
|
steam mkdir -p /opt/l4d2/steam/.steam # needs to be in steam users home dir
|
|
readlink /opt/l4d2/steam/.steam/sdk32 | grep -q ^/opt/l4d2/steam/linux32$ || \
|
|
steam ln -sf /opt/l4d2/steam/linux32 /opt/l4d2/steam/.steam/sdk32
|
|
readlink /opt/l4d2/steam/.steam/sdk64 | grep -q ^/opt/l4d2/steam/linux64$ || \
|
|
steam ln -sf /opt/l4d2/steam/linux64 /opt/l4d2/steam/.steam/sdk64
|
|
|
|
# -- INSTALL -- #
|
|
|
|
# erst die windows deps zu installieren scheint ein workaround für x64 zu sein?
|
|
steam mkdir -p /opt/l4d2/installation
|
|
steam /opt/l4d2/steam/steamcmd.sh \
|
|
+force_install_dir /opt/l4d2/installation \
|
|
+login anonymous \
|
|
+@sSteamCmdForcePlatformType windows \
|
|
+app_update 222860 validate \
|
|
+quit
|
|
steam /opt/l4d2/steam/steamcmd.sh \
|
|
+force_install_dir /opt/l4d2/installation \
|
|
+login anonymous \
|
|
+@sSteamCmdForcePlatformType linux \
|
|
+app_update 222860 validate \
|
|
+quit
|
|
|
|
# -- OVERLAYS -- #
|
|
|
|
steam mkdir -p /opt/l4d2/overlays
|
|
|
|
# workshop downloader
|
|
test -f /opt/l4d2/steam-workshop-download || \
|
|
steam wget -4 https://git.sublimity.de/cronekorkn/steam-workshop-downloader/raw/branch/master/steam-workshop-download -P /opt/l4d2
|
|
steam chmod +x /opt/l4d2/steam-workshop-download
|
|
|
|
# -- OVERLAY VANILLA -- #
|
|
|
|
steam mkdir -p /opt/l4d2/overlays/vanilla
|
|
|
|
# server config
|
|
steam mkdir -p /opt/l4d2/overlays/vanilla/left4dead2/cfg
|
|
steam cat <<'EOF' > /opt/l4d2/overlays/vanilla/left4dead2/cfg/server.cfg
|
|
motd_enabled 0
|
|
|
|
EOF
|
|
|
|
# admin system
|
|
install_addon vanilla Ions_Vocalizer
|
|
install_admin_system vanilla
|
|
|
|
# -- OVERLAY TICKRATE -- #
|
|
|
|
steam mkdir -p /opt/l4d2/overlays/tickrate
|
|
|
|
# server config
|
|
steam mkdir -p /opt/l4d2/overlays/tickrate/left4dead2/cfg
|
|
steam cat <<'EOF' > /opt/l4d2/overlays/tickrate/left4dead2/cfg/server.cfg
|
|
# https://github.com/SirPlease/L4D2-Competitive-Rework/blob/7ecc3a32a5e2180d6607a40119ff2f3c072502a9/cfg/server.cfg#L58-L69
|
|
sv_minrate 100000
|
|
sv_maxrate 100000
|
|
nb_update_frequency 0.014
|
|
net_splitpacket_maxrate 50000
|
|
net_maxcleartime 0.0001
|
|
fps_max 0
|
|
EOF
|
|
|
|
# admin system
|
|
install_tickrate_enabler tickrate
|
|
|
|
# -- OVERLAY COMPETITIVE REWORK WIP -- #
|
|
|
|
# https://github.com/SirPlease/L4D2-Competitive-Rework
|
|
|
|
steam mkdir -p /opt/l4d2/overlays/competitive_rework
|
|
steam mkdir -p /opt/l4d2/overlays/competitive_rework/left4dead2
|
|
test -d /opt/l4d2/overlays/competitive_rework/left4dead2/cfg/cfgogl || \
|
|
curl -L https://github.com/SirPlease/L4D2-Competitive-Rework/archive/refs/heads/master.tar.gz | steam tar -xz --strip-components=1 -C /opt/l4d2/overlays/competitive_rework/left4dead2
|
|
|
|
# if ! test -f /opt/l4d2/overlays/competitive_rework/left4dead2/cfg/server_original.cfg
|
|
# then
|
|
# steam mv /opt/l4d2/overlays/competitive_rework/left4dead2/cfg/server.cfg /opt/l4d2/overlays/competitive_rework/left4dead2/cfg/server_original.cfg
|
|
# steam echo -e "exec server_original.cfg\nsm_forcematch zonemod" > /opt/l4d2/overlays/competitive_rework/left4dead2/cfg/server.cfg
|
|
# fi
|
|
|
|
# -- SERVERS -- #
|
|
|
|
#steam rm -rf /opt/l4d2/servers
|
|
steam mkdir -p /opt/l4d2/servers
|