new file mode 100644
@@ -0,0 +1,17 @@
+#!/bin/sh
+# Copyright 2017 Adrian Schmutzler
+# License GPLv3
+
+# Set default values in /etc/config/fff
+
+touch /etc/config/fff
+
+if ! uci -q get fff.system > /dev/null ; then
+ uci set fff.system=fff
+ uci set "fff.system.hostname=FFF"
+fi
+
+uci set fff.ui=fff
+uci -q get fff.ui.portsetup > /dev/null || uci set "fff.ui.portsetup=default"
+
+uci commit fff
@@ -2,27 +2,24 @@
# Copyright 2017 Adrian Schmutzler
# License GPLv3
-touch /etc/config/fff
-
-if ! uci -q get fff.system > /dev/null ; then
- uci -q set fff.system=fff
- uci -q set "fff.system.hostname=FFF"
-fi
+# Apply configuration
FFF_hostname=$(uci -q get "fff.system.hostname")
-test -n "${FFF_hostname}" && uci -q set "system.@system[0].hostname=${FFF_hostname}"
+test -n "${FFF_hostname}" && uci set "system.@system[0].hostname=${FFF_hostname}"
test -n "${FFF_hostname}" && echo "${FFF_hostname}" > /proc/sys/kernel/hostname
+uci commit system
+
traffic_enabled=$(uci -q get "fff.trafficcontrol.enabled")
traffic_in=$(uci -q get "fff.trafficcontrol.limit_in")
traffic_out=$(uci -q get "fff.trafficcontrol.limit_out")
-test -n "${traffic_enabled}" && uci -q set "simple-tc.example.enabled=${traffic_enabled}"
-uci -q set "simple-tc.example.ifname=wan"
-uci -q set "simple-tc.example.limit_ingress=${traffic_in}"
-uci -q set "simple-tc.example.limit_egress=${traffic_out}"
+test -n "${traffic_enabled}" && uci set "simple-tc.example.enabled=${traffic_enabled}"
+uci set "simple-tc.example.ifname=wan"
+uci set "simple-tc.example.limit_ingress=${traffic_in}"
+uci set "simple-tc.example.limit_egress=${traffic_out}"
-uci -q commit
+uci commit simple-tc
poe_passthrough=$(uci -q get "fff.poe_passthrough.active")
if [ "$poe_passthrough" = "1" ] && [ -s /usr/lib/fff-support/activate_poe_passthrough.sh ] ; then
So far, the 98-configure-fff script did both the setup of the /etc/config/fff file (if it is was not there) and the application of settings from it. In this script, the setup part is moved to a much earlier stage, so /etc/config/fff is initialized when we need it in other scripts. While at it, remove error suppression for uci set commands and refine uci commit entries. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> --- .../fff-config/files/etc/uci-defaults/10-setup-fff | 17 +++++++++++++++++ .../files/etc/uci-defaults/98-configure-fff | 21 +++++++++------------ 2 files changed, 26 insertions(+), 12 deletions(-) create mode 100644 src/packages/fff/fff-config/files/etc/uci-defaults/10-setup-fff