summaryrefslogtreecommitdiff
path: root/games/mtaserver/files/mtad.in
blob: 760d4d41d93e5e367429c2ec9216456b2f42a6a6 (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
#!/bin/sh

# PROVIDE: mtad
# REQUIRE: NETWORKING
#
# Add the following line to /etc/rc.conf[.local] to enable mtad
#
# mtad_enable (bool):		Set to "NO" by default.
#                               Set it to "YES" to enable mtad.

. /etc/rc.subr

name="mtad"
rcvar=mtad_enable

load_rc_config $name

: ${mtad_enable="NO"}
: ${mtad_chdir="%%DATADIR%%"}
: ${mtad_config="%%ETCDIR%%/mtaserver.conf"}
: ${mtad_logfile="/var/log/mtaserver.log"}

command="%%DATADIR%%/mtaserver"
command_args="-b -c ${mtad_config} -l ${mtad_logfile} 2>&1 > /dev/null &"
required_files=${mtad_config}
start_precmd="mtad_prestart"
stop_precmd="mtad_prestop"

mtad_prestart() {
    if ! kldstat -v | grep -E 'linux(aout|elf)' > /dev/null; then
	err 1 "Linux support required"
    fi
}

mtad_prestop() {
    rc_pid=`echo $rc_pid | awk '{print $1}'`
}
    		    
run_rc_command "$1"