forked from freifunk-franken/firmware
configuregateway and it's gateway.d files represent a specific functionality that other packages depend on. Thus, it is put into a package of its own so dependencies can be expressed more properly. While at, use the chance to get rid of the ambiguous term "gateway" and rename the script to configure-layer3 and the folders to layer3.d. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Reviewed-by: Christian Dresel <freifunk@dresel.systems>
28 lines
698 B
Plaintext
28 lines
698 B
Plaintext
configure() {
|
|
# check if gateway config exists
|
|
if ! uci -q show gateway > /dev/null; then
|
|
echo "ERROR: Gateway config could not be parsed or does not exist."
|
|
|
|
return 1
|
|
fi
|
|
|
|
# check version of configuration
|
|
local expected_version=1
|
|
local config_version=$(uci -q get gateway.meta.config_version)
|
|
|
|
if ! [ -n "$config_version" ]; then
|
|
echo "ERROR: No config version given. Supported versions: '$expected_version'"
|
|
|
|
return 1
|
|
fi
|
|
|
|
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."
|
|
|
|
return 1
|
|
fi
|
|
|
|
return 0
|
|
}
|