[5/5] nodewatcher: Use Makefile version for nodewatcher data

Submitted by Adrian Schmutzler on Jan. 7, 2020, 1:40 p.m.

Details

Message ID 20200107134024.1755-5-freifunk@adrianschmutzler.de
State New
Headers show

Commit Message

Adrian Schmutzler Jan. 7, 2020, 1:40 p.m.
So far, nodewatcher version has to be specified twice, once in the
Makefile and again in the nodewatcher script.

With this patch, a version file is created during build than can
be read in nodewatcher script, so version only has to be specified
once anymore. The file name mimics the version files already present
for OpenWrt and our firmware.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
---
 src/packages/fff/fff-nodewatcher/Makefile                      | 3 ++-
 .../files/usr/lib/nodewatcher.d/10-systemdata.sh               | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/packages/fff/fff-nodewatcher/Makefile b/src/packages/fff/fff-nodewatcher/Makefile
index 19dd9cd1..78475e53 100644
--- a/src/packages/fff/fff-nodewatcher/Makefile
+++ b/src/packages/fff/fff-nodewatcher/Makefile
@@ -1,7 +1,7 @@ 
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=fff-nodewatcher
-PKG_RELEASE:=58
+PKG_RELEASE:=59
 
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
 
@@ -36,6 +36,7 @@  endef
 
 define Package/$(PKG_NAME)/install
 	$(CP) ./files/* $(1)/
+	printf "$(if $(PKG_VERSION),$(PKG_VERSION).)$(PKG_RELEASE)" >> $(1)/etc/nodewatcher_version
 endef
 
 $(eval $(call BuildPackage,$(PKG_NAME)))
diff --git a/src/packages/fff/fff-nodewatcher/files/usr/lib/nodewatcher.d/10-systemdata.sh b/src/packages/fff/fff-nodewatcher/files/usr/lib/nodewatcher.d/10-systemdata.sh
index f4a6980e..c9a315e2 100755
--- a/src/packages/fff/fff-nodewatcher/files/usr/lib/nodewatcher.d/10-systemdata.sh
+++ b/src/packages/fff/fff-nodewatcher/files/usr/lib/nodewatcher.d/10-systemdata.sh
@@ -3,7 +3,7 @@ 
 # License; GPL v3
 
 SCRIPT_STATUS_FILE=$(uci get nodewatcher.@script[0].status_text_file)
-SCRIPT_VERSION="58"
+SCRIPT_VERSION=$(cat /etc/nodewatcher_version)
 
 debug() {
 	(>&2 echo "$1")