2016-02-02 05:38:03 +00:00
|
|
|
#!/bin/sh /etc/rc.common
|
|
|
|
|
2016-12-08 22:13:56 +00:00
|
|
|
USE_PROCD=1
|
2016-02-02 05:38:03 +00:00
|
|
|
START=50
|
|
|
|
|
|
|
|
DAEMON=/usr/bin/respondd
|
2016-12-10 23:42:41 +00:00
|
|
|
MAXDELAY=10
|
2016-02-02 05:38:03 +00:00
|
|
|
|
2016-12-08 22:13:56 +00:00
|
|
|
start_service() {
|
2016-12-10 23:42:41 +00:00
|
|
|
local ifdump="$(ubus call network.interface dump)"
|
|
|
|
|
2017-02-10 01:03:04 +00:00
|
|
|
local meshdevs=$(for dev in $(echo "$ifdump" | jsonfilter -e "@.interface[@.proto='gluon_mesh' && @.up=true].device"); do echo " -i $dev";done;)
|
|
|
|
local clientdevs=$(for dev in $(echo "$ifdump" | jsonfilter -e "@.interface[@.interface='$(cat /lib/gluon/respondd/client.dev 2>/dev/null)' && @.up=true].device"); do echo " -i $dev -t $MAXDELAY";done;)
|
2016-12-10 23:42:41 +00:00
|
|
|
|
2016-12-08 22:13:56 +00:00
|
|
|
procd_open_instance
|
2018-03-08 20:46:05 +00:00
|
|
|
procd_set_param command $DAEMON -d /usr/lib/respondd -p 1001 -g ff02::2:1001 $meshdevs $clientdevs -g ff05::2:1001 $clientdevs
|
2016-12-08 22:13:56 +00:00
|
|
|
procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5}
|
|
|
|
procd_set_param stderr 1
|
|
|
|
procd_close_instance
|
2016-02-02 05:38:03 +00:00
|
|
|
}
|
|
|
|
|
2016-12-08 22:13:56 +00:00
|
|
|
service_triggers() {
|
|
|
|
local script=$(readlink "$initscript")
|
|
|
|
local name=$(basename ${script:-$initscript})
|
2016-02-02 05:38:03 +00:00
|
|
|
|
2016-12-08 22:13:56 +00:00
|
|
|
procd_open_trigger
|
|
|
|
procd_add_raw_trigger "interface.*" 0 "/etc/init.d/$name" reload
|
|
|
|
procd_close_trigger
|
2016-02-02 05:38:03 +00:00
|
|
|
}
|