[RFC PATCH] fff-gateway: Autoconfigure gateway after update

Fabian Bläse fabian at blaese.de
So Mär 22 19:26:20 CET 2020


This adds a script to uci-defaults to automatically call
the appropriate configuregateway commands after an update,
so the configuration of the device is restored.

The changes are applied, if configuregateway is successful.
Otherwise, they are reverted. Due to this, no additional checks for
the configuration are necessary, because the configuregateway script
fails, if the config version is wrong or no configuration exists at all.

Signed-off-by: Fabian Bläse <fabian at blaese.de>
---
 .../files/etc/uci-defaults/98a-configure-gateway       | 10 ++++++++++
 1 file changed, 10 insertions(+)
 create mode 100644 src/packages/fff/fff-gateway/files/etc/uci-defaults/98a-configure-gateway

diff --git a/src/packages/fff/fff-gateway/files/etc/uci-defaults/98a-configure-gateway b/src/packages/fff/fff-gateway/files/etc/uci-defaults/98a-configure-gateway
new file mode 100644
index 0000000..157edad
--- /dev/null
+++ b/src/packages/fff/fff-gateway/files/etc/uci-defaults/98a-configure-gateway
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+yes | configuregateway -c
+success=$?
+
+if [[ $success -eq 0 ]]; then
+	configuregateway -a
+else
+	configuregateway -r
+fi
-- 
2.25.2



Mehr Informationen über die Mailingliste franken-dev