Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 May 2024 16:36:50 GMT
From:      Dmitry Marakasov <amdmi3@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: f5c99763242c - main - games/minetest: fix rc.d script
Message-ID:  <202405271636.44RGao8x010075@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by amdmi3:

URL: https://cgit.FreeBSD.org/ports/commit/?id=f5c99763242c21f3ce4072ba5518d66b5174e84a

commit f5c99763242c21f3ce4072ba5518d66b5174e84a
Author:     Dmitry Marakasov <amdmi3@FreeBSD.org>
AuthorDate: 2024-05-24 20:42:37 +0000
Commit:     Dmitry Marakasov <amdmi3@FreeBSD.org>
CommitDate: 2024-05-27 16:25:24 +0000

    games/minetest: fix rc.d script
    
    - Introduce `minetest_gameid` rc.d variable (set to minetest_game
      by default), which passes required --gameid to minetestserver.
    - Rework minetestserver arguments handling, simplify specifying extra
      arguments with `minetest_args`.
    - Add check for empty list of games, suggesting to install minetest_game
      port or other mods.
    - Fix `minetest_config` variable spelling
    
    PR:             279251
    Submitted by:   DtxdF@disroot.org
---
 games/minetest/Makefile          |  1 +
 games/minetest/files/minetest.in | 28 ++++++++++++----------------
 2 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/games/minetest/Makefile b/games/minetest/Makefile
index da692c3c99e1..1d73d911f5b9 100644
--- a/games/minetest/Makefile
+++ b/games/minetest/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	minetest
 PORTVERSION=	5.8.0
+PORTREVISION=	1
 CATEGORIES=	games
 
 MAINTAINER=	amdmi3@FreeBSD.org
diff --git a/games/minetest/files/minetest.in b/games/minetest/files/minetest.in
index 2f1cf002309b..6598ecd2d556 100644
--- a/games/minetest/files/minetest.in
+++ b/games/minetest/files/minetest.in
@@ -8,7 +8,7 @@
 #
 # minetest_enable (bool):  Set to "NO" by default
 #                          Set it to "YES" to enable minetest server
-# minetest_conffile (str): Path to config file (required).
+# minetest_config (str):   Path to config file (required).
 #                          (default: /usr/local/etc/minetest.conf)
 # minetest_rundir (str):   Path to directory holding a pidfile.
 #                          (default: /var/run/minetest)
@@ -20,6 +20,10 @@
 #                          (default: /var/log/minetest)
 # minetest_dbdir (str):    Path to world database directory
 #                          (default: /var/db/minetest)
+# minetest_gameid (str):   Path to world database directory
+#                          (default: minetest_game)
+# minetest_args (str):     Additional arguments to minetestserver
+#                          (default: "")
 
 . /etc/rc.subr
 
@@ -29,34 +33,26 @@ rcvar=minetest_enable
 load_rc_config ${name}
 
 : ${minetest_enable="NO"}
-: ${minetest_config="/usr/local/etc/minetest.conf"}
+: ${minetest_config="%%PREFIX%%/etc/minetest.conf"}
 : ${minetest_rundir="/var/run/minetest"}
 : ${minetest_user="minetest"}
 : ${minetest_group="minetest"}
 : ${minetest_logdir="/var/log/minetest"}
 : ${minetest_dbdir="/var/db/minetest"}
-: ${minetest_args:="--logfile ${minetest_logdir}/debug.log --world ${minetest_dbdir}/world ${minetest_flags}"}
-
-pidfile=
-
-case "${minetest_args}" in
-*--config\ *)
-	echo "Warning \$minetest_args includes --config option." \
-	     "Please use \$minetest_conffile instead."
-	;;
-*)
-	minetest_args="--config ${minetest_config} ${minetest_args}"
-	;;
-esac
+: ${minetest_gameid="minetest_game"}
+: ${minetest_args=""}
 
 command=/usr/sbin/daemon
 procname=/usr/local/bin/minetestserver
 pidfile=${minetest_rundir}/minetest.pid
-command_args="-c -f -p ${pidfile} /usr/bin/env HOME='${minetest_dbdir}' ${procname} ${minetest_args}"
+command_args="-c -f -p ${pidfile} /usr/bin/env HOME='${minetest_dbdir}' ${procname} --config ${minetest_config} --logfile ${minetest_logdir}/debug.log --world ${minetest_dbdir}/world --gameid ${minetest_gameid} ${minetest_args}"
 required_files=${minetest_config}
 start_precmd=minetest_prestart
 
 minetest_prestart () {
+	if ! ${procname} --gameid list | grep -q "."; then
+		echo "Warning: no games installed (\`${procname} --gameid list\` is empty). You may want to install games/minetest_game or other games from https://content.minetest.net/." 1>&2
+	fi
 	if [ ! -d ${minetest_rundir} ]; then
 		mkdir -m 755 -p ${minetest_rundir}
 		chown -R ${minetest_user}:${minetest_group} ${minetest_rundir}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202405271636.44RGao8x010075>