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
This commit is contained in:
Maksim Yevmenkin 2005-11-22 18:51:43 +00:00
parent b18381c4a9
commit e08872c40b
3 changed files with 28 additions and 12 deletions

View File

@ -316,8 +316,8 @@ hcsecd_config="/etc/bluetooth/hcsecd.conf" # hcsecd(8) configuration file
sdpd_enable="NO" # Enable sdpd(8) (or NO)
sdpd_control="/var/run/sdp" # sdpd(8) control socket
sdpd_group="nobody" # set spdp(8) user/group to run as after
sdpd_user="nobody" # it initializes
sdpd_groupname="nobody" # set spdp(8) user/group to run as after
sdpd_username="nobody" # it initializes
### Miscellaneous network options: ###
icmp_bmcastecho="NO" # respond to broadcast ping packets

View File

@ -14,12 +14,20 @@ name="hcsecd"
command="/usr/sbin/${name}"
pidfile="/var/run/${name}.pid"
rcvar=`set_rcvar`
start_cmd="hcsecd_start"
start_precmd="hcsecd_prestart"
hcsecd_start()
hcsecd_prestart()
{
kldload ng_btsocket > /dev/null 2>&1
${command} ${command_args}
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

View File

@ -13,18 +13,26 @@
name="sdpd"
command="/usr/sbin/${name}"
rcvar=`set_rcvar`
start_cmd="sdpd_start"
start_precmd="sdpd_prestart"
sdpd_start()
sdpd_prestart()
{
kldload ng_btsocket > /dev/null 2>&1
${command} ${command_args}
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_group:-nobody}"
user="${sdpd_user:-nobody}"
group="${sdpd_groupname:-nobody}"
user="${sdpd_username:-nobody}"
command_args="-c ${control} -g ${group} -u ${user}"
run_rc_command "$1"