This commit is contained in:
Jan-Philipp Litza 2016-11-29 14:48:01 +00:00 committed by GitHub
commit 4b76be2b59
15 changed files with 28 additions and 66 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

@ -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; \

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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))

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,8 @@ 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')
end)
uci:save('respondd')

View File

@ -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)/