freebsd-skq/etc/rc.d/sdpd
emax 3afbecfca5 Revise hcsecd(8) and sdpd(8) rc.d scripts one more time
- Use _prestart rc.d method to automatically kldload ng_btsocket(4) if needed;

- Rename "sdpd_user" to "sdpd_username" and "sdpd_group" to "sdpd_groupname"
  to avoid collision with "magic" variables;

Inspired by:	yar
MFC after:	3 days
2005-11-22 18:51:43 +00:00

39 lines
645 B
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: sdpd
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: nojail
. /etc/rc.subr
name="sdpd"
command="/usr/sbin/${name}"
rcvar=`set_rcvar`
start_precmd="sdpd_prestart"
sdpd_prestart()
{
if ! kldstat -q -m ng_btsocket > /dev/null 2>&1 ; then
if kldload ng_btsocket > /dev/null 2>&1 ; then
info 'ng_btsocket module loaded'
else
warn 'ng_btsocket module failed to load'
return 1
fi
fi
return 0
}
load_rc_config $name
control="${sdpd_control:-/var/run/sdp}"
group="${sdpd_groupname:-nobody}"
user="${sdpd_username:-nobody}"
command_args="-c ${control} -g ${group} -u ${user}"
run_rc_command "$1"