2019-09-08 15:09:41 +02:00
|
|
|
configure() {
|
|
|
|
local expected_version=1
|
|
|
|
local config_version=$(uci -q get gateway.meta.config_version)
|
|
|
|
|
|
|
|
# check if gateway config exists
|
2020-04-26 13:49:49 +02:00
|
|
|
if ! uci -q show gateway > /dev/null; then
|
2019-09-08 15:09:41 +02:00
|
|
|
echo "ERROR: Gateway config could not be parsed or does not exist."
|
|
|
|
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# check version of configuration
|
2020-04-26 13:49:50 +02:00
|
|
|
if ! [ -n "$config_version" ]; then
|
|
|
|
echo "ERROR: No config version given. Supported versions: '$expected_version'"
|
|
|
|
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-09-08 15:09:41 +02:00
|
|
|
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
|
2020-04-26 13:49:51 +02:00
|
|
|
|
|
|
|
return 0
|
2019-09-08 15:09:41 +02:00
|
|
|
}
|