blob: d39fd1500b4810d9ae02ef4bdcc0b8fb1982d959 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
#!/bin/sh
# PROVIDE: freeminer
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf[.local] to enable freeminer server
#
# freeminer_enable (bool): Set to "NO" by default
# Set it to "YES" to enable freeminer server
# freeminer_conffile (str): Path to config file (required).
# (default: /usr/local/etc/freeminer.conf)
# freeminer_rundir (str): Path to directory holding a pidfile.
# (default: /var/run/freeminer)
# freeminer_user (str): User to run as
# (default: freeminer)
# freeminer_group (str): Group to run as
# (default: freeminer)
# freeminer_logdir (str): Path to log directory
# (default: /var/log/freeminer)
# freeminer_dbdir (str): Path to world database directory
# (default: /var/db/freeminer)
. /etc/rc.subr
name=freeminer
rcvar=freeminer_enable
load_rc_config ${name}
: ${freeminer_enable="NO"}
: ${freeminer_config="/usr/local/etc/freeminer.conf"}
: ${freeminer_rundir="/var/run/freeminer"}
: ${freeminer_user="freeminer"}
: ${freeminer_group="freeminer"}
: ${freeminer_logdir="/var/log/freeminer"}
: ${freeminer_dbdir="/var/db/freeminer"}
: ${freeminer_args:="--logfile ${freeminer_logdir}/debug.log --world ${freeminer_dbdir}/world ${freeminer_flags}"}
pidfile=
case "${freeminer_args}" in
*--config\ *)
echo "Warning \$freeminer_args includes --config option." \
"Please use \$freeminer_conffile instead."
;;
*)
freeminer_args="--config ${freeminer_config} ${freeminer_args}"
;;
esac
command=/usr/sbin/daemon
procname=/usr/local/bin/freeminerserver
pidfile=${freeminer_rundir}/freeminer.pid
command_args="-c -f -p ${pidfile} ${procname} ${freeminer_args}"
required_files=${freeminer_config}
start_precmd=freeminer_prestart
freeminer_prestart () {
if [ ! -d ${freeminer_rundir} ]; then
mkdir -m 755 -p ${freeminer_rundir}
chown -R ${freeminer_user}:${freeminer_group} ${freeminer_rundir}
fi
if [ ! -d ${freeminer_logdir} ]; then
mkdir -m 755 -p ${freeminer_logdir}
chown -R ${freeminer_user}:${freeminer_group} ${freeminer_logdir}
fi
if [ ! -d ${freeminer_dbdir} ]; then
mkdir -m 755 -p ${freeminer_dbdir}/data
chown -R ${freeminer_user}:${freeminer_group} ${freeminer_dbdir}
fi
}
run_rc_command "$1"
|