1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-23 04:23:08 +00:00
freebsd-ports/games/minetest/files/minetest.in
Dmitry Marakasov 3b7ec549cd - Update to 5.0.1
- Rework options
- Unbundle dependencies where possible
- Fix minetestserver rc.d script by setting HOME [1]
- Unbreak in powerpc [3]
- Update WWW

PR:		235355 [1], 238064 [2], 239413 [3]
Submitted by:	dch@freebsd.org [1], crwhipp@gmail.com [2], pkubaj@FreeBSD.org [3]
2019-07-31 22:50:15 +00:00

77 lines
2.3 KiB
Bash

#!/bin/sh
# $FreeBSD$
#
# PROVIDE: minetest
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf[.local] to enable minetest server
#
# minetest_enable (bool): Set to "NO" by default
# Set it to "YES" to enable minetest server
# minetest_conffile (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)
# minetest_user (str): User to run as
# (default: minetest)
# minetest_group (str): Group to run as
# (default: minetest)
# minetest_logdir (str): Path to log directory
# (default: /var/log/minetest)
# minetest_dbdir (str): Path to world database directory
# (default: /var/db/minetest)
. /etc/rc.subr
name=minetest
rcvar=minetest_enable
load_rc_config ${name}
: ${minetest_enable="NO"}
: ${minetest_config="/usr/local/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
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}"
required_files=${minetest_config}
start_precmd=minetest_prestart
minetest_prestart () {
if [ ! -d ${minetest_rundir} ]; then
mkdir -m 755 -p ${minetest_rundir}
chown -R ${minetest_user}:${minetest_group} ${minetest_rundir}
fi
if [ ! -d ${minetest_logdir} ]; then
mkdir -m 755 -p ${minetest_logdir}
chown -R ${minetest_user}:${minetest_group} ${minetest_logdir}
fi
if [ ! -d ${minetest_dbdir} ]; then
mkdir -m 755 -p ${minetest_dbdir}/data
chown -R ${minetest_user}:${minetest_group} ${minetest_dbdir}
fi
}
run_rc_command "$1"