From patchwork Sat Mar 28 16:10:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: fff-gateway: Autoconfigure gateway after update From: Fabian Blaese X-Patchwork-Id: 1312 Message-Id: <20200328161019.214390-1-fabian@blaese.de> To: franken-dev@freifunk.net Date: Sat, 28 Mar 2020 17:10:19 +0100 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 Reviewed-by: Robert Langhammer --- Changes from RFC: - Move configuration command into the if statements condition - Add comment to uci default script --- .../files/etc/uci-defaults/98a-configure-gateway | 8 ++++++++ 1 file changed, 8 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..626f230 --- /dev/null +++ b/src/packages/fff/fff-gateway/files/etc/uci-defaults/98a-configure-gateway @@ -0,0 +1,8 @@ +#!/bin/sh + +# Reapply gateway settings, if configuration succeeds +if yes | configuregateway -c; then + configuregateway -a +else + configuregateway -r +fi