summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Szuba <marecki@gentoo.org>2021-05-13 17:01:04 +0200
committerMarek Szuba <marecki@gentoo.org>2021-05-13 17:13:44 +0200
commit9f5e7e45fc1a96dc041d99c4e206e51f04ea4fa7 (patch)
tree2a7685d2f2f79d24d586372a1a2e75ab8652cd02 /games-action/minetest
parentgames-action/minetest: drop 5.4.0 (diff)
downloadgentoo-9f5e7e45fc1a96dc041d99c4e206e51f04ea4fa7.tar.gz
gentoo-9f5e7e45fc1a96dc041d99c4e206e51f04ea4fa7.tar.bz2
gentoo-9f5e7e45fc1a96dc041d99c4e206e51f04ea4fa7.zip
games-action/minetest: tweak server configuration
Create /etc/minetest with appropriate permissions, install systemd units, use /run instead of /var/run for pidfiles in OpenRC mode. Signed-off-by: Marek Szuba <marecki@gentoo.org>
Diffstat (limited to 'games-action/minetest')
-rw-r--r--games-action/minetest/files/minetestserver.confd6
-rw-r--r--games-action/minetest/files/minetestserver.logrotate2
-rw-r--r--games-action/minetest/files/minetestserver_default.service15
-rw-r--r--games-action/minetest/files/minetestserver_template.service15
-rw-r--r--games-action/minetest/minetest-5.4.1-r1.ebuild (renamed from games-action/minetest/minetest-5.4.1.ebuild)34
5 files changed, 45 insertions, 27 deletions
diff --git a/games-action/minetest/files/minetestserver.confd b/games-action/minetest/files/minetestserver.confd
index 7a6f9b12ff01..b383fbd3e33b 100644
--- a/games-action/minetest/files/minetestserver.confd
+++ b/games-action/minetest/files/minetestserver.confd
@@ -4,13 +4,13 @@
USER="minetest"
# group
-GROUP="@GROUP@"
+GROUP="minetest"
# pidfile
-PIDFILE="/var/run/minetest.pid"
+PIDFILE="/run/minetest.pid"
# executable
-MINETESTBIN="@BINDIR@/minetestserver"
+MINETESTBIN="/usr/bin/minetestserver"
# additional arguments for the server
ARGS="--logfile /var/log/minetest/minetest-server.log"
diff --git a/games-action/minetest/files/minetestserver.logrotate b/games-action/minetest/files/minetestserver.logrotate
index 0ec4823663aa..2e38adfc5f50 100644
--- a/games-action/minetest/files/minetestserver.logrotate
+++ b/games-action/minetest/files/minetestserver.logrotate
@@ -1,4 +1,4 @@
-/var/log/minetest/minetest-server.log {
+/var/log/minetest/*.log {
rotate 5
weekly
missingok
diff --git a/games-action/minetest/files/minetestserver_default.service b/games-action/minetest/files/minetestserver_default.service
new file mode 100644
index 000000000000..e2754abaaf12
--- /dev/null
+++ b/games-action/minetest/files/minetestserver_default.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Minetest multiplayer server (server config minetest.conf)
+Documentation=man:minetestserver(6)
+After=network.target
+
+[Service]
+Restart=on-failure
+User=minetest
+Group=minetest
+ExecStart=/usr/bin/minetestserver --config /etc/minetest/minetest.conf --logfile /var/log/minetest/minetest-server.log
+StandardOutput=null
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/games-action/minetest/files/minetestserver_template.service b/games-action/minetest/files/minetestserver_template.service
new file mode 100644
index 000000000000..a945de53e870
--- /dev/null
+++ b/games-action/minetest/files/minetestserver_template.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Minetest multiplayer server (server config %i.conf)
+Documentation=man:minetestserver(6)
+After=network.target
+
+[Service]
+Restart=on-failure
+User=minetest
+Group=minetest
+ExecStart=/usr/bin/minetestserver --config /etc/minetest/%i.conf --logfile /var/log/minetest/%i-server.log
+StandardOutput=null
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/games-action/minetest/minetest-5.4.1.ebuild b/games-action/minetest/minetest-5.4.1-r1.ebuild
index 453757efe399..dfd64db5a93d 100644
--- a/games-action/minetest/minetest-5.4.1.ebuild
+++ b/games-action/minetest/minetest-5.4.1-r1.ebuild
@@ -5,7 +5,7 @@ EAPI=7
LUA_COMPAT=( lua5-1 luajit )
-inherit cmake lua-single xdg
+inherit cmake lua-single systemd xdg
DESCRIPTION="A free open-source voxel game engine with easy modding and game creation"
HOMEPAGE="https://www.minetest.net"
@@ -69,12 +69,6 @@ PATCHES=(
src_prepare() {
cmake_src_prepare
- # set paths
- sed \
- -e "s#@BINDIR@#${EPREFIX}/usr/bin#g" \
- -e "s#@GROUP@#${PN}#g" \
- "${FILESDIR}"/minetestserver.confd > "${T}"/minetestserver.confd || die
-
# remove bundled libraries
rm -rf lib || die
}
@@ -112,7 +106,7 @@ src_configure() {
src_compile() {
cmake_src_compile
- if use doc ; then
+ if use doc; then
cmake_src_compile doc
HTML_DOCS=( "${BUILD_DIR}"/doc/html/. )
fi
@@ -121,13 +115,20 @@ src_compile() {
src_install() {
cmake_src_install
- if use server ; then
+ if use server; then
+ keepdir /etc/minetest
+ fowners root:minetest /etc/minetest
+ fperms 2750 /etc/minetest
+
keepdir /var/log/minetest
fowners minetest:minetest /var/log/minetest
- newconfd "${T}"/minetestserver.confd minetest-server
+ newconfd "${FILESDIR}"/minetestserver.confd minetest-server
newinitd "${FILESDIR}"/minetestserver.initd minetest-server
+ systemd_newunit "${FILESDIR}"/minetestserver_default.service minetest-server.service
+ systemd_newunit "${FILESDIR}"/minetestserver_template.service minetest-server@.service
+
insinto /etc/logrotate.d
newins "${FILESDIR}"/minetestserver.logrotate minetest-server
fi
@@ -135,17 +136,4 @@ src_install() {
pkg_postinst() {
xdg_pkg_postinst
-
- if use server ; then
- elog
- elog "Configure your server via /etc/conf.d/minetest-server"
- elog
- fi
-
- elog
- elog "The version 5.x series is not compatible to the version 0.4 series."
- elog "This applies to clients and servers, other content such as mods,"
- elog "texture packs and worlds is unaffected and backwards-compatible"
- elog "as usual."
- elog
}