# Copyright (C) 2007 OpenWrt.org
START=99
USE_PROCD=1
+DAEMON_NAME="p910nd"
+CONFIG="p910nd"
append_bool() {
local section="$1"
}
start_service() {
- config_load "p910nd"
- config_foreach start_p910nd p910nd
+ config_load $CONFIG
+ config_foreach start_p910nd $CONFIG
}
if [ "$enabled" -gt 0 ]; then
args="-d "
config_get port "$section" port
- name=p910${port}d
append_bool "$section" bidirectional "-b"
append_string "$section" device "-f "
append_string "$section" bind "-i "
append_string "$section" port ""
- procd_open_instance $name
- procd_set_param command /usr/sbin/p910nd $args
+ procd_open_instance $DAEMON_NAME
+ procd_set_param command /usr/sbin/$DAEMON_NAME $args
procd_set_param respawn
config_get_bool runas_root "$section" runas_root 0
- [ "$runas_root" -ne 1 ] && procd_set_param user p910nd
+ [ "$runas_root" -ne 1 ] && procd_set_param user $DAEMON_NAME
config_get_bool "mdns" "$section" "mdns" '0'
config_get mdns_note "$section" mdns_note
service_triggers()
{
procd_open_trigger
- procd_add_config_trigger "config.change" "p910nd" /etc/init.d/p910nd reload
+ procd_add_config_trigger "config.change" $DAEMON_NAME /etc/init.d/$DAEMON_NAME reload
procd_close_trigger
}