diff --git a/deploy.sh b/deploy.sh index 7da2a2f..1aba3e8 100755 --- a/deploy.sh +++ b/deploy.sh @@ -18,15 +18,15 @@ if [ -z $HOSTEDBYNAME ]; then exit 1 fi -export stk_version="1.3" +export stk_version="latest" export bzflag_version="2.4" -export mindustry_version="135" -export openhv_version="20220221" -export teeworlds_version="0.7.5" +export mindustry_version="latest" +export openhv_version="latest" +export teeworlds_version="latest" export teeworldsddrace_version="16.1" -export unvanquished_version="0.52.1" -export xonotic_version="0.8.2" -export lix_version="0.9.41" +export unvanquished_version="latest" +export xonotic_version="0.8.5" +export lix_version="latest" export systemuser="onfoss" export letsencryptemail="jarno@jarno.ca" @@ -49,7 +49,7 @@ apt install --assume-yes \ fuse g++ gcc curl firewalld automake autoconf libtool \ libcurl3-dev libc-ares-dev zlib1g-dev libncurses-dev make python3-aiohttp \ nginx-core certbot python3-certbot-nginx sudo python3-psutil \ - ldc dub libenet-dev python3-bcrypt + ldc dub libenet-dev python3-bcrypt jq # Create the user for running the game servers if ! getent passwd ${systemuser}; then diff --git a/scripts/deploy_bzflag.sh b/scripts/deploy_bzflag.sh index e390b2d..29b7fb3 100755 --- a/scripts/deploy_bzflag.sh +++ b/scripts/deploy_bzflag.sh @@ -18,7 +18,7 @@ cd bzflag make make install if ! [ -L /usr/games/bzfs ]; then - ln -s /opt/bzflag-2.4/bin/bzfs /usr/games/ + ln -s /opt/bzflag-${bzflag_version}/bin/bzfs /usr/games/ fi rm -rf ${TMPDIR:-/tmp}/bzflag-build diff --git a/scripts/deploy_lix.sh b/scripts/deploy_lix.sh index 171a8ac..cfd3579 100755 --- a/scripts/deploy_lix.sh +++ b/scripts/deploy_lix.sh @@ -5,6 +5,10 @@ if [ -e /etc/systemd/system/lix.service ]; then systemctl stop lix fi +if [ -z ${lix_version} ] || [ "${lix_version}" = "latest" ]; then + lix_version=$(curl -s https://api.github.com/repos/SimonN/LixD/releases/latest | jq -r '.["tag_name"]' | cut -c2-) +fi + # Install Lix mkdir -p ${TMPDIR:-/tmp}/lix-build cd ${TMPDIR:-/tmp}/lix-build diff --git a/scripts/deploy_mindustry.sh b/scripts/deploy_mindustry.sh index 5768580..93c3e1f 100755 --- a/scripts/deploy_mindustry.sh +++ b/scripts/deploy_mindustry.sh @@ -5,9 +5,13 @@ if [ -e /etc/systemd/system/mindustry.service ]; then systemctl stop mindustry fi +if [ -z ${mindustry_version} ] || [ "${mindustry_version}" = "latest" ]; then + mindustry_version=$(curl -s https://api.github.com/repos/Anuken/Mindustry/releases?per_page=1 | jq -r '.[0]["tag_name"]' | cut -c2-) +fi + # Mindustry -mkdir -p /opt/mindustry-v${mindustry_version} -curl --location https://github.com/Anuken/Mindustry/releases/download/v${mindustry_version}/server-release.jar > /opt/mindustry-v${mindustry_version}/mindustry.jar +mkdir -p /opt/mindustry-${mindustry_version} +curl --location https://github.com/Anuken/Mindustry/releases/download/v${mindustry_version}/server-release.jar > /opt/mindustry-${mindustry_version}/mindustry.jar mkdir -p /var/lib/mindustry chown -R ${systemuser} /var/lib/mindustry @@ -18,7 +22,7 @@ After=network.target [Service] WorkingDirectory=/var/lib/mindustry -ExecStart=/usr/bin/console2web -p 62548 /usr/lib/jvm/java-11-openjdk-amd64/bin/java -jar /opt/mindustry-v${mindustry_version}/mindustry.jar "config autosave true","config autosaveSpacing 120","host" +ExecStart=/usr/bin/console2web -p 62548 /usr/lib/jvm/java-11-openjdk-amd64/bin/java -jar /opt/mindustry-${mindustry_version}/mindustry.jar "config autosave true","config autosaveSpacing 120","host" Restart=on-failure User=${systemuser} diff --git a/scripts/deploy_openhv.sh b/scripts/deploy_openhv.sh index 3dc8353..6072879 100755 --- a/scripts/deploy_openhv.sh +++ b/scripts/deploy_openhv.sh @@ -6,7 +6,7 @@ if [ -e /etc/systemd/system/openhv.service ]; then fi if [ -z ${openhv_version} ] || [ "${openhv_version}" = "latest" ]; then - openhv_version=$(git ls-remote --refs --sort="version:refname" --tags https://github.com/OpenHV/OpenHV | tail -n1 | cut -d'/' -f3) + openhv_version=$(curl -s https://api.github.com/repos/OpenHV/OpenHV/releases/latest | jq -r '.["tag_name"]') fi # Install OpenHV diff --git a/scripts/deploy_supertuxkart.sh b/scripts/deploy_supertuxkart.sh index ca56c0c..6cd0dd8 100755 --- a/scripts/deploy_supertuxkart.sh +++ b/scripts/deploy_supertuxkart.sh @@ -6,16 +6,16 @@ if [ -e /etc/systemd/system/supertuxkart.service ]; then systemctl stop supertuxkart fi +if [ -z ${stk_version} ] || [ "${stk_version}" = "latest" ]; then + stk_version=$(curl -s https://api.github.com/repos/supertuxkart/stk-code/releases/latest | jq -r '.["tag_name"]') +fi + # Install SuperTuxKart stk_dir="/opt/SuperTuxKart-${stk_version}" mkdir -p ${stk_dir} curl --location "https://github.com/supertuxkart/stk-code/releases/download/${stk_version}/SuperTuxKart-${stk_version}-linux-64bit.tar.xz" | tar --extract --xz --no-same-owner --strip-components=1 --directory=${stk_dir} ln -s ${stk_dir}/bin/supertuxkart /usr/games/supertuxkart -# Add firewall rules -firewall-cmd --zone=public --add-port=2757/udp --permanent -firewall-cmd --zone=public --add-port=2759/udp --permanent - # Configuration cp $(dirname $0)/../configs/supertuxkart.xml /etc/supertuxkart.xml @@ -37,5 +37,6 @@ EOF systemctl daemon-reload systemctl enable --now supertuxkart.service -firewall-cmd --zone=public --add-port=2759/udp --permanent +# Add firewall rules firewall-cmd --zone=public --add-port=2757/udp --permanent +firewall-cmd --zone=public --add-port=2759/udp --permanent diff --git a/scripts/deploy_teeworlds.sh b/scripts/deploy_teeworlds.sh index 48e487b..fe792dd 100755 --- a/scripts/deploy_teeworlds.sh +++ b/scripts/deploy_teeworlds.sh @@ -5,6 +5,10 @@ if [ -e /etc/systemd/system/teeworlds.service ]; then systemctl stop teeworlds fi +if [ -z ${teeworlds_version} ] || [ "${teeworlds_version}" = "latest" ]; then + teeworlds_version=$(curl -s https://api.github.com/repos/teeworlds/teeworlds/releases/latest | jq -r '.["tag_name"]') +fi + # Teeworlds teeworld_directory="/opt/teeworlds-${teeworlds_version}" mkdir -p ${teeworld_directory} diff --git a/scripts/deploy_unvanquished.sh b/scripts/deploy_unvanquished.sh index c34f3c6..f7a952d 100755 --- a/scripts/deploy_unvanquished.sh +++ b/scripts/deploy_unvanquished.sh @@ -5,6 +5,10 @@ if [ -e /etc/systemd/system/unvanquished.service ]; then systemctl stop unvanquished fi +if [ -z ${unvanquished_version} ] || [ "${unvanquished_version}" = "latest" ]; then + unvanquished_version=$(curl -s https://api.github.com/repos/Unvanquished/Unvanquished/releases/latest | jq -r '.["tag_name"]' | cut -c2-) +fi + # Unvanquished unvanquished_directory="/opt/unvanquished-${unvanquished_version}" curl --location "https://github.com/Unvanquished/Unvanquished/releases/download/v${unvanquished_version}/unvanquished_${unvanquished_version}.zip" > ${TMPDIR:-/tmp}/unvanquished.zip