From 8779d8a0d0faf23d2bcb9d746aa1f917cc47dfb5 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 25 Oct 2020 09:02:21 +0100 Subject: [PATCH] first --- config-file | 1 + setup-mt | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 config-file create mode 100755 setup-mt diff --git a/config-file b/config-file new file mode 100644 index 00000000..ff85fad7 --- /dev/null +++ b/config-file @@ -0,0 +1 @@ +mt_version="5.3.0" diff --git a/setup-mt b/setup-mt new file mode 100755 index 00000000..9f0408c8 --- /dev/null +++ b/setup-mt @@ -0,0 +1,67 @@ +#!/bin/bash +source "${BASH_SOURCE%/*}/config-file" + + +echo "Create minetest user" +adduser minetest +mkdir -p /home/minetest/.minetest + +echo "Compile libspatialindex" +rm -rf /tmp/spatialindex +git clone https://github.com/libspatialindex/libspatialindex /tmp/spatialindex +cd /tmp/spatialindex +cmake . -DCMAKE_INSTALL_PREFIX=/usr +make +make install + +echo "Compile minetest version $mt_version" +rm -rf /tmp/minetest +git clone --depth 1 --branch "$mt_version" https://github.com/minetest/minetest.git /tmp/minetest +cp -n /tmp/minetest/minetest.conf.example /home/minetest/.minetest/minetest.conf +cd /tmp/minetest +cmake . \ + -DBUILD_CLIENT=0 \ + -DBUILD_SERVER=1 \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCUSTOM_BINDIR=/usr/bin \ + -DCUSTOM_DOCDIR="/usr/share/doc/minetest" \ + -DCUSTOM_SHAREDIR="/usr/share/minetest" \ + -DENABLE_CURL=1 \ + -DENABLE_LEVELDB=1 \ + -DENABLE_LUAJIT=1 \ + -DENABLE_REDIS=1 \ + -DENABLE_SOUND=0 \ + -DENABLE_SYSTEM_GMP=1 \ + -DENABLE_POSTGRESQL=1 \ + -DPOSTGRESQL_CONFIG_EXECUTABLE=/usr/bin/pg_config \ + -DPOSTGRESQL_LIBRARY=/usr/lib/libpq.so \ + -DRUN_IN_PLACE=0 +make +echo "Stop minetestsrv service(upgrade case)" +systemctl stop minetestsrv +make install + +echo "Clone minetest_game $mt_version" +mkdir -p /home/minetest/.minetest/games/ +rm -rf /home/minetest/.minetest/games/minetest +git clone --depth 1 --branch "$mt_version" https://github.com/minetest/minetest_game.git /home/minetest/.minetest/games/minetest + +echo "Fix privileges on /home/minetest" +chown minetest:minetest /home/minetest/ -cR + +echo "Creating minetestsrv systemd service" +echo "[Unit]" > /etc/systemd/system/minetestsrv.service +echo "Description=MinetestSRV" >> /etc/systemd/system/minetestsrv.service +echo "After=postgresql.service" >> /etc/systemd/system/minetestsrv.service +echo "[Service]" >> /etc/systemd/system/minetestsrv.service +echo "Type=simple" >> /etc/systemd/system/minetestsrv.service +echo "User=minetest" >> /etc/systemd/system/minetestsrv.service +echo "Group=minetest" >> /etc/systemd/system/minetestsrv.service +echo "ExecStart=/usr/bin/minetestserver" >> /etc/systemd/system/minetestsrv.service +echo "Restart=always" >> /etc/systemd/system/minetestsrv.service +echo "RestartSec=3" >> /etc/systemd/system/minetestsrv.service +echo "[Install]" >> /etc/systemd/system/minetestsrv.service +echo "WantedBy=multi-user.target" >> /etc/systemd/system/minetestsrv.service +systemctl daemon-reload +systemctl start minetestsrv +systemctl enable minetestsrv