Compare commits

...

4 Commits

Author SHA1 Message Date
Adrian Schmutzler 934ddab8e5 fff-nodewatcher: add config option to disable nodewatcher
This adds an option 'disabled' that will allow to disable
nodewatcher when desired.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Robert Langhammer <rlanghammer@web.de>
2021-02-27 16:13:56 +01:00
Adrian Schmutzler cdf444651f fff-nodewatcher: specify config file as config file
This package is the owner of the config file, so add it to the
Makefile. This will have vanilla OpenWrt copy it during upgrade.

Since we disable this mechanism, it will not change anything for
our standard firmware. But it will improve the situation if this
package is used in vanilla OpenWrt.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Robert Langhammer <rlanghammer@web.de>
2021-02-27 16:12:02 +01:00
Adrian Schmutzler 0475fe01f0 fff-nodewatcher: only run uci-defaults once
If /etc/config/nodewatcher already exists, a proper uci-defaults
script should not overwrite it. Since this package is the owner
of the config file, this change won't change anything for the
current firmware, but will allow to use this as a package, too.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Robert Langhammer <rlanghammer@web.de>
2021-02-27 16:10:26 +01:00
Adrian Schmutzler 40f26d74a7 fff-nodewatcher: consolidate uci-defaults scripts
The uci-defaults scripts are meant to provide defaults for a
specific package. Distributing them across several packages makes
no sense and just makes maintainance worse.

Thus, move the network part of the initialization back to the
proper package. While at it, suppress output from add commands.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Robert Langhammer <rlanghammer@web.de>
2021-02-27 16:09:22 +01:00
5 changed files with 15 additions and 12 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=fff-network
PKG_RELEASE:=36
PKG_RELEASE:=37
include $(INCLUDE_DIR)/package.mk

View File

@ -1,9 +0,0 @@
uci batch <<EOF
add nodewatcher network
set nodewatcher.@network[-1].mesh_interface='br-client'
set nodewatcher.@network[-1].iface_blacklist='lo ifb0'
set nodewatcher.@network[-1].ip_whitelist='br-client'
EOF
uci commit nodewatcher
exit 0

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=fff-nodewatcher
PKG_RELEASE:=61
PKG_RELEASE:=62
include $(INCLUDE_DIR)/package.mk
@ -20,6 +20,10 @@ define Package/$(PKG_NAME)/description
netmon.freifunk-franken.de
endef
define Package/$(PKG_NAME)/conffiles
/etc/config/nodewatcher
endef
define Build/Compile
# nothing
endef

View File

@ -1,9 +1,16 @@
[ -s /etc/config/nodewatcher ] && exit 0
touch /etc/config/nodewatcher
uci batch <<EOF
uci batch >/dev/null <<EOF
add nodewatcher script
set nodewatcher.@script[-1].data_file='/tmp/crawldata/node.data'
set nodewatcher.@script[-1].status_text_file='/tmp/status.txt'
set nodewatcher.@script[-1].disabled='0'
add nodewatcher network
set nodewatcher.@network[-1].mesh_interface='br-client'
set nodewatcher.@network[-1].iface_blacklist='lo ifb0'
set nodewatcher.@network[-1].ip_whitelist='br-client'
EOF
uci commit nodewatcher

View File

@ -13,6 +13,7 @@ fi
trap "lock -u \"$lockfile\"" INT TERM EXIT
[ -s /etc/config/nodewatcher ] || exit 1
[ "$(uci get nodewatcher.@script[0].disabled)" = "1" ] && exit 0
SCRIPT_DATA_FILE=$(uci get nodewatcher.@script[0].data_file)