#!/bin/sh
#
# $FreeBSD: ports/games/sampsvr/files/sampd.in,v 1.7 2010/03/27 00:13:03 dougb Exp $
#
# PROVIDE: sampd
# REQUIRE: NETWORKING
#
# Add the following line to /etc/rc.conf[.local] to enable sampd
#
# sampd_enable (bool):		Set to "NO" by default.
#                               Set it to "YES" to enable sampd.

. /etc/rc.subr

name="sampd"
rcvar=${name}_enable

load_rc_config $name

: ${sampd_enable="NO"}
: ${sampd_chdir="/usr/local/libexec/sampsvr"}

command="/usr/local/libexec/sampsvr/samp03svr"
command_args="> /dev/null &"
required_files="/usr/local/etc/sampsvr.cfg"
start_precmd="sampd_prestart"
stop_precmd="sampd_prestop"

sampd_prestart() {
    if ! kldstat -v | grep -E 'linux(aout|elf)' > /dev/null; then
	err 1 "Linux support required"
    fi
}
		
sampd_prestop() {
    rc_pid=`echo $rc_pid | awk '{print $1}'`
}
		    
run_rc_command "$1"
