#!/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 . 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 if [ -d /opt/fteqw/lq1 ]; then rm -rf /opt/fteqw/lq1 fi mv ${TMPDIR:-/tmp}/LibreQuake/lq1 /opt/fteqw rm -rf ${TMPDIR:-/tmp}/LibreQuake # Compile the maps curl --location 'https://github.com/ericwa/ericw-tools/releases/download/2.0.0-alpha6/ericw-tools-2.0.0-alpha6-Linux.zip' > /tmp/ericw-tools.zip unzip -o -d ${TMPDIR:-/tmp}/ericw-tools ${TMPDIR:-/tmp}/ericw-tools.zip rm /tmp/ericw-tools.zip cd /opt/fteqw/lq1/maps ./make.sh -m QBSP_PATH="/tmp/ericw-tools/qbsp" LIGHT_PATH="/tmp/ericw-tools/light" VIS_PATH="/tmp/ericw-tools//vis" cd - rm -rf /tmp/ericw-tools # Compile progs.dat 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 git clone --depth=1 https://github.com/fte-team/fteqw.git ${TMPDIR:-/tmp}/progs/fteqw cd ${TMPDIR:-/tmp}/progs/fteqw/quakec/basemod /opt/fteqw/fteqcc64 cp qwprogs.dat /opt/fteqw/lq1 cd - rm -rf ${TMPDIR:-/tmp}/progs if [ -e /opt/fteqw/lq1/maplist.cfg ]; then ## Delete the current maplist.cfg file so that there is not double (or more) entries rm /opt/fteqw/lq1/maplist.cfg fi ## Generate the map list cd /opt/fteqw/lq1/maps declare -a mapfiles=(lqdm*.bsp) for (( i = 0; i < ${#mapfiles[*]}; ++ i )); do ## Need to remove the .bsp from map name echo serverinfo \"$(basename --suffix=.bsp "${mapfiles[$i-1]}")\" \"$(basename --suffix=.bsp "${mapfiles[$i]}")\" >> /opt/fteqw/lq1/maplist.cfg done cd - # Configuration based on https://gist.github.com/kwadroke/fa978290d86a606de3875fa853d79334 cat > /opt/fteqw/lq1/autoexec.cfg < /etc/systemd/system/fteqw.service <