From 545930b0bb2a47ade9a9abbae1be436b9f5ad5e5 Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Thu, 22 Sep 2016 20:43:53 +0200 Subject: [PATCH 1/2] 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. --- modules | 2 +- .../etc/hotplug.d/iface/10-gluon-respondd | 14 +++--- .../files/etc/init.d/gluon-respondd | 45 ------------------- .../lib/autoupdater/abort.d/50gluon-respondd | 2 +- .../autoupdater/download.d/50gluon-respondd | 2 +- .../{400-respondd-firewall => 400-respondd} | 6 +++ 6 files changed, 17 insertions(+), 54 deletions(-) delete mode 100755 package/gluon-respondd/files/etc/init.d/gluon-respondd rename package/gluon-respondd/luasrc/lib/gluon/upgrade/{400-respondd-firewall => 400-respondd} (73%) diff --git a/modules b/modules index c185e366..1945899a 100644 --- a/modules +++ b/modules @@ -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 diff --git a/package/gluon-respondd/files/etc/hotplug.d/iface/10-gluon-respondd b/package/gluon-respondd/files/etc/hotplug.d/iface/10-gluon-respondd index 4f49be52..30e10f55 100644 --- a/package/gluon-respondd/files/etc/hotplug.d/iface/10-gluon-respondd +++ b/package/gluon-respondd/files/etc/hotplug.d/iface/10-gluon-respondd @@ -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 diff --git a/package/gluon-respondd/files/etc/init.d/gluon-respondd b/package/gluon-respondd/files/etc/init.d/gluon-respondd deleted file mode 100755 index a1bf979f..00000000 --- a/package/gluon-respondd/files/etc/init.d/gluon-respondd +++ /dev/null @@ -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 -} diff --git a/package/gluon-respondd/files/usr/lib/autoupdater/abort.d/50gluon-respondd b/package/gluon-respondd/files/usr/lib/autoupdater/abort.d/50gluon-respondd index d29af306..42c6a0e1 100755 --- a/package/gluon-respondd/files/usr/lib/autoupdater/abort.d/50gluon-respondd +++ b/package/gluon-respondd/files/usr/lib/autoupdater/abort.d/50gluon-respondd @@ -3,4 +3,4 @@ . /lib/gluon/autoupdater/lib.sh -start_enabled gluon-respondd +start_enabled respondd diff --git a/package/gluon-respondd/files/usr/lib/autoupdater/download.d/50gluon-respondd b/package/gluon-respondd/files/usr/lib/autoupdater/download.d/50gluon-respondd index 3edd5f1d..0c27a2b3 100755 --- a/package/gluon-respondd/files/usr/lib/autoupdater/download.d/50gluon-respondd +++ b/package/gluon-respondd/files/usr/lib/autoupdater/download.d/50gluon-respondd @@ -3,4 +3,4 @@ . /lib/gluon/autoupdater/lib.sh -stop gluon-respondd +stop respondd diff --git a/package/gluon-respondd/luasrc/lib/gluon/upgrade/400-respondd-firewall b/package/gluon-respondd/luasrc/lib/gluon/upgrade/400-respondd similarity index 73% rename from package/gluon-respondd/luasrc/lib/gluon/upgrade/400-respondd-firewall rename to package/gluon-respondd/luasrc/lib/gluon/upgrade/400-respondd index a78cfb3d..a35977cc 100755 --- a/package/gluon-respondd/luasrc/lib/gluon/upgrade/400-respondd-firewall +++ b/package/gluon-respondd/luasrc/lib/gluon/upgrade/400-respondd @@ -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') From 1df6daf0839c264aedb38b89bdf1ccc3666da5e9 Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Thu, 22 Sep 2016 20:43:53 +0200 Subject: [PATCH 2/2] Rename /lib/gluon/respondd/ to /lib/respondd/ respondd is supposed to be non-Gluon-specific, thus having its data direectory in /lib/gluon/ doesn't make sense. --- package/gluon-autoupdater/Makefile | 4 ++-- package/gluon-mesh-batman-adv-core/Makefile | 4 ++-- package/gluon-mesh-vpn-fastd/Makefile | 4 ++-- package/gluon-node-info/Makefile | 4 ++-- package/gluon-respondd/Makefile | 4 ++-- .../files/lib/{gluon => }/respondd/neighbours.cache | 0 .../files/lib/{gluon => }/respondd/nodeinfo.cache | 0 .../files/lib/{gluon => }/respondd/statistics.cache | 0 package/gluon-respondd/luasrc/lib/gluon/upgrade/400-respondd | 1 - package/gluon-status-page-api/Makefile | 4 ++-- 10 files changed, 12 insertions(+), 13 deletions(-) rename package/gluon-respondd/files/lib/{gluon => }/respondd/neighbours.cache (100%) rename package/gluon-respondd/files/lib/{gluon => }/respondd/nodeinfo.cache (100%) rename package/gluon-respondd/files/lib/{gluon => }/respondd/statistics.cache (100%) diff --git a/package/gluon-autoupdater/Makefile b/package/gluon-autoupdater/Makefile index baae06ba..c73d2bfa 100644 --- a/package/gluon-autoupdater/Makefile +++ b/package/gluon-autoupdater/Makefile @@ -31,8 +31,8 @@ define Package/gluon-autoupdater/install $(CP) ./files/* $(1)/ $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/ - $(INSTALL_DIR) $(1)/lib/gluon/respondd - $(CP) $(PKG_BUILD_DIR)/respondd.so $(1)/lib/gluon/respondd/autoupdater.so + $(INSTALL_DIR) $(1)/lib/respondd + $(CP) $(PKG_BUILD_DIR)/respondd.so $(1)/lib/respondd/autoupdater.so if [ '$(GLUON_BRANCH)' ]; then \ $(INSTALL_DIR) $(1)/lib/gluon/autoupdater; \ diff --git a/package/gluon-mesh-batman-adv-core/Makefile b/package/gluon-mesh-batman-adv-core/Makefile index efcf1698..68e1de4f 100644 --- a/package/gluon-mesh-batman-adv-core/Makefile +++ b/package/gluon-mesh-batman-adv-core/Makefile @@ -29,8 +29,8 @@ endef define Package/gluon-mesh-batman-adv-core/install $(CP) ./files/* $(1)/ $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/ - $(INSTALL_DIR) $(1)/lib/gluon/respondd - $(CP) $(PKG_BUILD_DIR)/respondd.so $(1)/lib/gluon/respondd/mesh-batman-adv-core.so + $(INSTALL_DIR) $(1)/lib/respondd + $(CP) $(PKG_BUILD_DIR)/respondd.so $(1)/lib/respondd/mesh-batman-adv-core.so endef define Package/gluon-mesh-batman-adv-core/postinst diff --git a/package/gluon-mesh-vpn-fastd/Makefile b/package/gluon-mesh-vpn-fastd/Makefile index 4d75116e..ec73a19e 100644 --- a/package/gluon-mesh-vpn-fastd/Makefile +++ b/package/gluon-mesh-vpn-fastd/Makefile @@ -29,8 +29,8 @@ endef define Package/gluon-mesh-vpn-fastd/install $(CP) ./files/* $(1)/ $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/ - $(INSTALL_DIR) $(1)/lib/gluon/respondd - $(CP) $(PKG_BUILD_DIR)/respondd.so $(1)/lib/gluon/respondd/mesh-vpn-fastd.so + $(INSTALL_DIR) $(1)/lib/respondd + $(CP) $(PKG_BUILD_DIR)/respondd.so $(1)/lib/respondd/mesh-vpn-fastd.so endef define Package/gluon-mesh-vpn-fastd/postinst diff --git a/package/gluon-node-info/Makefile b/package/gluon-node-info/Makefile index 8dd31553..89f809a5 100644 --- a/package/gluon-node-info/Makefile +++ b/package/gluon-node-info/Makefile @@ -25,8 +25,8 @@ endef define Package/gluon-node-info/install $(CP) ./files/* $(1)/ - $(INSTALL_DIR) $(1)/lib/gluon/respondd - $(CP) $(PKG_BUILD_DIR)/respondd.so $(1)/lib/gluon/respondd/node-info.so + $(INSTALL_DIR) $(1)/lib/respondd + $(CP) $(PKG_BUILD_DIR)/respondd.so $(1)/lib/respondd/node-info.so endef define Package/gluon-node-info/postinst diff --git a/package/gluon-respondd/Makefile b/package/gluon-respondd/Makefile index c6cc71e4..50c334b5 100644 --- a/package/gluon-respondd/Makefile +++ b/package/gluon-respondd/Makefile @@ -28,8 +28,8 @@ endef define Package/gluon-respondd/install $(CP) ./files/* $(1)/ $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/ - $(INSTALL_DIR) $(1)/lib/gluon/respondd - $(CP) $(PKG_BUILD_DIR)/respondd.so $(1)/lib/gluon/respondd/respondd.so + $(INSTALL_DIR) $(1)/lib/respondd + $(CP) $(PKG_BUILD_DIR)/respondd.so $(1)/lib/respondd/respondd.so endef $(eval $(call BuildPackage,gluon-respondd)) diff --git a/package/gluon-respondd/files/lib/gluon/respondd/neighbours.cache b/package/gluon-respondd/files/lib/respondd/neighbours.cache similarity index 100% rename from package/gluon-respondd/files/lib/gluon/respondd/neighbours.cache rename to package/gluon-respondd/files/lib/respondd/neighbours.cache diff --git a/package/gluon-respondd/files/lib/gluon/respondd/nodeinfo.cache b/package/gluon-respondd/files/lib/respondd/nodeinfo.cache similarity index 100% rename from package/gluon-respondd/files/lib/gluon/respondd/nodeinfo.cache rename to package/gluon-respondd/files/lib/respondd/nodeinfo.cache diff --git a/package/gluon-respondd/files/lib/gluon/respondd/statistics.cache b/package/gluon-respondd/files/lib/respondd/statistics.cache similarity index 100% rename from package/gluon-respondd/files/lib/gluon/respondd/statistics.cache rename to package/gluon-respondd/files/lib/respondd/statistics.cache diff --git a/package/gluon-respondd/luasrc/lib/gluon/upgrade/400-respondd b/package/gluon-respondd/luasrc/lib/gluon/upgrade/400-respondd index a35977cc..99a3a28d 100755 --- a/package/gluon-respondd/luasrc/lib/gluon/upgrade/400-respondd +++ b/package/gluon-respondd/luasrc/lib/gluon/upgrade/400-respondd @@ -32,6 +32,5 @@ 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') diff --git a/package/gluon-status-page-api/Makefile b/package/gluon-status-page-api/Makefile index ddad2cab..738ad045 100644 --- a/package/gluon-status-page-api/Makefile +++ b/package/gluon-status-page-api/Makefile @@ -32,8 +32,8 @@ define Package/gluon-status-page-api/install $(INSTALL_BIN) $(PKG_BUILD_DIR)/neighbours-batadv $(1)/lib/gluon/status-page/providers/ $(INSTALL_BIN) $(PKG_BUILD_DIR)/stations $(1)/lib/gluon/status-page/providers/ - $(INSTALL_DIR) $(1)/lib/gluon/respondd - $(CP) $(PKG_BUILD_DIR)/respondd.so $(1)/lib/gluon/respondd/status-page-api.so + $(INSTALL_DIR) $(1)/lib/respondd + $(CP) $(PKG_BUILD_DIR)/respondd.so $(1)/lib/respondd/status-page-api.so $(CP) ./files/* $(1)/ $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/