forked from freifunk-franken/firmware
fff-gateway: Add sanity checks
This adds two checks: - Does gateway config exist? - Does gateway config version match? Signed-off-by: Fabian Bläse <fabian@blaese.de> Tested-by: Fabian Bläse <fabian@blaese.de> Reviewed-by: Robert Langhammer <rlanghammer@web.de>
This commit is contained in:
parent
40e1577a50
commit
c3f8b808ec
19
src/packages/fff/fff-gateway/files/etc/gateway.d/01-version
Normal file
19
src/packages/fff/fff-gateway/files/etc/gateway.d/01-version
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
configure() {
|
||||||
|
local expected_version=1
|
||||||
|
local config_version=$(uci -q get gateway.meta.config_version)
|
||||||
|
|
||||||
|
# check if gateway config exists
|
||||||
|
if ! uci show gateway > /dev/null; then
|
||||||
|
echo "ERROR: Gateway config could not be parsed or does not exist."
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check version of configuration
|
||||||
|
if [ "$config_version" != "$expected_version" ]; then
|
||||||
|
echo "ERROR: Invalid config version. Expected '$expected_version', got '$config_version'."
|
||||||
|
echo "Please check what has been changed and adjust your config appropriately."
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user