#!/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/xonotic-br.service ]; then
systemctl stop xonotic-br
fi
apt install --assume-yes autoconf automake build-essential curl git libtool \
libgmp-dev libjpeg62-turbo-dev libsdl2-dev libxpm-dev xserver-xorg-dev \
zlib1g-dev unzip zip
# Xonotic Battle Royale branch
xonotic_directory="/opt/xonotic-br"
rm -rf ${xonotic_directory}
git clone https://gitlab.com/xonotic/xonotic.git ${xonotic_directory}
cd ${xonotic_directory}
./all update -l best
./all checkout Juhu/battle-royale
./all compile -r dedicated
mkdir -p ${systemuserhome}/xonotic-br/data
chown -R ${systemuser}: ${systemuserhome}/xonotic-br
cat > ${systemuserhome}/xonotic-br/data/server.cfg < /etc/systemd/system/xonotic-br.service < /etc/nginx/gameserver.d/xonotic.conf <