Gameserver/scripts/deploy_fteqw.sh

94 lines
2.8 KiB
Bash
Raw Normal View History

2023-08-14 03:24:27 +02:00
#!/bin/bash
# Collection of scripts to deploy a server hosting several open-source games
# Copyright (C) 2022 Jarno van der Kolk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
set -e
if [ -e /etc/systemd/system/fteqw.service ]; then
systemctl stop fteqw
fi
# MAPS: https://maps.rcmd.org/quake1/
# GAMEDATA: https://github.com/MissLavender-LQ/LibreQuake
# Install FTEQW
mkdir /opt/fteqw -p
curl --location 'https://www.fteqw.org/dl/fteqw-sv_linux64.zip' > /opt/fteqw/fteqw-sv_linux64.zip
unzip -o -d /opt/fteqw /opt/fteqw/fteqw-sv_linux64.zip
rm /opt/fteqw/fteqw-sv_linux64.zip /opt/fteqw/readme.txt
git clone --depth=1 https://github.com/MissLavender-LQ/LibreQuake.git ${TMPDIR:-/tmp}/LibreQuake
2023-08-18 19:27:00 +02:00
if [ -d /opt/fteqw/lq1 ]; then
rm -rf /opt/fteqw/lq1
fi
2023-08-14 03:24:27 +02:00
mv ${TMPDIR:-/tmp}/LibreQuake/lq1 /opt/fteqw
rm -rf ${TMPDIR:-/tmp}/LibreQuake
curl --location 'https://www.fteqcc.org/dl/fteqcc_linux64.zip' > /opt/fteqw/ftecc_linux64.zip
unzip -o -d /opt/fteqw /opt/fteqw/ftecc_linux64.zip fteqcc64
rm /opt/fteqw/ftecc_linux64.zip
mkdir -p ${TMPDIR:-/tmp}/progs
2023-08-18 19:27:00 +02:00
git clone --depth=1 https://github.com/fte-team/fteqw.git ${TMPDIR:-/tmp}/progs/fteqw
cd ${TMPDIR:-/tmp}/progs/fteqw/quakec/basemod
2023-08-14 03:24:27 +02:00
/opt/fteqw/fteqcc64
2023-08-18 19:27:00 +02:00
cp qwprogs.dat /opt/fteqw/lq1
2023-08-14 03:24:27 +02:00
cd -
2023-08-18 19:27:00 +02:00
# Configuration based on https://gist.github.com/kwadroke/fa978290d86a606de3875fa853d79334
2023-08-14 03:24:27 +02:00
cat > /opt/fteqw/lq1/autoexec.cfg <<EOF
sv_public "0"
sv_antilag "2"
sv_nqplayerphysics "0"
maxclients "32"
sv_motd1 "Welcome to the onFOSS server!"
admin_password "${systempassword}"
2023-08-18 19:27:00 +02:00
timelimit "10"
deathmatch "1"
fraglimit "20"
map "lqdm2_a6"
serverinfo "lqdm2_a6" lqdm3_a3
serverinfo "lqdm3_a3" "lqdm4_a6"
serverinfo "lqdm4_a6" "lqdm6_a6"
serverinfo "lqdm6_a6" "lqdm9_a7"
serverinfo "lqdm9_a7" "lqdm10_a3"
serverinfo "lqdm10_a3" "lqdm13_a3"
serverinfo "lqdm13_a3" "lqdm14_a1"
serverinfo "lqdm14_a1" "lqdm2_a6"
2023-08-14 03:24:27 +02:00
EOF
# Create SystemD unit
cat > /etc/systemd/system/fteqw.service <<EOF
[Unit]
Description=FTEQW server
After=network.target
[Service]
ExecStart=/opt/fteqw/fteqw-sv64
Restart=on-failure
User=${systemuser}
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable --now fteqw.service
# Add firewall rules
firewall-cmd --zone=public --add-port=27500/udp --permanent