gluon-respondd: Adapt to new respondd version

The new version supports loading the list of multicast interfaces from a
file and brings its own initscript and UCI configuration.
This commit is contained in:
Jan-Philipp Litza 2016-09-22 20:43:53 +02:00
parent d017739ac0
commit 545930b0bb
6 changed files with 17 additions and 54 deletions

View File

@ -9,7 +9,7 @@ PACKAGES_OPENWRT_COMMIT=73776792f7d58e982be9e5819450d4875b273159
PACKAGES_OPENWRT_BRANCH=for-15.05
PACKAGES_GLUON_REPO=git://github.com/freifunk-gluon/packages.git
PACKAGES_GLUON_COMMIT=90380414f10842238b7ebc21c34dbaf986659320
PACKAGES_GLUON_COMMIT=b1249e72e5d42a5af6cb2fe7cc5d62fa17eb4860
PACKAGES_ROUTING_REPO=git://github.com/openwrt-routing/packages.git
PACKAGES_ROUTING_COMMIT=a4eae82c155079a4372e4b910ec733f77288b717

View File

@ -3,7 +3,7 @@
. /usr/share/libubox/jshn.sh
. /lib/functions/service.sh
DEVLIST=/var/run/gluon-respondd.devs
DEVLIST="$(uci_get "respondd.@respondd[0].iface_list_file")"
ifname_to_dev () {
json_load "$(ubus call network.interface.$1 status)"
@ -14,7 +14,8 @@ ifname_to_dev () {
case "$ACTION" in
ifdown)
sed "/ $INTERFACE$/d" $DEVLIST > $DEVLIST.new
DEVICE="$(ifname_to_dev "$INTERFACE")"
sed "/^$DEVICE$/d" $DEVLIST > $DEVLIST.new
mv $DEVLIST.new $DEVLIST
;;
ifup)
@ -23,12 +24,13 @@ case "$ACTION" in
[ "$MESH" = "bat0" -o "$INTERFACE" = "client" ] || exit 0
DEVS=$(cat $DEVLIST 2>/dev/null; echo $DEVICE $INTERFACE)
echo "$DEVS" | sort -u > $DEVLIST.new
{
cat $DEVLIST 2>/dev/null
echo $DEVICE
} | sort -u > $DEVLIST.new
mv $DEVLIST.new $DEVLIST
/etc/init.d/gluon-respondd restart_if_running &
/etc/init.d/respondd reload &
;;
esac

View File

@ -1,45 +0,0 @@
#!/bin/sh /etc/rc.common
EXTRA_COMMANDS='restart_if_running'
START=50
SERVICE_WRITE_PID=1
SERVICE_DAEMONIZE=1
DEVLIST=/var/run/gluon-respondd.devs
DAEMON=/usr/bin/respondd
LOCK=/var/run/gluon-respondd.lock
do_start() {
DEVS=$(cat $DEVLIST 2>/dev/null | while read dev iface; do echo -n " -i $dev"; done)
service_start $DAEMON -g ff02::2:1001 -p 1001 -d /lib/gluon/respondd $DEVS
}
do_stop() {
service_stop $DAEMON
}
start() {
lock $LOCK
do_start
lock -u $LOCK
}
stop() {
lock $LOCK
do_stop
lock -u $LOCK
}
restart_if_running() {
lock $LOCK
if service_check $DAEMON; then
do_stop
do_start
fi
lock -u $LOCK
}

View File

@ -3,4 +3,4 @@
. /lib/gluon/autoupdater/lib.sh
start_enabled gluon-respondd
start_enabled respondd

View File

@ -3,4 +3,4 @@
. /lib/gluon/autoupdater/lib.sh
stop gluon-respondd
stop respondd

View File

@ -29,3 +29,9 @@ uci:section('firewall', 'rule', 'client_respondd',
)
uci:save('firewall')
uci:foreach('respondd', 'respondd', function(section)
uci:set('respondd', section['.name'], 'iface_list_file', '/var/run/gluon-respondd.devs')
uci:set('respondd', section['.name'], 'data_dir', '/lib/gluon/respondd/')
end)
uci:save('respondd')