[2/5] fff-nodewatcher: Tidy up uci-defaults script

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

Details

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

Commit Message

Adrian Schmutzler Jan. 7, 2020, 1:40 p.m.
This solves the following issues with the uci-defaults script in
fff-nodewatcher:

- Remove /bin/sh in non-executable file
- Only commit to changed config
- Use "-1" for uci node indexing, as this will be the node just
  created

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

Patch hide | download patch | download mbox

diff --git a/src/packages/fff/fff-nodewatcher/Makefile b/src/packages/fff/fff-nodewatcher/Makefile
index 423b7288..e4a07983 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:=56
+PKG_RELEASE:=57
 
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
 
diff --git a/src/packages/fff/fff-nodewatcher/files/etc/uci-defaults/93-fff-nodewatcher b/src/packages/fff/fff-nodewatcher/files/etc/uci-defaults/93-fff-nodewatcher
index 0fc2e90e..77f62bd3 100644
--- a/src/packages/fff/fff-nodewatcher/files/etc/uci-defaults/93-fff-nodewatcher
+++ b/src/packages/fff/fff-nodewatcher/files/etc/uci-defaults/93-fff-nodewatcher
@@ -1,14 +1,12 @@ 
-#!/bin/sh
-
 touch /etc/config/nodewatcher
 
 uci batch <<EOF
   add nodewatcher script
-  set nodewatcher.@script[0].error_level='0'
-  set nodewatcher.@script[0].logfile='/var/log/nodewatcher.log'
-  set nodewatcher.@script[0].data_file='/tmp/crawldata/node.data'
-  set nodewatcher.@script[0].status_text_file='/tmp/status.txt'
+  set nodewatcher.@script[-1].error_level='0'
+  set nodewatcher.@script[-1].logfile='/var/log/nodewatcher.log'
+  set nodewatcher.@script[-1].data_file='/tmp/crawldata/node.data'
+  set nodewatcher.@script[-1].status_text_file='/tmp/status.txt'
 EOF
-uci commit
+uci commit nodewatcher
 
 exit 0
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 713cea6c..ddc906e6 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="56"
+SCRIPT_VERSION="57"
 
 debug() {
 	(>&2 echo "$1")