[v11,1/6] Rearrange fff config values into their own config file

Submitted by Adrian Schmutzler on Oct. 18, 2017, 9:30 p.m.

Details

Message ID 1508362258-8918-1-git-send-email-freifunk@adrianschmutzler.de
State Superseded
Headers show

Commit Message

Adrian Schmutzler Oct. 18, 2017, 9:30 p.m.
This moves the FFF configuration from
/etc/config/system to a new file /etc/config/fff. Thus,
this file can be copied as a whole during upgrade (with
compatibility provided) and then resulting values in
other files are re-set later.

This also fixes the bandwidth settings not being persistent
during upgrade. Other settings may join ...

I tried to go through all the code and update all occurrences
of the relevant system variables (looking for "system" both
in GitHub and my local src folder).

When downgrading, this requires rewriting the values into
the /etc/config/system. For this purpose, a script has
been added. (Which will be integrated into the WebUI in
another patch)

Changes in v11:
 - Redesign for keyexchange v2.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
---
 src/packages/fff/fff-config/Makefile               | 40 ++++++++++++++++++++++
 .../files/etc/uci-defaults/98-configure-fff        | 25 ++++++++++++++
 .../files/usr/sbin/prepare_firmware_downgrade.sh   | 23 +++++++++++++
 src/packages/fff/fff-hoods/Makefile                |  2 +-
 .../fff/fff-hoods/files/usr/sbin/configurehood     |  4 +--
 src/packages/fff/fff-nodewatcher/Makefile          |  4 +--
 .../fff/fff-nodewatcher/files/usr/sbin/nodewatcher | 20 +++++------
 src/packages/fff/fff-sysupgrade/Makefile           |  2 +-
 .../etc/uci-defaults/05-config-system-migration    | 36 +++++++++++--------
 .../files/etc/uci-defaults/99-fff-sysupgrade       |  2 +-
 src/packages/fff/fff-web/Makefile                  |  4 +--
 .../fff-web/files/www/public/cgi-bin/status.html   | 12 +++----
 .../fff/fff-web/files/www/ssl/cgi-bin/header       |  2 +-
 .../fff-web/files/www/ssl/cgi-bin/settings.html    | 39 ++++++++++++---------
 src/packages/fff/fff/Makefile                      |  1 +
 15 files changed, 159 insertions(+), 57 deletions(-)
 create mode 100644 src/packages/fff/fff-config/Makefile
 create mode 100644 src/packages/fff/fff-config/files/etc/uci-defaults/98-configure-fff
 create mode 100755 src/packages/fff/fff-config/files/usr/sbin/prepare_firmware_downgrade.sh

Patch hide | download patch | download mbox

diff --git a/src/packages/fff/fff-config/Makefile b/src/packages/fff/fff-config/Makefile
new file mode 100644
index 0000000..fe4f5df
--- /dev/null
+++ b/src/packages/fff/fff-config/Makefile
@@ -0,0 +1,40 @@ 
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=fff-config
+PKG_VERSION:=1
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/$(PKG_NAME)
+    SECTION:=base
+    CATEGORY:=Freifunk
+    TITLE:=Freifunk-Franken Config
+    URL:=http://www.freifunk-franken.de
+    DEPENDS:=+fff-boardname +@BUSYBOX_CONFIG_WGET
+endef
+
+define Package/$(PKG_NAME)/description
+    This is the Freifunk Franken Firmware Config package.
+    This packages provides utilities for a central FFF config file.
+endef
+
+define Build/Prepare
+    echo "all: " > $(PKG_BUILD_DIR)/Makefile
+endef
+
+define Build/Configure
+    # nothing
+endef
+
+define Build/Compile
+    # nothing
+endef
+
+define Package/$(PKG_NAME)/install
+    $(CP) ./files/* $(1)/
+endef
+
+$(eval $(call BuildPackage,$(PKG_NAME)))
diff --git a/src/packages/fff/fff-config/files/etc/uci-defaults/98-configure-fff b/src/packages/fff/fff-config/files/etc/uci-defaults/98-configure-fff
new file mode 100644
index 0000000..e337e88
--- /dev/null
+++ b/src/packages/fff/fff-config/files/etc/uci-defaults/98-configure-fff
@@ -0,0 +1,25 @@ 
+#!/bin/sh
+# 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=Freifunk-Router"
+fi
+
+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}" && echo "${FFF_hostname}" > /proc/sys/kernel/hostname
+
+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}"
+
+uci -q commit
diff --git a/src/packages/fff/fff-config/files/usr/sbin/prepare_firmware_downgrade.sh b/src/packages/fff/fff-config/files/usr/sbin/prepare_firmware_downgrade.sh
new file mode 100755
index 0000000..ab96ba4
--- /dev/null
+++ b/src/packages/fff/fff-config/files/usr/sbin/prepare_firmware_downgrade.sh
@@ -0,0 +1,23 @@ 
+#!/bin/sh
+
+if ! grep -q '/etc/config/system' /etc/sysupgrade.conf 2> /dev/null ; then
+	echo "/etc/config/system" >> /etc/sysupgrade.conf
+fi
+
+if [ -s /etc/config/fff ] ; then
+	UPGRADE_hostname=$(uci -q get "fff.system.hostname")
+	UPGRADE_description=$(uci -q get "fff.system.description")
+	UPGRADE_latitude=$(uci -q get "fff.system.latitude")
+	UPGRADE_longitude=$(uci -q get "fff.system.longitude")
+	UPGRADE_position_comment=$(uci -q get "fff.system.position_comment")
+	UPGRADE_contact=$(uci -q get "fff.system.contact")
+
+	test -n "${UPGRADE_hostname}" && uci -q set "system.@system[0].hostname=${UPGRADE_hostname}"
+	test -n "${UPGRADE_description}" && uci -q set "system.@system[0].description=${UPGRADE_description}"
+	test -n "${UPGRADE_latitude}" && uci -q set "system.@system[0].latitude=${UPGRADE_latitude}"
+	test -n "${UPGRADE_longitude}" && uci -q set "system.@system[0].longitude=${UPGRADE_longitude}"
+	test -n "${UPGRADE_position_comment}" && uci -q set "system.@system[0].position_comment=${UPGRADE_position_comment}"
+	test -n "${UPGRADE_contact}" && uci -q set "system.@system[0].contact=${UPGRADE_contact}"
+
+	uci -q commit system
+fi
diff --git a/src/packages/fff/fff-hoods/Makefile b/src/packages/fff/fff-hoods/Makefile
index dd22df4..11ab6d1 100644
--- a/src/packages/fff/fff-hoods/Makefile
+++ b/src/packages/fff/fff-hoods/Makefile
@@ -13,7 +13,7 @@  define Package/$(PKG_NAME)
     CATEGORY:=Freifunk
     TITLE:= Freifunk-Franken hoods
     URL:=http://www.freifunk-franken.de
-    DEPENDS:=+fff-network
+    DEPENDS:=+fff-network +fff-config
 endef
 
 define Package/$(PKG_NAME)/description
diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
index f7ddb6e..e7a6eda 100755
--- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
+++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
@@ -57,8 +57,8 @@  if [ -f /tmp/hiddenapflag ]; then
 	rm /tmp/hiddenapflag
 fi
 
-lat=$(uci -q get system.@system[0].latitude)
-long=$(uci -q get system.@system[0].longitude)
+lat=$(uci -q get fff.system.latitude)
+long=$(uci -q get fff.system.longitude)
 
 # if we have Internet, we download the Hoodfile from the keyxchangev2
 if hasInternet ; then
diff --git a/src/packages/fff/fff-nodewatcher/Makefile b/src/packages/fff/fff-nodewatcher/Makefile
index 79cb917..7bfd08e 100644
--- a/src/packages/fff/fff-nodewatcher/Makefile
+++ b/src/packages/fff/fff-nodewatcher/Makefile
@@ -1,7 +1,7 @@ 
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=fff-nodewatcher
-PKG_VERSION:=41
+PKG_VERSION:=43
 PKG_RELEASE:=1
 
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
@@ -13,7 +13,7 @@  define Package/$(PKG_NAME)
     CATEGORY:=Freifunk
     TITLE:= Freifunk-Franken Nodewatcher
     URL:=http://www.freifunk-franken.de
-    DEPENDS:=+alfred +micrond +fff-random +ip +ip-bridge
+    DEPENDS:=+alfred +micrond +fff-config +fff-random +ip +ip-bridge
 endef
 
 define Package/$(PKG_NAME)/description
diff --git a/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher b/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
index 35adf91..80548ac 100755
--- a/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
+++ b/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
@@ -2,7 +2,7 @@ 
 # Netmon Nodewatcher (C) 2010-2012 Freifunk Oldenburg
 # License; GPL v3
 
-SCRIPT_VERSION="41"
+SCRIPT_VERSION="43"
 
 test -f /tmp/started || exit
 
@@ -58,20 +58,20 @@  crawl() {
     hostname="$(cat /proc/sys/kernel/hostname)"
     mac=$(awk '{ mac=toupper($1); gsub(":", "", mac); print mac }' /sys/class/net/br-mesh/address 2>/dev/null)
     [ "$hostname" = "LEDE" ] && hostname="$mac"
-    description="$(uci get system.@system[0].description)"
+    description="$(uci -q get fff.system.description)"
     if [ -n "$description" ]; then
         description="<description><![CDATA[$description]]></description>"
     fi
-    latitude="$(uci get system.@system[0].latitude)"
-    longitude="$(uci get system.@system[0].longitude)"
+    latitude="$(uci -q get fff.system.latitude)"
+    longitude="$(uci -q get fff.system.longitude)"
     if [ -n "$longitude" -a -n "$latitude" ]; then
         geo="<geo><lat>$latitude</lat><lng>$longitude</lng></geo>";
     fi
-    position_comment="$(uci get system.@system[0].position_comment)"
+    position_comment="$(uci -q get fff.system.position_comment)"
     if [ -n "$position_comment" ]; then
         position_comment="<position_comment><![CDATA[$position_comment]]></position_comment>"
     fi
-    contact="$(uci get system.@system[0].contact)"
+    contact="$(uci -q get fff.system.contact)"
     if [ -n "$contact" ]; then
         contact="<contact>$contact</contact>"
     fi
@@ -137,10 +137,10 @@  crawl() {
     SYSTEM_DATA=$SYSTEM_DATA"${geo}"
     SYSTEM_DATA=$SYSTEM_DATA"${position_comment}"
     SYSTEM_DATA=$SYSTEM_DATA"${contact}"
-    if [ "$(uci -q get "system.@system[0].hood")" ] 
-    then                                                                                                                         
-        SYSTEM_DATA=$SYSTEM_DATA"<hood>$(uci -q get "system.@system[0].hood")</hood>"                                            
-    fi  
+    if [ "$(uci -q get "system.@system[0].hood")" ]
+    then
+        SYSTEM_DATA=$SYSTEM_DATA"<hood>$(uci -q get "system.@system[0].hood")</hood>"
+    fi
     SYSTEM_DATA=$SYSTEM_DATA"<distname>$distname</distname>"
     SYSTEM_DATA=$SYSTEM_DATA"<distversion>$distversion</distversion>"
     SYSTEM_DATA=$SYSTEM_DATA"$cpu"
diff --git a/src/packages/fff/fff-sysupgrade/Makefile b/src/packages/fff/fff-sysupgrade/Makefile
index ab809c9..b2e1ffa 100644
--- a/src/packages/fff/fff-sysupgrade/Makefile
+++ b/src/packages/fff/fff-sysupgrade/Makefile
@@ -13,7 +13,7 @@  define Package/$(PKG_NAME)
     CATEGORY:=Freifunk
     TITLE:=Freifunk-Franken sysupgrade
     URL:=http://www.freifunk-franken.de
-    DEPENDS:=+fff-boardname +fff-hoods +@BUSYBOX_CONFIG_WGET
+    DEPENDS:=+fff-boardname +fff-config +fff-hoods +@BUSYBOX_CONFIG_WGET
 endef
 
 define Package/$(PKG_NAME)/description
diff --git a/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/05-config-system-migration b/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/05-config-system-migration
index 0e36587..fe4ad97 100644
--- a/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/05-config-system-migration
+++ b/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/05-config-system-migration
@@ -1,21 +1,27 @@ 
 #!/bin/sh
 
-UPGRADE_hostname=$(uci -q get "system.@system[0].hostname")
-UPGRADE_description=$(uci -q get "system.@system[0].description")
-UPGRADE_latitude=$(uci -q get "system.@system[0].latitude")
-UPGRADE_longitude=$(uci -q get "system.@system[0].longitude")
-UPGRADE_position_comment=$(uci -q get "system.@system[0].position_comment")
-UPGRADE_contact=$(uci -q get "system.@system[0].contact")
+if [ ! -s /etc/config/fff ] ; then
 
-/bin/rm -rf /etc/config/system
+	UPGRADE_hostname=$(uci -q get "system.@system[0].hostname")
+	UPGRADE_description=$(uci -q get "system.@system[0].description")
+	UPGRADE_latitude=$(uci -q get "system.@system[0].latitude")
+	UPGRADE_longitude=$(uci -q get "system.@system[0].longitude")
+	UPGRADE_position_comment=$(uci -q get "system.@system[0].position_comment")
+	UPGRADE_contact=$(uci -q get "system.@system[0].contact")
 
-/bin/config_generate
+	/bin/rm -rf /etc/config/system
+	
+	/bin/config_generate
 
-test -n "${UPGRADE_hostname}" && uci -q set "system.@system[0].hostname=${UPGRADE_hostname}"
-test -n "${UPGRADE_description}" && uci -q set "system.@system[0].description=${UPGRADE_description}"
-test -n "${UPGRADE_latitude}" && uci -q set "system.@system[0].latitude=${UPGRADE_latitude}"
-test -n "${UPGRADE_longitude}" && uci -q set "system.@system[0].longitude=${UPGRADE_longitude}"
-test -n "${UPGRADE_position_comment}" && uci -q set "system.@system[0].position_comment=${UPGRADE_position_comment}"
-test -n "${UPGRADE_contact}" && uci -q set "system.@system[0].contact=${UPGRADE_contact}"
+	touch /etc/config/fff
 
-uci -q commit system
+	uci -q set fff.system=fff
+	test -n "${UPGRADE_hostname}" && uci -q set "fff.system.hostname=${UPGRADE_hostname}"
+	test -n "${UPGRADE_description}" && uci -q set "fff.system.description=${UPGRADE_description}"
+	test -n "${UPGRADE_latitude}" && uci -q set "fff.system.latitude=${UPGRADE_latitude}"
+	test -n "${UPGRADE_longitude}" && uci -q set "fff.system.longitude=${UPGRADE_longitude}"
+	test -n "${UPGRADE_position_comment}" && uci -q set "fff.system.position_comment=${UPGRADE_position_comment}"
+	test -n "${UPGRADE_contact}" && uci -q set "fff.system.contact=${UPGRADE_contact}"
+
+	uci -q commit fff
+fi
diff --git a/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/99-fff-sysupgrade b/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/99-fff-sysupgrade
index ab6f2de..847ce1e 100644
--- a/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/99-fff-sysupgrade
+++ b/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/99-fff-sysupgrade
@@ -8,5 +8,5 @@  cat > /etc/sysupgrade.conf <<-__EOF__
 /etc/dropbear/dropbear_rsa_host_key
 /etc/dropbear/authorized_keys
 /etc/network.config
-/etc/config/system
+/etc/config/fff
 __EOF__
diff --git a/src/packages/fff/fff-web/Makefile b/src/packages/fff/fff-web/Makefile
index 708dbb9..d7201e2 100644
--- a/src/packages/fff/fff-web/Makefile
+++ b/src/packages/fff/fff-web/Makefile
@@ -1,7 +1,7 @@ 
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=fff-web
-PKG_VERSION:=0.0.4
+PKG_VERSION:=5
 PKG_RELEASE:=2
 
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
@@ -13,7 +13,7 @@  define Package/$(PKG_NAME)
     CATEGORY:=Freifunk
     TITLE:= Freifunk-Franken Webinterface
     URL:=http://www.freifunk-franken.de
-    DEPENDS:=+uhttpd +libustream-mbedtls +haserl +px5g +simple-tc +fff-boardname +fff-network
+    DEPENDS:=+uhttpd +libustream-mbedtls +haserl +px5g +simple-tc +fff-boardname +fff-config +fff-network
 endef
 
 define Package/$(PKG_NAME)/description
diff --git a/src/packages/fff/fff-web/files/www/public/cgi-bin/status.html b/src/packages/fff/fff-web/files/www/public/cgi-bin/status.html
index f96846c..96d657b 100755
--- a/src/packages/fff/fff-web/files/www/public/cgi-bin/status.html
+++ b/src/packages/fff/fff-web/files/www/public/cgi-bin/status.html
@@ -2,13 +2,13 @@ 
 
 <%
 echo -en "Content-Type: text/html\r\n\r\n"
-HOSTNAME=$(uci -q get 'system.@system[0].hostname')
+HOSTNAME="$(uci -q get "fff.system.hostname")"
 hood="$(uci -q get "system.@system[0].hood")"
 
 MAC="$(uci -q get network.mesh.macaddr)"
-lat="$(uci -q get system.@system[0].latitude)"
-lon="$(uci -q get system.@system[0].longitude)"
-contact="$(uci -q get system.@system[0].contact)"
+lat="$(uci -q get "fff.system.latitude")"
+lon="$(uci -q get "fff.system.longitude")"
+contact="$(uci -q get "fff.system.contact")"
 
 . /etc/firmware_release
 
@@ -48,11 +48,11 @@  contact="$(uci -q get system.@system[0].contact)"
 								<tr><th>MAC-Adresse:</th><td style="text-transform: uppercase;"><a href="https://monitoring.freifunk-franken.de/api/get_router_by_mac/<%= $MAC %>"><%= $MAC %></a></td></tr>
 								<tr><th>Modell:</th><td><% cat /tmp/sysinfo/model 2>/dev/null %></td></tr>
 								<tr><th>Firmware:</th><td><%= ${FIRMWARE_VERSION} %></td></tr>
-								<tr><th>Beschreibung:</th><td><% uci -q get 'system.@system[0].description' %></td></tr>
+								<tr><th>Beschreibung:</th><td><% uci -q get 'fff.system.description' %></td></tr>
 								<tr><th>Position:</th><td><% if [ -n "$lat" -a -n "$lon" ]; then
 									echo "<a href=\"https://monitoring.freifunk-franken.de/map?mapcenter=$lat,$lon,16\">${lat:0:8}N, ${lon:0:8}E</a>"
 								fi %></td></tr>
-								<tr><th>Standort:</th><td><% uci -q get 'system.@system[0].position_comment' %></td></tr>
+								<tr><th>Standort:</th><td><% uci -q get 'fff.system.position_comment' %></td></tr>
 								<tr><th>E-Mail Adresse:</th><td><a href="mailto:<%= $contact %>"><%= $contact %></a></td></tr>
 							</table>
 						</fieldset>
diff --git a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/header b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/header
index c327013..f98a3f3 100755
--- a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/header
+++ b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/header
@@ -12,7 +12,7 @@  nav_entry() {
 	echo -ne "\t<li${class_active}><a href=\"${script_file}\">$2</a></li>\n\t\t"
 }
 
-HOSTNAME=$(uci -q get 'system.@system[0].hostname')
+HOSTNAME="$(uci -q get "fff.system.hostname")"
 hood="$(uci -q get "system.@system[0].hood")"
 
 NOW=$(date +%s)
diff --git a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/settings.html b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/settings.html
index e7bc3e9..b785aed 100755
--- a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/settings.html
+++ b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/settings.html
@@ -13,25 +13,32 @@  if [ "$REQUEST_METHOD" == "POST" ] ; then
 		MSG='<span class="red">Knotenname enth&auml;lt ung&uuml;ltige Zeichen!</span>'
 	else
 		# Allgemeine Einstellungen
+		uci -q set "fff.system.hostname=${POST_hostname}"
+		echo "$(uci -q get "fff.system.hostname")" > /proc/sys/kernel/hostname
 		uci -q set "system.@system[0].hostname=${POST_hostname}"
-		echo "$(uci -q get "system.@system[0].hostname")" > /proc/sys/kernel/hostname
-		uci -q set "system.@system[0].description=${POST_description}"
-		uci -q set "system.@system[0].latitude=${POST_latitude}"
-		uci -q set "system.@system[0].longitude=${POST_longitude}"
-		uci -q set "system.@system[0].position_comment=${POST_position_comment}"
-		uci -q set "system.@system[0].contact=${POST_contact}"
+		uci -q set "fff.system.description=${POST_description}"
+		uci -q set "fff.system.latitude=${POST_latitude}"
+		uci -q set "fff.system.longitude=${POST_longitude}"
+		uci -q set "fff.system.position_comment=${POST_position_comment}"
+		uci -q set "fff.system.contact=${POST_contact}"
 
 		# Bitratenbegrenzung
+		uci -q get "fff.trafficcontrol" > /dev/null || uci -q set fff.trafficcontrol=fff
 		if [ "$POST_traffic_limit" == "on" ] ; then
-			uci -q set "simple-tc.example.ifname=wan"
+			uci -q set "fff.trafficcontrol.enabled=1"
 			uci -q set "simple-tc.example.enabled=1"
 		else
+			uci -q set "fff.trafficcontrol.enabled=0"
 			uci -q set "simple-tc.example.enabled=0"
 		fi
+		uci -q set "fff.trafficcontrol.limit_in=${POST_limit_ingress}"
+		uci -q set "fff.trafficcontrol.limit_out=${POST_limit_egress}"
+		
+		uci -q set "simple-tc.example.ifname=wan"
 		uci -q set "simple-tc.example.limit_ingress=${POST_limit_ingress}"
 		uci -q set "simple-tc.example.limit_egress=${POST_limit_egress}"
 
-		uci commit
+		uci -q commit
 
 		MSG='<span class="green">Daten gespeichert! - Bitte Router neustarten.</span>'
 	fi
@@ -41,7 +48,7 @@  fi
 <%in /www/ssl/cgi-bin/helpers %>
 <%
 # read
-if [ "$(uci -q get 'simple-tc.example.enabled')" == "1" ] ; then
+if [ "$(uci -q get 'fff.trafficcontrol.enabled')" == "1" ] ; then
 	traffic_checked='checked="checked" '
 else
 	traffic_checked=""
@@ -55,16 +62,16 @@  fi
 	<legend>Allgemeine Einstellungen</legend>
 	<table>
 		<tr><th>Knotenname:</th><td><input type="text" name="hostname" value="<%= ${HOSTNAME} %>" /></td></tr>
-		<tr><th>Knotenbeschreibung:</th><td><input type="text" name="description" value="<%= $(uci -q get 'system.@system[0].description') %>" /></td></tr>
+		<tr><th>Knotenbeschreibung:</th><td><input type="text" name="description" value="<%= $(uci -q get 'fff.system.description') %>" /></td></tr>
 		<tr><th>GPS Breitengrad:</th>
-			<td><input type="text" name="latitude" value="<%= $(uci -q get 'system.@system[0].latitude') %>" /></td>
+			<td><input type="text" name="latitude" value="<%= $(uci -q get 'fff.system.latitude') %>" /></td>
 			<td rowspan="2" style="vertical-align: middle;">
 				<button type="button" style="height: 100%; width: 126px; margin-left: 5px;" onclick="window.open('/map.html', '_blank', 'location=0,status=0,scrollbars=1,width=400,height=300');">Position auf Karte anzeigen / setzen</button>
 			</td>
 		</tr>
-		<tr><th>GPS L&auml;ngengrad:</th><td><input type="text" name="longitude" value="<%= $(uci -q get 'system.@system[0].longitude') %>" /></td></tr>
-		<tr><th>Standortbeschreibung:</th><td><input type="text" name="position_comment" value="<%= $(uci -q get 'system.@system[0].position_comment') %>" /></td></tr>
-		<tr><th>E-Mail Adresse:</th><td><input type="email" name="contact" value="<%= $(uci -q get 'system.@system[0].contact') %>" /></td></tr>
+		<tr><th>GPS L&auml;ngengrad:</th><td><input type="text" name="longitude" value="<%= $(uci -q get 'fff.system.longitude') %>" /></td></tr>
+		<tr><th>Standortbeschreibung:</th><td><input type="text" name="position_comment" value="<%= $(uci -q get 'fff.system.position_comment') %>" /></td></tr>
+		<tr><th>E-Mail Adresse:</th><td><input type="email" name="contact" value="<%= $(uci -q get 'fff.system.contact') %>" /></td></tr>
 	</table>
 </fieldset>
 </td><td>
@@ -74,8 +81,8 @@  fi
 		<tr><th>Aktiviert:</th><td colspan="2">
 			<input type="checkbox" name="traffic_limit" <%= ${traffic_checked} %>/>
 		</td></tr>
-		<tr><th>Freifunk&nbsp;Download:</th><td><input type="text" name="limit_ingress" value="<%= $(uci -q get 'simple-tc.example.limit_ingress') %>" /></td><td>kbit/s</td></tr>
-		<tr><th>Freifunk&nbsp;Upload:</th><td><input type="text" name="limit_egress" value="<%= $(uci -q get 'simple-tc.example.limit_egress') %>" /></td><td>kbit/s</td></tr>
+		<tr><th>Freifunk&nbsp;Download:</th><td><input type="text" name="limit_ingress" value="<%= $(uci -q get 'fff.trafficcontrol.limit_in') %>" /></td><td>kbit/s</td></tr>
+		<tr><th>Freifunk&nbsp;Upload:</th><td><input type="text" name="limit_egress" value="<%= $(uci -q get 'fff.trafficcontrol.limit_out') %>" /></td><td>kbit/s</td></tr>
 	</table>
 </fieldset>
 </td></tr>
diff --git a/src/packages/fff/fff/Makefile b/src/packages/fff/fff/Makefile
index 305ab8d..dce33f9 100644
--- a/src/packages/fff/fff/Makefile
+++ b/src/packages/fff/fff/Makefile
@@ -18,6 +18,7 @@  define Package/fff-base
              +ip6tables \
              +odhcp6c \
              +micrond \
+             +fff-config \
              +fff-nodewatcher \
              +fff-web \
              +fff-uradvd \

Comments

Tim Niemeyer Nov. 2, 2017, 9:38 p.m.
Hi

Am Mittwoch, den 18.10.2017, 23:30 +0200 schrieb Adrian Schmutzler:
> This moves the FFF configuration from
> /etc/config/system to a new file /etc/config/fff. Thus,
> this file can be copied as a whole during upgrade (with
> compatibility provided) and then resulting values in
> other files are re-set later.
> 
> This also fixes the bandwidth settings not being persistent
> during upgrade. Other settings may join ...
> 
> I tried to go through all the code and update all occurrences
> of the relevant system variables (looking for "system" both
> in GitHub and my local src folder).
> 
> When downgrading, this requires rewriting the values into
> the /etc/config/system. For this purpose, a script has
> been added. (Which will be integrated into the WebUI in
> another patch)

Downgrad supporten wir nicht. Wer das machen will, muss die Config
verlieren. Alleine das wir ein Upgrade supporten ist schon Arbeit genug.
Der Teil kann also weg.

Tim

PS: Bin mir dem Review noch nicht fertig, bitte noch warten bis du ein
neues Patchset schickst.

> 
> Changes in v11:
>  - Redesign for keyexchange v2.
> 
> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> ---
>  src/packages/fff/fff-config/Makefile               | 40 ++++++++++++++++++++++
>  .../files/etc/uci-defaults/98-configure-fff        | 25 ++++++++++++++
>  .../files/usr/sbin/prepare_firmware_downgrade.sh   | 23 +++++++++++++
>  src/packages/fff/fff-hoods/Makefile                |  2 +-
>  .../fff/fff-hoods/files/usr/sbin/configurehood     |  4 +--
>  src/packages/fff/fff-nodewatcher/Makefile          |  4 +--
>  .../fff/fff-nodewatcher/files/usr/sbin/nodewatcher | 20 +++++------
>  src/packages/fff/fff-sysupgrade/Makefile           |  2 +-
>  .../etc/uci-defaults/05-config-system-migration    | 36 +++++++++++--------
>  .../files/etc/uci-defaults/99-fff-sysupgrade       |  2 +-
>  src/packages/fff/fff-web/Makefile                  |  4 +--
>  .../fff-web/files/www/public/cgi-bin/status.html   | 12 +++----
>  .../fff/fff-web/files/www/ssl/cgi-bin/header       |  2 +-
>  .../fff-web/files/www/ssl/cgi-bin/settings.html    | 39 ++++++++++++---------
>  src/packages/fff/fff/Makefile                      |  1 +
>  15 files changed, 159 insertions(+), 57 deletions(-)
>  create mode 100644 src/packages/fff/fff-config/Makefile
>  create mode 100644 src/packages/fff/fff-config/files/etc/uci-defaults/98-configure-fff
>  create mode 100755 src/packages/fff/fff-config/files/usr/sbin/prepare_firmware_downgrade.sh
> 
> diff --git a/src/packages/fff/fff-config/Makefile b/src/packages/fff/fff-config/Makefile
> new file mode 100644
> index 0000000..fe4f5df
> --- /dev/null
> +++ b/src/packages/fff/fff-config/Makefile
> @@ -0,0 +1,40 @@
> +include $(TOPDIR)/rules.mk
> +
> +PKG_NAME:=fff-config
> +PKG_VERSION:=1
> +PKG_RELEASE:=1
> +
> +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
> +
> +include $(INCLUDE_DIR)/package.mk
> +
> +define Package/$(PKG_NAME)
> +    SECTION:=base
> +    CATEGORY:=Freifunk
> +    TITLE:=Freifunk-Franken Config
> +    URL:=http://www.freifunk-franken.de
> +    DEPENDS:=+fff-boardname +@BUSYBOX_CONFIG_WGET
> +endef
> +
> +define Package/$(PKG_NAME)/description
> +    This is the Freifunk Franken Firmware Config package.
> +    This packages provides utilities for a central FFF config file.
> +endef
> +
> +define Build/Prepare
> +    echo "all: " > $(PKG_BUILD_DIR)/Makefile
> +endef
> +
> +define Build/Configure
> +    # nothing
> +endef
> +
> +define Build/Compile
> +    # nothing
> +endef
> +
> +define Package/$(PKG_NAME)/install
> +    $(CP) ./files/* $(1)/
> +endef
> +
> +$(eval $(call BuildPackage,$(PKG_NAME)))
> diff --git a/src/packages/fff/fff-config/files/etc/uci-defaults/98-configure-fff b/src/packages/fff/fff-config/files/etc/uci-defaults/98-configure-fff
> new file mode 100644
> index 0000000..e337e88
> --- /dev/null
> +++ b/src/packages/fff/fff-config/files/etc/uci-defaults/98-configure-fff
> @@ -0,0 +1,25 @@
> +#!/bin/sh
> +# 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=Freifunk-Router"
> +fi
> +
> +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}" && echo "${FFF_hostname}" > /proc/sys/kernel/hostname
> +
> +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}"
> +
> +uci -q commit
> diff --git a/src/packages/fff/fff-config/files/usr/sbin/prepare_firmware_downgrade.sh b/src/packages/fff/fff-config/files/usr/sbin/prepare_firmware_downgrade.sh
> new file mode 100755
> index 0000000..ab96ba4
> --- /dev/null
> +++ b/src/packages/fff/fff-config/files/usr/sbin/prepare_firmware_downgrade.sh
> @@ -0,0 +1,23 @@
> +#!/bin/sh
> +
> +if ! grep -q '/etc/config/system' /etc/sysupgrade.conf 2> /dev/null ; then
> +	echo "/etc/config/system" >> /etc/sysupgrade.conf
> +fi
> +
> +if [ -s /etc/config/fff ] ; then
> +	UPGRADE_hostname=$(uci -q get "fff.system.hostname")
> +	UPGRADE_description=$(uci -q get "fff.system.description")
> +	UPGRADE_latitude=$(uci -q get "fff.system.latitude")
> +	UPGRADE_longitude=$(uci -q get "fff.system.longitude")
> +	UPGRADE_position_comment=$(uci -q get "fff.system.position_comment")
> +	UPGRADE_contact=$(uci -q get "fff.system.contact")
> +
> +	test -n "${UPGRADE_hostname}" && uci -q set "system.@system[0].hostname=${UPGRADE_hostname}"
> +	test -n "${UPGRADE_description}" && uci -q set "system.@system[0].description=${UPGRADE_description}"
> +	test -n "${UPGRADE_latitude}" && uci -q set "system.@system[0].latitude=${UPGRADE_latitude}"
> +	test -n "${UPGRADE_longitude}" && uci -q set "system.@system[0].longitude=${UPGRADE_longitude}"
> +	test -n "${UPGRADE_position_comment}" && uci -q set "system.@system[0].position_comment=${UPGRADE_position_comment}"
> +	test -n "${UPGRADE_contact}" && uci -q set "system.@system[0].contact=${UPGRADE_contact}"
> +
> +	uci -q commit system
> +fi
> diff --git a/src/packages/fff/fff-hoods/Makefile b/src/packages/fff/fff-hoods/Makefile
> index dd22df4..11ab6d1 100644
> --- a/src/packages/fff/fff-hoods/Makefile
> +++ b/src/packages/fff/fff-hoods/Makefile
> @@ -13,7 +13,7 @@ define Package/$(PKG_NAME)
>      CATEGORY:=Freifunk
>      TITLE:= Freifunk-Franken hoods
>      URL:=http://www.freifunk-franken.de
> -    DEPENDS:=+fff-network
> +    DEPENDS:=+fff-network +fff-config
>  endef
>  
>  define Package/$(PKG_NAME)/description
> diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> index f7ddb6e..e7a6eda 100755
> --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> @@ -57,8 +57,8 @@ if [ -f /tmp/hiddenapflag ]; then
>  	rm /tmp/hiddenapflag
>  fi
>  
> -lat=$(uci -q get system.@system[0].latitude)
> -long=$(uci -q get system.@system[0].longitude)
> +lat=$(uci -q get fff.system.latitude)
> +long=$(uci -q get fff.system.longitude)
>  
>  # if we have Internet, we download the Hoodfile from the keyxchangev2
>  if hasInternet ; then
> diff --git a/src/packages/fff/fff-nodewatcher/Makefile b/src/packages/fff/fff-nodewatcher/Makefile
> index 79cb917..7bfd08e 100644
> --- a/src/packages/fff/fff-nodewatcher/Makefile
> +++ b/src/packages/fff/fff-nodewatcher/Makefile
> @@ -1,7 +1,7 @@
>  include $(TOPDIR)/rules.mk
>  
>  PKG_NAME:=fff-nodewatcher
> -PKG_VERSION:=41
> +PKG_VERSION:=43
>  PKG_RELEASE:=1
>  
>  PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
> @@ -13,7 +13,7 @@ define Package/$(PKG_NAME)
>      CATEGORY:=Freifunk
>      TITLE:= Freifunk-Franken Nodewatcher
>      URL:=http://www.freifunk-franken.de
> -    DEPENDS:=+alfred +micrond +fff-random +ip +ip-bridge
> +    DEPENDS:=+alfred +micrond +fff-config +fff-random +ip +ip-bridge
>  endef
>  
>  define Package/$(PKG_NAME)/description
> diff --git a/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher b/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
> index 35adf91..80548ac 100755
> --- a/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
> +++ b/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
> @@ -2,7 +2,7 @@
>  # Netmon Nodewatcher (C) 2010-2012 Freifunk Oldenburg
>  # License; GPL v3
>  
> -SCRIPT_VERSION="41"
> +SCRIPT_VERSION="43"
>  
>  test -f /tmp/started || exit
>  
> @@ -58,20 +58,20 @@ crawl() {
>      hostname="$(cat /proc/sys/kernel/hostname)"
>      mac=$(awk '{ mac=toupper($1); gsub(":", "", mac); print mac }' /sys/class/net/br-mesh/address 2>/dev/null)
>      [ "$hostname" = "LEDE" ] && hostname="$mac"
> -    description="$(uci get system.@system[0].description)"
> +    description="$(uci -q get fff.system.description)"
>      if [ -n "$description" ]; then
>          description="<description><![CDATA[$description]]></description>"
>      fi
> -    latitude="$(uci get system.@system[0].latitude)"
> -    longitude="$(uci get system.@system[0].longitude)"
> +    latitude="$(uci -q get fff.system.latitude)"
> +    longitude="$(uci -q get fff.system.longitude)"
>      if [ -n "$longitude" -a -n "$latitude" ]; then
>          geo="<geo><lat>$latitude</lat><lng>$longitude</lng></geo>";
>      fi
> -    position_comment="$(uci get system.@system[0].position_comment)"
> +    position_comment="$(uci -q get fff.system.position_comment)"
>      if [ -n "$position_comment" ]; then
>          position_comment="<position_comment><![CDATA[$position_comment]]></position_comment>"
>      fi
> -    contact="$(uci get system.@system[0].contact)"
> +    contact="$(uci -q get fff.system.contact)"
>      if [ -n "$contact" ]; then
>          contact="<contact>$contact</contact>"
>      fi
> @@ -137,10 +137,10 @@ crawl() {
>      SYSTEM_DATA=$SYSTEM_DATA"${geo}"
>      SYSTEM_DATA=$SYSTEM_DATA"${position_comment}"
>      SYSTEM_DATA=$SYSTEM_DATA"${contact}"
> -    if [ "$(uci -q get "system.@system[0].hood")" ] 
> -    then                                                                                                                         
> -        SYSTEM_DATA=$SYSTEM_DATA"<hood>$(uci -q get "system.@system[0].hood")</hood>"                                            
> -    fi  
> +    if [ "$(uci -q get "system.@system[0].hood")" ]
> +    then
> +        SYSTEM_DATA=$SYSTEM_DATA"<hood>$(uci -q get "system.@system[0].hood")</hood>"
> +    fi
>      SYSTEM_DATA=$SYSTEM_DATA"<distname>$distname</distname>"
>      SYSTEM_DATA=$SYSTEM_DATA"<distversion>$distversion</distversion>"
>      SYSTEM_DATA=$SYSTEM_DATA"$cpu"
> diff --git a/src/packages/fff/fff-sysupgrade/Makefile b/src/packages/fff/fff-sysupgrade/Makefile
> index ab809c9..b2e1ffa 100644
> --- a/src/packages/fff/fff-sysupgrade/Makefile
> +++ b/src/packages/fff/fff-sysupgrade/Makefile
> @@ -13,7 +13,7 @@ define Package/$(PKG_NAME)
>      CATEGORY:=Freifunk
>      TITLE:=Freifunk-Franken sysupgrade
>      URL:=http://www.freifunk-franken.de
> -    DEPENDS:=+fff-boardname +fff-hoods +@BUSYBOX_CONFIG_WGET
> +    DEPENDS:=+fff-boardname +fff-config +fff-hoods +@BUSYBOX_CONFIG_WGET
>  endef
>  
>  define Package/$(PKG_NAME)/description
> diff --git a/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/05-config-system-migration b/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/05-config-system-migration
> index 0e36587..fe4ad97 100644
> --- a/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/05-config-system-migration
> +++ b/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/05-config-system-migration
> @@ -1,21 +1,27 @@
>  #!/bin/sh
>  
> -UPGRADE_hostname=$(uci -q get "system.@system[0].hostname")
> -UPGRADE_description=$(uci -q get "system.@system[0].description")
> -UPGRADE_latitude=$(uci -q get "system.@system[0].latitude")
> -UPGRADE_longitude=$(uci -q get "system.@system[0].longitude")
> -UPGRADE_position_comment=$(uci -q get "system.@system[0].position_comment")
> -UPGRADE_contact=$(uci -q get "system.@system[0].contact")
> +if [ ! -s /etc/config/fff ] ; then
>  
> -/bin/rm -rf /etc/config/system
> +	UPGRADE_hostname=$(uci -q get "system.@system[0].hostname")
> +	UPGRADE_description=$(uci -q get "system.@system[0].description")
> +	UPGRADE_latitude=$(uci -q get "system.@system[0].latitude")
> +	UPGRADE_longitude=$(uci -q get "system.@system[0].longitude")
> +	UPGRADE_position_comment=$(uci -q get "system.@system[0].position_comment")
> +	UPGRADE_contact=$(uci -q get "system.@system[0].contact")
>  
> -/bin/config_generate
> +	/bin/rm -rf /etc/config/system
> +	
> +	/bin/config_generate
>  
> -test -n "${UPGRADE_hostname}" && uci -q set "system.@system[0].hostname=${UPGRADE_hostname}"
> -test -n "${UPGRADE_description}" && uci -q set "system.@system[0].description=${UPGRADE_description}"
> -test -n "${UPGRADE_latitude}" && uci -q set "system.@system[0].latitude=${UPGRADE_latitude}"
> -test -n "${UPGRADE_longitude}" && uci -q set "system.@system[0].longitude=${UPGRADE_longitude}"
> -test -n "${UPGRADE_position_comment}" && uci -q set "system.@system[0].position_comment=${UPGRADE_position_comment}"
> -test -n "${UPGRADE_contact}" && uci -q set "system.@system[0].contact=${UPGRADE_contact}"
> +	touch /etc/config/fff
>  
> -uci -q commit system
> +	uci -q set fff.system=fff
> +	test -n "${UPGRADE_hostname}" && uci -q set "fff.system.hostname=${UPGRADE_hostname}"
> +	test -n "${UPGRADE_description}" && uci -q set "fff.system.description=${UPGRADE_description}"
> +	test -n "${UPGRADE_latitude}" && uci -q set "fff.system.latitude=${UPGRADE_latitude}"
> +	test -n "${UPGRADE_longitude}" && uci -q set "fff.system.longitude=${UPGRADE_longitude}"
> +	test -n "${UPGRADE_position_comment}" && uci -q set "fff.system.position_comment=${UPGRADE_position_comment}"
> +	test -n "${UPGRADE_contact}" && uci -q set "fff.system.contact=${UPGRADE_contact}"
> +
> +	uci -q commit fff
> +fi
> diff --git a/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/99-fff-sysupgrade b/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/99-fff-sysupgrade
> index ab6f2de..847ce1e 100644
> --- a/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/99-fff-sysupgrade
> +++ b/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/99-fff-sysupgrade
> @@ -8,5 +8,5 @@ cat > /etc/sysupgrade.conf <<-__EOF__
>  /etc/dropbear/dropbear_rsa_host_key
>  /etc/dropbear/authorized_keys
>  /etc/network.config
> -/etc/config/system
> +/etc/config/fff
>  __EOF__
> diff --git a/src/packages/fff/fff-web/Makefile b/src/packages/fff/fff-web/Makefile
> index 708dbb9..d7201e2 100644
> --- a/src/packages/fff/fff-web/Makefile
> +++ b/src/packages/fff/fff-web/Makefile
> @@ -1,7 +1,7 @@
>  include $(TOPDIR)/rules.mk
>  
>  PKG_NAME:=fff-web
> -PKG_VERSION:=0.0.4
> +PKG_VERSION:=5
>  PKG_RELEASE:=2
>  
>  PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
> @@ -13,7 +13,7 @@ define Package/$(PKG_NAME)
>      CATEGORY:=Freifunk
>      TITLE:= Freifunk-Franken Webinterface
>      URL:=http://www.freifunk-franken.de
> -    DEPENDS:=+uhttpd +libustream-mbedtls +haserl +px5g +simple-tc +fff-boardname +fff-network
> +    DEPENDS:=+uhttpd +libustream-mbedtls +haserl +px5g +simple-tc +fff-boardname +fff-config +fff-network
>  endef
>  
>  define Package/$(PKG_NAME)/description
> diff --git a/src/packages/fff/fff-web/files/www/public/cgi-bin/status.html b/src/packages/fff/fff-web/files/www/public/cgi-bin/status.html
> index f96846c..96d657b 100755
> --- a/src/packages/fff/fff-web/files/www/public/cgi-bin/status.html
> +++ b/src/packages/fff/fff-web/files/www/public/cgi-bin/status.html
> @@ -2,13 +2,13 @@
>  
>  <%
>  echo -en "Content-Type: text/html\r\n\r\n"
> -HOSTNAME=$(uci -q get 'system.@system[0].hostname')
> +HOSTNAME="$(uci -q get "fff.system.hostname")"
>  hood="$(uci -q get "system.@system[0].hood")"
>  
>  MAC="$(uci -q get network.mesh.macaddr)"
> -lat="$(uci -q get system.@system[0].latitude)"
> -lon="$(uci -q get system.@system[0].longitude)"
> -contact="$(uci -q get system.@system[0].contact)"
> +lat="$(uci -q get "fff.system.latitude")"
> +lon="$(uci -q get "fff.system.longitude")"
> +contact="$(uci -q get "fff.system.contact")"
>  
>  . /etc/firmware_release
>  
> @@ -48,11 +48,11 @@ contact="$(uci -q get system.@system[0].contact)"
>  								<tr><th>MAC-Adresse:</th><td style="text-transform: uppercase;"><a href="https://monitoring.freifunk-franken.de/api/get_router_by_mac/<%= $MAC %>"><%= $MAC %></a></td></tr>
>  								<tr><th>Modell:</th><td><% cat /tmp/sysinfo/model 2>/dev/null %></td></tr>
>  								<tr><th>Firmware:</th><td><%= ${FIRMWARE_VERSION} %></td></tr>
> -								<tr><th>Beschreibung:</th><td><% uci -q get 'system.@system[0].description' %></td></tr>
> +								<tr><th>Beschreibung:</th><td><% uci -q get 'fff.system.description' %></td></tr>
>  								<tr><th>Position:</th><td><% if [ -n "$lat" -a -n "$lon" ]; then
>  									echo "<a href=\"https://monitoring.freifunk-franken.de/map?mapcenter=$lat,$lon,16\">${lat:0:8}N, ${lon:0:8}E</a>"
>  								fi %></td></tr>
> -								<tr><th>Standort:</th><td><% uci -q get 'system.@system[0].position_comment' %></td></tr>
> +								<tr><th>Standort:</th><td><% uci -q get 'fff.system.position_comment' %></td></tr>
>  								<tr><th>E-Mail Adresse:</th><td><a href="mailto:<%= $contact %>"><%= $contact %></a></td></tr>
>  							</table>
>  						</fieldset>
> diff --git a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/header b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/header
> index c327013..f98a3f3 100755
> --- a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/header
> +++ b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/header
> @@ -12,7 +12,7 @@ nav_entry() {
>  	echo -ne "\t<li${class_active}><a href=\"${script_file}\">$2</a></li>\n\t\t"
>  }
>  
> -HOSTNAME=$(uci -q get 'system.@system[0].hostname')
> +HOSTNAME="$(uci -q get "fff.system.hostname")"
>  hood="$(uci -q get "system.@system[0].hood")"
>  
>  NOW=$(date +%s)
> diff --git a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/settings.html b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/settings.html
> index e7bc3e9..b785aed 100755
> --- a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/settings.html
> +++ b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/settings.html
> @@ -13,25 +13,32 @@ if [ "$REQUEST_METHOD" == "POST" ] ; then
>  		MSG='<span class="red">Knotenname enth&auml;lt ung&uuml;ltige Zeichen!</span>'
>  	else
>  		# Allgemeine Einstellungen
> +		uci -q set "fff.system.hostname=${POST_hostname}"
> +		echo "$(uci -q get "fff.system.hostname")" > /proc/sys/kernel/hostname
>  		uci -q set "system.@system[0].hostname=${POST_hostname}"
> -		echo "$(uci -q get "system.@system[0].hostname")" > /proc/sys/kernel/hostname
> -		uci -q set "system.@system[0].description=${POST_description}"
> -		uci -q set "system.@system[0].latitude=${POST_latitude}"
> -		uci -q set "system.@system[0].longitude=${POST_longitude}"
> -		uci -q set "system.@system[0].position_comment=${POST_position_comment}"
> -		uci -q set "system.@system[0].contact=${POST_contact}"
> +		uci -q set "fff.system.description=${POST_description}"
> +		uci -q set "fff.system.latitude=${POST_latitude}"
> +		uci -q set "fff.system.longitude=${POST_longitude}"
> +		uci -q set "fff.system.position_comment=${POST_position_comment}"
> +		uci -q set "fff.system.contact=${POST_contact}"
>  
>  		# Bitratenbegrenzung
> +		uci -q get "fff.trafficcontrol" > /dev/null || uci -q set fff.trafficcontrol=fff
>  		if [ "$POST_traffic_limit" == "on" ] ; then
> -			uci -q set "simple-tc.example.ifname=wan"
> +			uci -q set "fff.trafficcontrol.enabled=1"
>  			uci -q set "simple-tc.example.enabled=1"
>  		else
> +			uci -q set "fff.trafficcontrol.enabled=0"
>  			uci -q set "simple-tc.example.enabled=0"
>  		fi
> +		uci -q set "fff.trafficcontrol.limit_in=${POST_limit_ingress}"
> +		uci -q set "fff.trafficcontrol.limit_out=${POST_limit_egress}"
> +		
> +		uci -q set "simple-tc.example.ifname=wan"
>  		uci -q set "simple-tc.example.limit_ingress=${POST_limit_ingress}"
>  		uci -q set "simple-tc.example.limit_egress=${POST_limit_egress}"
>  
> -		uci commit
> +		uci -q commit
>  
>  		MSG='<span class="green">Daten gespeichert! - Bitte Router neustarten.</span>'
>  	fi
> @@ -41,7 +48,7 @@ fi
>  <%in /www/ssl/cgi-bin/helpers %>
>  <%
>  # read
> -if [ "$(uci -q get 'simple-tc.example.enabled')" == "1" ] ; then
> +if [ "$(uci -q get 'fff.trafficcontrol.enabled')" == "1" ] ; then
>  	traffic_checked='checked="checked" '
>  else
>  	traffic_checked=""
> @@ -55,16 +62,16 @@ fi
>  	<legend>Allgemeine Einstellungen</legend>
>  	<table>
>  		<tr><th>Knotenname:</th><td><input type="text" name="hostname" value="<%= ${HOSTNAME} %>" /></td></tr>
> -		<tr><th>Knotenbeschreibung:</th><td><input type="text" name="description" value="<%= $(uci -q get 'system.@system[0].description') %>" /></td></tr>
> +		<tr><th>Knotenbeschreibung:</th><td><input type="text" name="description" value="<%= $(uci -q get 'fff.system.description') %>" /></td></tr>
>  		<tr><th>GPS Breitengrad:</th>
> -			<td><input type="text" name="latitude" value="<%= $(uci -q get 'system.@system[0].latitude') %>" /></td>
> +			<td><input type="text" name="latitude" value="<%= $(uci -q get 'fff.system.latitude') %>" /></td>
>  			<td rowspan="2" style="vertical-align: middle;">
>  				<button type="button" style="height: 100%; width: 126px; margin-left: 5px;" onclick="window.open('/map.html', '_blank', 'location=0,status=0,scrollbars=1,width=400,height=300');">Position auf Karte anzeigen / setzen</button>
>  			</td>
>  		</tr>
> -		<tr><th>GPS L&auml;ngengrad:</th><td><input type="text" name="longitude" value="<%= $(uci -q get 'system.@system[0].longitude') %>" /></td></tr>
> -		<tr><th>Standortbeschreibung:</th><td><input type="text" name="position_comment" value="<%= $(uci -q get 'system.@system[0].position_comment') %>" /></td></tr>
> -		<tr><th>E-Mail Adresse:</th><td><input type="email" name="contact" value="<%= $(uci -q get 'system.@system[0].contact') %>" /></td></tr>
> +		<tr><th>GPS L&auml;ngengrad:</th><td><input type="text" name="longitude" value="<%= $(uci -q get 'fff.system.longitude') %>" /></td></tr>
> +		<tr><th>Standortbeschreibung:</th><td><input type="text" name="position_comment" value="<%= $(uci -q get 'fff.system.position_comment') %>" /></td></tr>
> +		<tr><th>E-Mail Adresse:</th><td><input type="email" name="contact" value="<%= $(uci -q get 'fff.system.contact') %>" /></td></tr>
>  	</table>
>  </fieldset>
>  </td><td>
> @@ -74,8 +81,8 @@ fi
>  		<tr><th>Aktiviert:</th><td colspan="2">
>  			<input type="checkbox" name="traffic_limit" <%= ${traffic_checked} %>/>
>  		</td></tr>
> -		<tr><th>Freifunk&nbsp;Download:</th><td><input type="text" name="limit_ingress" value="<%= $(uci -q get 'simple-tc.example.limit_ingress') %>" /></td><td>kbit/s</td></tr>
> -		<tr><th>Freifunk&nbsp;Upload:</th><td><input type="text" name="limit_egress" value="<%= $(uci -q get 'simple-tc.example.limit_egress') %>" /></td><td>kbit/s</td></tr>
> +		<tr><th>Freifunk&nbsp;Download:</th><td><input type="text" name="limit_ingress" value="<%= $(uci -q get 'fff.trafficcontrol.limit_in') %>" /></td><td>kbit/s</td></tr>
> +		<tr><th>Freifunk&nbsp;Upload:</th><td><input type="text" name="limit_egress" value="<%= $(uci -q get 'fff.trafficcontrol.limit_out') %>" /></td><td>kbit/s</td></tr>
>  	</table>
>  </fieldset>
>  </td></tr>
> diff --git a/src/packages/fff/fff/Makefile b/src/packages/fff/fff/Makefile
> index 305ab8d..dce33f9 100644
> --- a/src/packages/fff/fff/Makefile
> +++ b/src/packages/fff/fff/Makefile
> @@ -18,6 +18,7 @@ define Package/fff-base
>               +ip6tables \
>               +odhcp6c \
>               +micrond \
> +             +fff-config \
>               +fff-nodewatcher \
>               +fff-web \
>               +fff-uradvd \
> -- 
> 2.7.4
>
Tim Niemeyer Nov. 2, 2017, 10:05 p.m.
Hi

Zusammenfassung:
- Schaut gut aus, aber bei dem Hostname haben wir scheinbar zwei Probleme.
- Downgrade muss raus
- Paar Kleinigkeiten die egal sind

Am Mittwoch, den 18.10.2017, 23:30 +0200 schrieb Adrian Schmutzler:
> This moves the FFF configuration from
> /etc/config/system to a new file /etc/config/fff. Thus,
> this file can be copied as a whole during upgrade (with
> compatibility provided) and then resulting values in
> other files are re-set later.
> 
> This also fixes the bandwidth settings not being persistent
> during upgrade. Other settings may join ...
> 
> I tried to go through all the code and update all occurrences
> of the relevant system variables (looking for "system" both
> in GitHub and my local src folder).
> 
> When downgrading, this requires rewriting the values into
> the /etc/config/system. For this purpose, a script has
> been added. (Which will be integrated into the WebUI in
> another patch)
> 
> Changes in v11:
>  - Redesign for keyexchange v2.
> 
> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> ---
>  src/packages/fff/fff-config/Makefile               | 40 ++++++++++++++++++++++
>  .../files/etc/uci-defaults/98-configure-fff        | 25 ++++++++++++++
>  .../files/usr/sbin/prepare_firmware_downgrade.sh   | 23 +++++++++++++
>  src/packages/fff/fff-hoods/Makefile                |  2 +-
>  .../fff/fff-hoods/files/usr/sbin/configurehood     |  4 +--
>  src/packages/fff/fff-nodewatcher/Makefile          |  4 +--
>  .../fff/fff-nodewatcher/files/usr/sbin/nodewatcher | 20 +++++------
>  src/packages/fff/fff-sysupgrade/Makefile           |  2 +-
>  .../etc/uci-defaults/05-config-system-migration    | 36 +++++++++++--------
>  .../files/etc/uci-defaults/99-fff-sysupgrade       |  2 +-
>  src/packages/fff/fff-web/Makefile                  |  4 +--
>  .../fff-web/files/www/public/cgi-bin/status.html   | 12 +++----
>  .../fff/fff-web/files/www/ssl/cgi-bin/header       |  2 +-
>  .../fff-web/files/www/ssl/cgi-bin/settings.html    | 39 ++++++++++++---------
>  src/packages/fff/fff/Makefile                      |  1 +
>  15 files changed, 159 insertions(+), 57 deletions(-)
>  create mode 100644 src/packages/fff/fff-config/Makefile
>  create mode 100644 src/packages/fff/fff-config/files/etc/uci-defaults/98-configure-fff
>  create mode 100755 src/packages/fff/fff-config/files/usr/sbin/prepare_firmware_downgrade.sh
> 
> diff --git a/src/packages/fff/fff-config/Makefile b/src/packages/fff/fff-config/Makefile
> new file mode 100644
> index 0000000..fe4f5df
> --- /dev/null
> +++ b/src/packages/fff/fff-config/Makefile
> @@ -0,0 +1,40 @@
> +include $(TOPDIR)/rules.mk
> +
> +PKG_NAME:=fff-config
> +PKG_VERSION:=1
> +PKG_RELEASE:=1
> +
> +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
> +
> +include $(INCLUDE_DIR)/package.mk
> +
> +define Package/$(PKG_NAME)
> +    SECTION:=base
> +    CATEGORY:=Freifunk
> +    TITLE:=Freifunk-Franken Config
> +    URL:=http://www.freifunk-franken.de
> +    DEPENDS:=+fff-boardname +@BUSYBOX_CONFIG_WGET
> +endef
> +
> +define Package/$(PKG_NAME)/description
> +    This is the Freifunk Franken Firmware Config package.
> +    This packages provides utilities for a central FFF config file.
> +endef
> +
> +define Build/Prepare
> +    echo "all: " > $(PKG_BUILD_DIR)/Makefile
> +endef
> +
> +define Build/Configure
> +    # nothing
> +endef
> +
> +define Build/Compile
> +    # nothing
> +endef
> +
> +define Package/$(PKG_NAME)/install
> +    $(CP) ./files/* $(1)/
> +endef
> +
> +$(eval $(call BuildPackage,$(PKG_NAME)))
> diff --git a/src/packages/fff/fff-config/files/etc/uci-defaults/98-configure-fff b/src/packages/fff/fff-config/files/etc/uci-defaults/98-configure-fff
> new file mode 100644
> index 0000000..e337e88
> --- /dev/null
> +++ b/src/packages/fff/fff-config/files/etc/uci-defaults/98-configure-fff
> @@ -0,0 +1,25 @@
> +#!/bin/sh
> +# 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=Freifunk-Router"
Dieser Teil kollidiert mit dem 
--- %< ---
    [ "$hostname" = "LEDE" ] && hostname="$mac"
--- >% ---
aus dem Nodewatcher und vpn-select.

> +fi
> +
> +FFF_hostname=$(uci -q get "fff.system.hostname")
> +test -n "${FFF_hostname}" && uci -q set "system.@system[0].hostname=${FFF_hostname}"
Hier wird noch einmal das system.@system[0].hostname gesetzt. Später
aber wenn der Hostname z.B. über das web-ui gesetzt wurde nicht mehr.

Ich vermute, dass LEDE irgendwo ein Script mit bringt, welches beim
booten den Hostname aus dem system.@system[0].hostname setzt. Dieses
müssten man noch umschreiben. Ansonsten wäre folgendes Szenario broken:

Update mit Hostname=Test1
Web-Ui setzt Hostname=Test2
Reboot
Knoten heißt Test1

> +test -n "${FFF_hostname}" && echo "${FFF_hostname}" > /proc/sys/kernel/hostname
> +
> +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}"
Ich hab grad überlegt, ob es Sinn macht, die in/out Limit's zu setzen,
auch wenn traffic_enabled false ist. Aber es schadet zumindest auch
nicht, von daher ok.

> +
> +uci -q commit
> diff --git a/src/packages/fff/fff-config/files/usr/sbin/prepare_firmware_downgrade.sh b/src/packages/fff/fff-config/files/usr/sbin/prepare_firmware_downgrade.sh
> new file mode 100755
> index 0000000..ab96ba4
> --- /dev/null
> +++ b/src/packages/fff/fff-config/files/usr/sbin/prepare_firmware_downgrade.sh
Das ganze File kommt ja weg, daher hab ich es mir nicht angeschaut..

[..]

> diff --git a/src/packages/fff/fff-hoods/Makefile b/src/packages/fff/fff-hoods/Makefile
> index dd22df4..11ab6d1 100644
> --- a/src/packages/fff/fff-hoods/Makefile
> +++ b/src/packages/fff/fff-hoods/Makefile
> @@ -13,7 +13,7 @@ define Package/$(PKG_NAME)
>      CATEGORY:=Freifunk
>      TITLE:= Freifunk-Franken hoods
>      URL:=http://www.freifunk-franken.de
> -    DEPENDS:=+fff-network
> +    DEPENDS:=+fff-network +fff-config
>  endef
>  
>  define Package/$(PKG_NAME)/description
> diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> index f7ddb6e..e7a6eda 100755
> --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> @@ -57,8 +57,8 @@ if [ -f /tmp/hiddenapflag ]; then
>  	rm /tmp/hiddenapflag
>  fi
>  
> -lat=$(uci -q get system.@system[0].latitude)
> -long=$(uci -q get system.@system[0].longitude)
> +lat=$(uci -q get fff.system.latitude)
> +long=$(uci -q get fff.system.longitude)
>  
>  # if we have Internet, we download the Hoodfile from the keyxchangev2
>  if hasInternet ; then
> diff --git a/src/packages/fff/fff-nodewatcher/Makefile b/src/packages/fff/fff-nodewatcher/Makefile
> index 79cb917..7bfd08e 100644
> --- a/src/packages/fff/fff-nodewatcher/Makefile
> +++ b/src/packages/fff/fff-nodewatcher/Makefile
> @@ -1,7 +1,7 @@
>  include $(TOPDIR)/rules.mk
>  
>  PKG_NAME:=fff-nodewatcher
> -PKG_VERSION:=41
> +PKG_VERSION:=43
>  PKG_RELEASE:=1
>  
>  PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
> @@ -13,7 +13,7 @@ define Package/$(PKG_NAME)
>      CATEGORY:=Freifunk
>      TITLE:= Freifunk-Franken Nodewatcher
>      URL:=http://www.freifunk-franken.de
> -    DEPENDS:=+alfred +micrond +fff-random +ip +ip-bridge
> +    DEPENDS:=+alfred +micrond +fff-config +fff-random +ip +ip-bridge
>  endef
>  
>  define Package/$(PKG_NAME)/description
> diff --git a/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher b/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
> index 35adf91..80548ac 100755
> --- a/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
> +++ b/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
> @@ -2,7 +2,7 @@
>  # Netmon Nodewatcher (C) 2010-2012 Freifunk Oldenburg
>  # License; GPL v3
>  
> -SCRIPT_VERSION="41"
> +SCRIPT_VERSION="43"
>  
>  test -f /tmp/started || exit
>  
> @@ -58,20 +58,20 @@ crawl() {
>      hostname="$(cat /proc/sys/kernel/hostname)"
>      mac=$(awk '{ mac=toupper($1); gsub(":", "", mac); print mac }' /sys/class/net/br-mesh/address 2>/dev/null)
>      [ "$hostname" = "LEDE" ] && hostname="$mac"
> -    description="$(uci get system.@system[0].description)"
> +    description="$(uci -q get fff.system.description)"
>      if [ -n "$description" ]; then
>          description="<description><![CDATA[$description]]></description>"
>      fi
> -    latitude="$(uci get system.@system[0].latitude)"
> -    longitude="$(uci get system.@system[0].longitude)"
> +    latitude="$(uci -q get fff.system.latitude)"
> +    longitude="$(uci -q get fff.system.longitude)"
>      if [ -n "$longitude" -a -n "$latitude" ]; then
>          geo="<geo><lat>$latitude</lat><lng>$longitude</lng></geo>";
>      fi
> -    position_comment="$(uci get system.@system[0].position_comment)"
> +    position_comment="$(uci -q get fff.system.position_comment)"
>      if [ -n "$position_comment" ]; then
>          position_comment="<position_comment><![CDATA[$position_comment]]></position_comment>"
>      fi
> -    contact="$(uci get system.@system[0].contact)"
> +    contact="$(uci -q get fff.system.contact)"
>      if [ -n "$contact" ]; then
>          contact="<contact>$contact</contact>"
>      fi
> @@ -137,10 +137,10 @@ crawl() {
>      SYSTEM_DATA=$SYSTEM_DATA"${geo}"
>      SYSTEM_DATA=$SYSTEM_DATA"${position_comment}"
>      SYSTEM_DATA=$SYSTEM_DATA"${contact}"
> -    if [ "$(uci -q get "system.@system[0].hood")" ] 
> -    then                                                                                                                         
> -        SYSTEM_DATA=$SYSTEM_DATA"<hood>$(uci -q get "system.@system[0].hood")</hood>"                                            
> -    fi  
> +    if [ "$(uci -q get "system.@system[0].hood")" ]
> +    then
> +        SYSTEM_DATA=$SYSTEM_DATA"<hood>$(uci -q get "system.@system[0].hood")</hood>"
> +    fi
>      SYSTEM_DATA=$SYSTEM_DATA"<distname>$distname</distname>"
>      SYSTEM_DATA=$SYSTEM_DATA"<distversion>$distversion</distversion>"
>      SYSTEM_DATA=$SYSTEM_DATA"$cpu"
> diff --git a/src/packages/fff/fff-sysupgrade/Makefile b/src/packages/fff/fff-sysupgrade/Makefile
> index ab809c9..b2e1ffa 100644
> --- a/src/packages/fff/fff-sysupgrade/Makefile
> +++ b/src/packages/fff/fff-sysupgrade/Makefile
> @@ -13,7 +13,7 @@ define Package/$(PKG_NAME)
>      CATEGORY:=Freifunk
>      TITLE:=Freifunk-Franken sysupgrade
>      URL:=http://www.freifunk-franken.de
> -    DEPENDS:=+fff-boardname +fff-hoods +@BUSYBOX_CONFIG_WGET
> +    DEPENDS:=+fff-boardname +fff-config +fff-hoods +@BUSYBOX_CONFIG_WGET
>  endef
>  
>  define Package/$(PKG_NAME)/description
> diff --git a/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/05-config-system-migration b/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/05-config-system-migration
> index 0e36587..fe4ad97 100644
> --- a/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/05-config-system-migration
> +++ b/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/05-config-system-migration
> @@ -1,21 +1,27 @@
>  #!/bin/sh
>  
> -UPGRADE_hostname=$(uci -q get "system.@system[0].hostname")
> -UPGRADE_description=$(uci -q get "system.@system[0].description")
> -UPGRADE_latitude=$(uci -q get "system.@system[0].latitude")
> -UPGRADE_longitude=$(uci -q get "system.@system[0].longitude")
> -UPGRADE_position_comment=$(uci -q get "system.@system[0].position_comment")
> -UPGRADE_contact=$(uci -q get "system.@system[0].contact")
> +if [ ! -s /etc/config/fff ] ; then
>  
> -/bin/rm -rf /etc/config/system
> +	UPGRADE_hostname=$(uci -q get "system.@system[0].hostname")
> +	UPGRADE_description=$(uci -q get "system.@system[0].description")
> +	UPGRADE_latitude=$(uci -q get "system.@system[0].latitude")
> +	UPGRADE_longitude=$(uci -q get "system.@system[0].longitude")
> +	UPGRADE_position_comment=$(uci -q get "system.@system[0].position_comment")
> +	UPGRADE_contact=$(uci -q get "system.@system[0].contact")
>  
> -/bin/config_generate
> +	/bin/rm -rf /etc/config/system
> +	
> +	/bin/config_generate
>  
> -test -n "${UPGRADE_hostname}" && uci -q set "system.@system[0].hostname=${UPGRADE_hostname}"
> -test -n "${UPGRADE_description}" && uci -q set "system.@system[0].description=${UPGRADE_description}"
> -test -n "${UPGRADE_latitude}" && uci -q set "system.@system[0].latitude=${UPGRADE_latitude}"
> -test -n "${UPGRADE_longitude}" && uci -q set "system.@system[0].longitude=${UPGRADE_longitude}"
> -test -n "${UPGRADE_position_comment}" && uci -q set "system.@system[0].position_comment=${UPGRADE_position_comment}"
> -test -n "${UPGRADE_contact}" && uci -q set "system.@system[0].contact=${UPGRADE_contact}"
> +	touch /etc/config/fff
>  
> -uci -q commit system
> +	uci -q set fff.system=fff
> +	test -n "${UPGRADE_hostname}" && uci -q set "fff.system.hostname=${UPGRADE_hostname}"
> +	test -n "${UPGRADE_description}" && uci -q set "fff.system.description=${UPGRADE_description}"
> +	test -n "${UPGRADE_latitude}" && uci -q set "fff.system.latitude=${UPGRADE_latitude}"
> +	test -n "${UPGRADE_longitude}" && uci -q set "fff.system.longitude=${UPGRADE_longitude}"
> +	test -n "${UPGRADE_position_comment}" && uci -q set "fff.system.position_comment=${UPGRADE_position_comment}"
> +	test -n "${UPGRADE_contact}" && uci -q set "fff.system.contact=${UPGRADE_contact}"
> +
> +	uci -q commit fff
> +fi
> diff --git a/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/99-fff-sysupgrade b/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/99-fff-sysupgrade
> index ab6f2de..847ce1e 100644
> --- a/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/99-fff-sysupgrade
> +++ b/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/99-fff-sysupgrade
> @@ -8,5 +8,5 @@ cat > /etc/sysupgrade.conf <<-__EOF__
>  /etc/dropbear/dropbear_rsa_host_key
>  /etc/dropbear/authorized_keys
>  /etc/network.config
> -/etc/config/system
> +/etc/config/fff
>  __EOF__
> diff --git a/src/packages/fff/fff-web/Makefile b/src/packages/fff/fff-web/Makefile
> index 708dbb9..d7201e2 100644
> --- a/src/packages/fff/fff-web/Makefile
> +++ b/src/packages/fff/fff-web/Makefile
> @@ -1,7 +1,7 @@
>  include $(TOPDIR)/rules.mk
>  
>  PKG_NAME:=fff-web
> -PKG_VERSION:=0.0.4
> +PKG_VERSION:=5
>  PKG_RELEASE:=2
>  
>  PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
> @@ -13,7 +13,7 @@ define Package/$(PKG_NAME)
>      CATEGORY:=Freifunk
>      TITLE:= Freifunk-Franken Webinterface
>      URL:=http://www.freifunk-franken.de
> -    DEPENDS:=+uhttpd +libustream-mbedtls +haserl +px5g +simple-tc +fff-boardname +fff-network
> +    DEPENDS:=+uhttpd +libustream-mbedtls +haserl +px5g +simple-tc +fff-boardname +fff-config +fff-network
>  endef
>  
>  define Package/$(PKG_NAME)/description
> diff --git a/src/packages/fff/fff-web/files/www/public/cgi-bin/status.html b/src/packages/fff/fff-web/files/www/public/cgi-bin/status.html
> index f96846c..96d657b 100755
> --- a/src/packages/fff/fff-web/files/www/public/cgi-bin/status.html
> +++ b/src/packages/fff/fff-web/files/www/public/cgi-bin/status.html
> @@ -2,13 +2,13 @@
>  
>  <%
>  echo -en "Content-Type: text/html\r\n\r\n"
> -HOSTNAME=$(uci -q get 'system.@system[0].hostname')
> +HOSTNAME="$(uci -q get "fff.system.hostname")"
>  hood="$(uci -q get "system.@system[0].hood")"
>  
>  MAC="$(uci -q get network.mesh.macaddr)"
> -lat="$(uci -q get system.@system[0].latitude)"
> -lon="$(uci -q get system.@system[0].longitude)"
> -contact="$(uci -q get system.@system[0].contact)"
> +lat="$(uci -q get "fff.system.latitude")"
> +lon="$(uci -q get "fff.system.longitude")"
> +contact="$(uci -q get "fff.system.contact")"
>  
>  . /etc/firmware_release
>  
> @@ -48,11 +48,11 @@ contact="$(uci -q get system.@system[0].contact)"
>  								<tr><th>MAC-Adresse:</th><td style="text-transform: uppercase;"><a href="https://monitoring.freifunk-franken.de/api/get_router_by_mac/<%= $MAC %>"><%= $MAC %></a></td></tr>
>  								<tr><th>Modell:</th><td><% cat /tmp/sysinfo/model 2>/dev/null %></td></tr>
>  								<tr><th>Firmware:</th><td><%= ${FIRMWARE_VERSION} %></td></tr>
> -								<tr><th>Beschreibung:</th><td><% uci -q get 'system.@system[0].description' %></td></tr>
> +								<tr><th>Beschreibung:</th><td><% uci -q get 'fff.system.description' %></td></tr>
>  								<tr><th>Position:</th><td><% if [ -n "$lat" -a -n "$lon" ]; then
>  									echo "<a href=\"https://monitoring.freifunk-franken.de/map?mapcenter=$lat,$lon,16\">${lat:0:8}N, ${lon:0:8}E</a>"
>  								fi %></td></tr>
> -								<tr><th>Standort:</th><td><% uci -q get 'system.@system[0].position_comment' %></td></tr>
> +								<tr><th>Standort:</th><td><% uci -q get 'fff.system.position_comment' %></td></tr>
>  								<tr><th>E-Mail Adresse:</th><td><a href="mailto:<%= $contact %>"><%= $contact %></a></td></tr>
>  							</table>
>  						</fieldset>
> diff --git a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/header b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/header
> index c327013..f98a3f3 100755
> --- a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/header
> +++ b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/header
> @@ -12,7 +12,7 @@ nav_entry() {
>  	echo -ne "\t<li${class_active}><a href=\"${script_file}\">$2</a></li>\n\t\t"
>  }
>  
> -HOSTNAME=$(uci -q get 'system.@system[0].hostname')
> +HOSTNAME="$(uci -q get "fff.system.hostname")"
>  hood="$(uci -q get "system.@system[0].hood")"
>  
>  NOW=$(date +%s)
> diff --git a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/settings.html b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/settings.html
> index e7bc3e9..b785aed 100755
> --- a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/settings.html
> +++ b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/settings.html
> @@ -13,25 +13,32 @@ if [ "$REQUEST_METHOD" == "POST" ] ; then
>  		MSG='<span class="red">Knotenname enth&auml;lt ung&uuml;ltige Zeichen!</span>'
>  	else
>  		# Allgemeine Einstellungen
> +		uci -q set "fff.system.hostname=${POST_hostname}"
> +		echo "$(uci -q get "fff.system.hostname")" > /proc/sys/kernel/hostname
>  		uci -q set "system.@system[0].hostname=${POST_hostname}"
> -		echo "$(uci -q get "system.@system[0].hostname")" > /proc/sys/kernel/hostname
> -		uci -q set "system.@system[0].description=${POST_description}"
> -		uci -q set "system.@system[0].latitude=${POST_latitude}"
> -		uci -q set "system.@system[0].longitude=${POST_longitude}"
> -		uci -q set "system.@system[0].position_comment=${POST_position_comment}"
> -		uci -q set "system.@system[0].contact=${POST_contact}"
> +		uci -q set "fff.system.description=${POST_description}"
> +		uci -q set "fff.system.latitude=${POST_latitude}"
> +		uci -q set "fff.system.longitude=${POST_longitude}"
> +		uci -q set "fff.system.position_comment=${POST_position_comment}"
> +		uci -q set "fff.system.contact=${POST_contact}"
>  
>  		# Bitratenbegrenzung
> +		uci -q get "fff.trafficcontrol" > /dev/null || uci -q set fff.trafficcontrol=fff
>  		if [ "$POST_traffic_limit" == "on" ] ; then
> -			uci -q set "simple-tc.example.ifname=wan"
> +			uci -q set "fff.trafficcontrol.enabled=1"
>  			uci -q set "simple-tc.example.enabled=1"
>  		else
> +			uci -q set "fff.trafficcontrol.enabled=0"
>  			uci -q set "simple-tc.example.enabled=0"
>  		fi
> +		uci -q set "fff.trafficcontrol.limit_in=${POST_limit_ingress}"
> +		uci -q set "fff.trafficcontrol.limit_out=${POST_limit_egress}"
> +		
> +		uci -q set "simple-tc.example.ifname=wan"
>  		uci -q set "simple-tc.example.limit_ingress=${POST_limit_ingress}"
>  		uci -q set "simple-tc.example.limit_egress=${POST_limit_egress}"
>  
> -		uci commit
> +		uci -q commit
>  
>  		MSG='<span class="green">Daten gespeichert! - Bitte Router neustarten.</span>'
>  	fi
> @@ -41,7 +48,7 @@ fi
>  <%in /www/ssl/cgi-bin/helpers %>
>  <%
>  # read
> -if [ "$(uci -q get 'simple-tc.example.enabled')" == "1" ] ; then
> +if [ "$(uci -q get 'fff.trafficcontrol.enabled')" == "1" ] ; then
>  	traffic_checked='checked="checked" '
>  else
>  	traffic_checked=""
> @@ -55,16 +62,16 @@ fi
>  	<legend>Allgemeine Einstellungen</legend>
>  	<table>
>  		<tr><th>Knotenname:</th><td><input type="text" name="hostname" value="<%= ${HOSTNAME} %>" /></td></tr>
> -		<tr><th>Knotenbeschreibung:</th><td><input type="text" name="description" value="<%= $(uci -q get 'system.@system[0].description') %>" /></td></tr>
> +		<tr><th>Knotenbeschreibung:</th><td><input type="text" name="description" value="<%= $(uci -q get 'fff.system.description') %>" /></td></tr>
>  		<tr><th>GPS Breitengrad:</th>
> -			<td><input type="text" name="latitude" value="<%= $(uci -q get 'system.@system[0].latitude') %>" /></td>
> +			<td><input type="text" name="latitude" value="<%= $(uci -q get 'fff.system.latitude') %>" /></td>
>  			<td rowspan="2" style="vertical-align: middle;">
>  				<button type="button" style="height: 100%; width: 126px; margin-left: 5px;" onclick="window.open('/map.html', '_blank', 'location=0,status=0,scrollbars=1,width=400,height=300');">Position auf Karte anzeigen / setzen</button>
>  			</td>
>  		</tr>
> -		<tr><th>GPS L&auml;ngengrad:</th><td><input type="text" name="longitude" value="<%= $(uci -q get 'system.@system[0].longitude') %>" /></td></tr>
> -		<tr><th>Standortbeschreibung:</th><td><input type="text" name="position_comment" value="<%= $(uci -q get 'system.@system[0].position_comment') %>" /></td></tr>
> -		<tr><th>E-Mail Adresse:</th><td><input type="email" name="contact" value="<%= $(uci -q get 'system.@system[0].contact') %>" /></td></tr>
> +		<tr><th>GPS L&auml;ngengrad:</th><td><input type="text" name="longitude" value="<%= $(uci -q get 'fff.system.longitude') %>" /></td></tr>
> +		<tr><th>Standortbeschreibung:</th><td><input type="text" name="position_comment" value="<%= $(uci -q get 'fff.system.position_comment') %>" /></td></tr>
> +		<tr><th>E-Mail Adresse:</th><td><input type="email" name="contact" value="<%= $(uci -q get 'fff.system.contact') %>" /></td></tr>
>  	</table>
>  </fieldset>
>  </td><td>
> @@ -74,8 +81,8 @@ fi
>  		<tr><th>Aktiviert:</th><td colspan="2">
>  			<input type="checkbox" name="traffic_limit" <%= ${traffic_checked} %>/>
>  		</td></tr>
> -		<tr><th>Freifunk&nbsp;Download:</th><td><input type="text" name="limit_ingress" value="<%= $(uci -q get 'simple-tc.example.limit_ingress') %>" /></td><td>kbit/s</td></tr>
> -		<tr><th>Freifunk&nbsp;Upload:</th><td><input type="text" name="limit_egress" value="<%= $(uci -q get 'simple-tc.example.limit_egress') %>" /></td><td>kbit/s</td></tr>
> +		<tr><th>Freifunk&nbsp;Download:</th><td><input type="text" name="limit_ingress" value="<%= $(uci -q get 'fff.trafficcontrol.limit_in') %>" /></td><td>kbit/s</td></tr>
> +		<tr><th>Freifunk&nbsp;Upload:</th><td><input type="text" name="limit_egress" value="<%= $(uci -q get 'fff.trafficcontrol.limit_out') %>" /></td><td>kbit/s</td></tr>
>  	</table>
>  </fieldset>
>  </td></tr>
> diff --git a/src/packages/fff/fff/Makefile b/src/packages/fff/fff/Makefile
> index 305ab8d..dce33f9 100644
> --- a/src/packages/fff/fff/Makefile
> +++ b/src/packages/fff/fff/Makefile
> @@ -18,6 +18,7 @@ define Package/fff-base
>               +ip6tables \
>               +odhcp6c \
>               +micrond \
> +             +fff-config \
Ich bin mir grad nicht sicher, ob fff-base wirklich davon abhängen
sollte. Immerhin wird es ja von fff-base nicht benötigt, aber von den
anderen Paketen.. Naja, tut aber auch nicht weh.. Mir egal. ;)

Tim

>               +fff-nodewatcher \
>               +fff-web \
>               +fff-uradvd \
> -- 
> 2.7.4
>
Adrian Schmutzler Nov. 2, 2017, 10:24 p.m.
Hallo,

siehe unten.

> -----Original Message-----
> From: Tim Niemeyer [mailto:tim@tn-x.org]
> Sent: Donnerstag, 2. November 2017 23:06
> To: Adrian Schmutzler <freifunk@adrianschmutzler.de>; franken-
> dev@freifunk.net
> Subject: Re: [PATCH v11 1/6] Rearrange fff config values into their own config
> file
> 
> Hi
> 
> Zusammenfassung:
> - Schaut gut aus, aber bei dem Hostname haben wir scheinbar zwei
> Probleme.
> - Downgrade muss raus
> - Paar Kleinigkeiten die egal sind
> 
> Am Mittwoch, den 18.10.2017, 23:30 +0200 schrieb Adrian Schmutzler:
> > This moves the FFF configuration from
> > /etc/config/system to a new file /etc/config/fff. Thus, this file can
> > be copied as a whole during upgrade (with compatibility provided) and
> > then resulting values in other files are re-set later.
> >
> > This also fixes the bandwidth settings not being persistent during
> > upgrade. Other settings may join ...
> >
> > I tried to go through all the code and update all occurrences of the
> > relevant system variables (looking for "system" both in GitHub and my
> > local src folder).
> >
> > When downgrading, this requires rewriting the values into the
> > /etc/config/system. For this purpose, a script has been added. (Which
> > will be integrated into the WebUI in another patch)
> >
> > Changes in v11:
> >  - Redesign for keyexchange v2.
> >
> > Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> > Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> > ---
> >  src/packages/fff/fff-config/Makefile               | 40
> ++++++++++++++++++++++
> >  .../files/etc/uci-defaults/98-configure-fff        | 25 ++++++++++++++
> >  .../files/usr/sbin/prepare_firmware_downgrade.sh   | 23 +++++++++++++
> >  src/packages/fff/fff-hoods/Makefile                |  2 +-
> >  .../fff/fff-hoods/files/usr/sbin/configurehood     |  4 +--
> >  src/packages/fff/fff-nodewatcher/Makefile          |  4 +--
> >  .../fff/fff-nodewatcher/files/usr/sbin/nodewatcher | 20 +++++------
> >  src/packages/fff/fff-sysupgrade/Makefile           |  2 +-
> >  .../etc/uci-defaults/05-config-system-migration    | 36 +++++++++++--------
> >  .../files/etc/uci-defaults/99-fff-sysupgrade       |  2 +-
> >  src/packages/fff/fff-web/Makefile                  |  4 +--
> >  .../fff-web/files/www/public/cgi-bin/status.html   | 12 +++----
> >  .../fff/fff-web/files/www/ssl/cgi-bin/header       |  2 +-
> >  .../fff-web/files/www/ssl/cgi-bin/settings.html    | 39 ++++++++++++------
> ---
> >  src/packages/fff/fff/Makefile                      |  1 +
> >  15 files changed, 159 insertions(+), 57 deletions(-)  create mode
> > 100644 src/packages/fff/fff-config/Makefile
> >  create mode 100644
> > src/packages/fff/fff-config/files/etc/uci-defaults/98-configure-fff
> >  create mode 100755
> > src/packages/fff/fff-config/files/usr/sbin/prepare_firmware_downgrade.
> > sh
> >
> > diff --git a/src/packages/fff/fff-config/Makefile
> > b/src/packages/fff/fff-config/Makefile
> > new file mode 100644
> > index 0000000..fe4f5df
> > --- /dev/null
> > +++ b/src/packages/fff/fff-config/Makefile
> > @@ -0,0 +1,40 @@
> > +include $(TOPDIR)/rules.mk
> > +
> > +PKG_NAME:=fff-config
> > +PKG_VERSION:=1
> > +PKG_RELEASE:=1
> > +
> > +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
> > +
> > +include $(INCLUDE_DIR)/package.mk
> > +
> > +define Package/$(PKG_NAME)
> > +    SECTION:=base
> > +    CATEGORY:=Freifunk
> > +    TITLE:=Freifunk-Franken Config
> > +    URL:=http://www.freifunk-franken.de
> > +    DEPENDS:=+fff-boardname +@BUSYBOX_CONFIG_WGET endef
> > +
> > +define Package/$(PKG_NAME)/description
> > +    This is the Freifunk Franken Firmware Config package.
> > +    This packages provides utilities for a central FFF config file.
> > +endef
> > +
> > +define Build/Prepare
> > +    echo "all: " > $(PKG_BUILD_DIR)/Makefile endef
> > +
> > +define Build/Configure
> > +    # nothing
> > +endef
> > +
> > +define Build/Compile
> > +    # nothing
> > +endef
> > +
> > +define Package/$(PKG_NAME)/install
> > +    $(CP) ./files/* $(1)/
> > +endef
> > +
> > +$(eval $(call BuildPackage,$(PKG_NAME)))
> > diff --git
> > a/src/packages/fff/fff-config/files/etc/uci-defaults/98-configure-fff
> > b/src/packages/fff/fff-config/files/etc/uci-defaults/98-configure-fff
> > new file mode 100644
> > index 0000000..e337e88
> > --- /dev/null
> > +++ b/src/packages/fff/fff-config/files/etc/uci-defaults/98-configure-
> > +++ fff
> > @@ -0,0 +1,25 @@
> > +#!/bin/sh
> > +# 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=Freifunk-Router"
> Dieser Teil kollidiert mit dem
> --- %< ---
>     [ "$hostname" = "LEDE" ] && hostname="$mac"
> --- >% ---
> aus dem Nodewatcher und vpn-select.

LEDE setzt den Hostnamen tatsächlich beim First-Boot, wodurch uci-defaults/05-config-system-migration diesen in die fffconfig schreibt.

Ich würde die Zeile hier trotzdem drin lassen, weil der Fall eines fehlenden Hostnamen trotzdem abgefangen werden sollte. Wenn es dir lieber ist, kann ich hier LEDE verwenden.

Ggf. kann man das entsprechend im nodewatcher ergänzen. Im vpn-select sollte der Hostname doch obsolet sein.

> 
> > +fi
> > +
> > +FFF_hostname=$(uci -q get "fff.system.hostname") test -n
> > +"${FFF_hostname}" && uci -q set
> "system.@system[0].hostname=${FFF_hostname}"
> Hier wird noch einmal das system.@system[0].hostname gesetzt. Später
> aber wenn der Hostname z.B. über das web-ui gesetzt wurde nicht mehr.

Das ist eine Vorsichtsmaßnahme. Ich weiß nicht, ob LEDE einen Hostnamen braucht, um zu funktionieren. Immerhin setzt es ihn zu Beginn selbst; daher habe ich (nur) den Hostnamen immer an beiden Stellen gesetzt\geupdatet. Man könnte überlegen, ob man ihn in der system config einfach auf LEDE lässt und schaut, was passiert.

> 
> Ich vermute, dass LEDE irgendwo ein Script mit bringt, welches beim booten
> den Hostname aus dem system.@system[0].hostname setzt. Dieses
> müssten man noch umschreiben. Ansonsten wäre folgendes Szenario
> broken:
> 
> Update mit Hostname=Test1
> Web-Ui setzt Hostname=Test2
> Reboot
> Knoten heißt Test1

Das wäre jetzt für den Fall, das wir hostname aus system ganz rausschmeißen?
Ich finde nicht, das wir das tun sollten. Da müssen wir dann zu viel am LEDE rumpatchen und mitdenken. Dann lieber zwei Mal den Wert doppelt schreiben.

> 
> > +test -n "${FFF_hostname}" && echo "${FFF_hostname}" >
> > +/proc/sys/kernel/hostname
> > +
> > +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}"
> Ich hab grad überlegt, ob es Sinn macht, die in/out Limit's zu setzen, auch
> wenn traffic_enabled false ist. Aber es schadet zumindest auch nicht, von
> daher ok.
> 
> > +
> > +uci -q commit
> > diff --git
> > a/src/packages/fff/fff-config/files/usr/sbin/prepare_firmware_downgrad
> > e.sh
> > b/src/packages/fff/fff-config/files/usr/sbin/prepare_firmware_downgrad
> > e.sh
> > new file mode 100755
> > index 0000000..ab96ba4
> > --- /dev/null
> > +++ b/src/packages/fff/fff-config/files/usr/sbin/prepare_firmware_down
> > +++ grade.sh
> Das ganze File kommt ja weg, daher hab ich es mir nicht angeschaut..
> 
> [..]
> 
> > diff --git a/src/packages/fff/fff-hoods/Makefile
> > b/src/packages/fff/fff-hoods/Makefile
> > index dd22df4..11ab6d1 100644
> > --- a/src/packages/fff/fff-hoods/Makefile
> > +++ b/src/packages/fff/fff-hoods/Makefile
> > @@ -13,7 +13,7 @@ define Package/$(PKG_NAME)
> >      CATEGORY:=Freifunk
> >      TITLE:= Freifunk-Franken hoods
> >      URL:=http://www.freifunk-franken.de
> > -    DEPENDS:=+fff-network
> > +    DEPENDS:=+fff-network +fff-config
> >  endef
> >
> >  define Package/$(PKG_NAME)/description diff --git
> > a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> > b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> > index f7ddb6e..e7a6eda 100755
> > --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> > +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> > @@ -57,8 +57,8 @@ if [ -f /tmp/hiddenapflag ]; then
> >  	rm /tmp/hiddenapflag
> >  fi
> >
> > -lat=$(uci -q get system.@system[0].latitude) -long=$(uci -q get
> > system.@system[0].longitude)
> > +lat=$(uci -q get fff.system.latitude) long=$(uci -q get
> > +fff.system.longitude)
> >
> >  # if we have Internet, we download the Hoodfile from the keyxchangev2
> > if hasInternet ; then diff --git
> > a/src/packages/fff/fff-nodewatcher/Makefile
> > b/src/packages/fff/fff-nodewatcher/Makefile
> > index 79cb917..7bfd08e 100644
> > --- a/src/packages/fff/fff-nodewatcher/Makefile
> > +++ b/src/packages/fff/fff-nodewatcher/Makefile
> > @@ -1,7 +1,7 @@
> >  include $(TOPDIR)/rules.mk
> >
> >  PKG_NAME:=fff-nodewatcher
> > -PKG_VERSION:=41
> > +PKG_VERSION:=43
> >  PKG_RELEASE:=1
> >
> >  PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
> > @@ -13,7 +13,7 @@ define Package/$(PKG_NAME)
> >      CATEGORY:=Freifunk
> >      TITLE:= Freifunk-Franken Nodewatcher
> >      URL:=http://www.freifunk-franken.de
> > -    DEPENDS:=+alfred +micrond +fff-random +ip +ip-bridge
> > +    DEPENDS:=+alfred +micrond +fff-config +fff-random +ip +ip-bridge
> >  endef
> >
> >  define Package/$(PKG_NAME)/description diff --git
> > a/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
> > b/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
> > index 35adf91..80548ac 100755
> > --- a/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
> > +++ b/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
> > @@ -2,7 +2,7 @@
> >  # Netmon Nodewatcher (C) 2010-2012 Freifunk Oldenburg  # License; GPL
> > v3
> >
> > -SCRIPT_VERSION="41"
> > +SCRIPT_VERSION="43"
> >
> >  test -f /tmp/started || exit
> >
> > @@ -58,20 +58,20 @@ crawl() {
> >      hostname="$(cat /proc/sys/kernel/hostname)"
> >      mac=$(awk '{ mac=toupper($1); gsub(":", "", mac); print mac }'
> /sys/class/net/br-mesh/address 2>/dev/null)
> >      [ "$hostname" = "LEDE" ] && hostname="$mac"
> > -    description="$(uci get system.@system[0].description)"
> > +    description="$(uci -q get fff.system.description)"
> >      if [ -n "$description" ]; then
> >          description="<description><![CDATA[$description]]></description>"
> >      fi
> > -    latitude="$(uci get system.@system[0].latitude)"
> > -    longitude="$(uci get system.@system[0].longitude)"
> > +    latitude="$(uci -q get fff.system.latitude)"
> > +    longitude="$(uci -q get fff.system.longitude)"
> >      if [ -n "$longitude" -a -n "$latitude" ]; then
> >          geo="<geo><lat>$latitude</lat><lng>$longitude</lng></geo>";
> >      fi
> > -    position_comment="$(uci get system.@system[0].position_comment)"
> > +    position_comment="$(uci -q get fff.system.position_comment)"
> >      if [ -n "$position_comment" ]; then
> >
> position_comment="<position_comment><![CDATA[$position_comment]]>
> </position_comment>"
> >      fi
> > -    contact="$(uci get system.@system[0].contact)"
> > +    contact="$(uci -q get fff.system.contact)"
> >      if [ -n "$contact" ]; then
> >          contact="<contact>$contact</contact>"
> >      fi
> > @@ -137,10 +137,10 @@ crawl() {
> >      SYSTEM_DATA=$SYSTEM_DATA"${geo}"
> >      SYSTEM_DATA=$SYSTEM_DATA"${position_comment}"
> >      SYSTEM_DATA=$SYSTEM_DATA"${contact}"
> > -    if [ "$(uci -q get "system.@system[0].hood")" ]
> > -    then
> > -        SYSTEM_DATA=$SYSTEM_DATA"<hood>$(uci -q get
> "system.@system[0].hood")</hood>"
> > -    fi
> > +    if [ "$(uci -q get "system.@system[0].hood")" ]
> > +    then
> > +        SYSTEM_DATA=$SYSTEM_DATA"<hood>$(uci -q get
> "system.@system[0].hood")</hood>"
> > +    fi
> >      SYSTEM_DATA=$SYSTEM_DATA"<distname>$distname</distname>"
> >
> SYSTEM_DATA=$SYSTEM_DATA"<distversion>$distversion</distversion>"
> >      SYSTEM_DATA=$SYSTEM_DATA"$cpu"
> > diff --git a/src/packages/fff/fff-sysupgrade/Makefile
> > b/src/packages/fff/fff-sysupgrade/Makefile
> > index ab809c9..b2e1ffa 100644
> > --- a/src/packages/fff/fff-sysupgrade/Makefile
> > +++ b/src/packages/fff/fff-sysupgrade/Makefile
> > @@ -13,7 +13,7 @@ define Package/$(PKG_NAME)
> >      CATEGORY:=Freifunk
> >      TITLE:=Freifunk-Franken sysupgrade
> >      URL:=http://www.freifunk-franken.de
> > -    DEPENDS:=+fff-boardname +fff-hoods +@BUSYBOX_CONFIG_WGET
> > +    DEPENDS:=+fff-boardname +fff-config +fff-hoods
> > + +@BUSYBOX_CONFIG_WGET
> >  endef
> >
> >  define Package/$(PKG_NAME)/description diff --git
> > a/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/05-config-sys
> > tem-migration
> > b/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/05-config-sys
> > tem-migration
> > index 0e36587..fe4ad97 100644
> > ---
> > a/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/05-config-sys
> > tem-migration
> > +++ b/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/05-config
> > +++ -system-migration
> > @@ -1,21 +1,27 @@
> >  #!/bin/sh
> >
> > -UPGRADE_hostname=$(uci -q get "system.@system[0].hostname")
> > -UPGRADE_description=$(uci -q get "system.@system[0].description")
> > -UPGRADE_latitude=$(uci -q get "system.@system[0].latitude")
> > -UPGRADE_longitude=$(uci -q get "system.@system[0].longitude")
> > -UPGRADE_position_comment=$(uci -q get
> > "system.@system[0].position_comment")
> > -UPGRADE_contact=$(uci -q get "system.@system[0].contact")
> > +if [ ! -s /etc/config/fff ] ; then
> >
> > -/bin/rm -rf /etc/config/system
> > +	UPGRADE_hostname=$(uci -q get "system.@system[0].hostname")
> > +	UPGRADE_description=$(uci -q get
> "system.@system[0].description")
> > +	UPGRADE_latitude=$(uci -q get "system.@system[0].latitude")
> > +	UPGRADE_longitude=$(uci -q get "system.@system[0].longitude")
> > +	UPGRADE_position_comment=$(uci -q get
> "system.@system[0].position_comment")
> > +	UPGRADE_contact=$(uci -q get "system.@system[0].contact")
> >
> > -/bin/config_generate
> > +	/bin/rm -rf /etc/config/system
> > +
> > +	/bin/config_generate
> >
> > -test -n "${UPGRADE_hostname}" && uci -q set
> "system.@system[0].hostname=${UPGRADE_hostname}"
> > -test -n "${UPGRADE_description}" && uci -q set
> "system.@system[0].description=${UPGRADE_description}"
> > -test -n "${UPGRADE_latitude}" && uci -q set
> "system.@system[0].latitude=${UPGRADE_latitude}"
> > -test -n "${UPGRADE_longitude}" && uci -q set
> "system.@system[0].longitude=${UPGRADE_longitude}"
> > -test -n "${UPGRADE_position_comment}" && uci -q set
> "system.@system[0].position_comment=${UPGRADE_position_comment}"
> > -test -n "${UPGRADE_contact}" && uci -q set
> "system.@system[0].contact=${UPGRADE_contact}"
> > +	touch /etc/config/fff
> >
> > -uci -q commit system
> > +	uci -q set fff.system=fff
> > +	test -n "${UPGRADE_hostname}" && uci -q set
> "fff.system.hostname=${UPGRADE_hostname}"
> > +	test -n "${UPGRADE_description}" && uci -q set
> "fff.system.description=${UPGRADE_description}"
> > +	test -n "${UPGRADE_latitude}" && uci -q set
> "fff.system.latitude=${UPGRADE_latitude}"
> > +	test -n "${UPGRADE_longitude}" && uci -q set
> "fff.system.longitude=${UPGRADE_longitude}"
> > +	test -n "${UPGRADE_position_comment}" && uci -q set
> "fff.system.position_comment=${UPGRADE_position_comment}"
> > +	test -n "${UPGRADE_contact}" && uci -q set
> "fff.system.contact=${UPGRADE_contact}"
> > +
> > +	uci -q commit fff
> > +fi
> > diff --git
> > a/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/99-fff-sysupg
> > rade
> > b/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/99-fff-sysupg
> > rade
> > index ab6f2de..847ce1e 100644
> > ---
> > a/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/99-fff-sysupg
> > rade
> > +++ b/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/99-fff-sy
> > +++ supgrade
> > @@ -8,5 +8,5 @@ cat > /etc/sysupgrade.conf <<-__EOF__
> > /etc/dropbear/dropbear_rsa_host_key
> >  /etc/dropbear/authorized_keys
> >  /etc/network.config
> > -/etc/config/system
> > +/etc/config/fff
> >  __EOF__
> > diff --git a/src/packages/fff/fff-web/Makefile
> > b/src/packages/fff/fff-web/Makefile
> > index 708dbb9..d7201e2 100644
> > --- a/src/packages/fff/fff-web/Makefile
> > +++ b/src/packages/fff/fff-web/Makefile
> > @@ -1,7 +1,7 @@
> >  include $(TOPDIR)/rules.mk
> >
> >  PKG_NAME:=fff-web
> > -PKG_VERSION:=0.0.4
> > +PKG_VERSION:=5
> >  PKG_RELEASE:=2
> >
> >  PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
> > @@ -13,7 +13,7 @@ define Package/$(PKG_NAME)
> >      CATEGORY:=Freifunk
> >      TITLE:= Freifunk-Franken Webinterface
> >      URL:=http://www.freifunk-franken.de
> > -    DEPENDS:=+uhttpd +libustream-mbedtls +haserl +px5g +simple-tc +fff-
> boardname +fff-network
> > +    DEPENDS:=+uhttpd +libustream-mbedtls +haserl +px5g +simple-tc
> > + +fff-boardname +fff-config +fff-network
> >  endef
> >
> >  define Package/$(PKG_NAME)/description diff --git
> > a/src/packages/fff/fff-web/files/www/public/cgi-bin/status.html
> > b/src/packages/fff/fff-web/files/www/public/cgi-bin/status.html
> > index f96846c..96d657b 100755
> > --- a/src/packages/fff/fff-web/files/www/public/cgi-bin/status.html
> > +++ b/src/packages/fff/fff-web/files/www/public/cgi-bin/status.html
> > @@ -2,13 +2,13 @@
> >
> >  <%
> >  echo -en "Content-Type: text/html\r\n\r\n"
> > -HOSTNAME=$(uci -q get 'system.@system[0].hostname')
> > +HOSTNAME="$(uci -q get "fff.system.hostname")"
> >  hood="$(uci -q get "system.@system[0].hood")"
> >
> >  MAC="$(uci -q get network.mesh.macaddr)"
> > -lat="$(uci -q get system.@system[0].latitude)"
> > -lon="$(uci -q get system.@system[0].longitude)"
> > -contact="$(uci -q get system.@system[0].contact)"
> > +lat="$(uci -q get "fff.system.latitude")"
> > +lon="$(uci -q get "fff.system.longitude")"
> > +contact="$(uci -q get "fff.system.contact")"
> >
> >  . /etc/firmware_release
> >
> > @@ -48,11 +48,11 @@ contact="$(uci -q get system.@system[0].contact)"
> >  								<tr><th>MAC-
> Adresse:</th><td style="text-transform: uppercase;"><a
> href="https://monitoring.freifunk-franken.de/api/get_router_by_mac/<%=
> $MAC %>"><%= $MAC %></a></td></tr>
> >
> 	<tr><th>Modell:</th><td><% cat /tmp/sysinfo/model 2>/dev/null
> %></td></tr>
> >
> 	<tr><th>Firmware:</th><td><%= ${FIRMWARE_VERSION}
> %></td></tr>
> > -
> 	<tr><th>Beschreibung:</th><td><% uci -q get
> 'system.@system[0].description' %></td></tr>
> > +
> 	<tr><th>Beschreibung:</th><td><% uci -q get
> > +'fff.system.description' %></td></tr>
> >
> 	<tr><th>Position:</th><td><% if [ -n "$lat" -a -n "$lon" ]; then
> >  									echo
> "<a href=\"https://monitoring.freifunk-
> franken.de/map?mapcenter=$lat,$lon,16\">${lat:0:8}N, ${lon:0:8}E</a>"
> >  								fi
> %></td></tr>
> > -
> 	<tr><th>Standort:</th><td><% uci -q get
> 'system.@system[0].position_comment' %></td></tr>
> > +
> 	<tr><th>Standort:</th><td><% uci -q get
> > +'fff.system.position_comment' %></td></tr>
> >  								<tr><th>E-Mail
> Adresse:</th><td><a href="mailto:<%= $contact %>"><%= $contact
> %></a></td></tr>
> >  							</table>
> >  						</fieldset>
> > diff --git a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/header
> > b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/header
> > index c327013..f98a3f3 100755
> > --- a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/header
> > +++ b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/header
> > @@ -12,7 +12,7 @@ nav_entry() {
> >  	echo -ne "\t<li${class_active}><a
> href=\"${script_file}\">$2</a></li>\n\t\t"
> >  }
> >
> > -HOSTNAME=$(uci -q get 'system.@system[0].hostname')
> > +HOSTNAME="$(uci -q get "fff.system.hostname")"
> >  hood="$(uci -q get "system.@system[0].hood")"
> >
> >  NOW=$(date +%s)
> > diff --git
> > a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/settings.html
> > b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/settings.html
> > index e7bc3e9..b785aed 100755
> > --- a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/settings.html
> > +++ b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/settings.html
> > @@ -13,25 +13,32 @@ if [ "$REQUEST_METHOD" == "POST" ] ; then
> >  		MSG='<span class="red">Knotenname enth&auml;lt
> ung&uuml;ltige Zeichen!</span>'
> >  	else
> >  		# Allgemeine Einstellungen
> > +		uci -q set "fff.system.hostname=${POST_hostname}"
> > +		echo "$(uci -q get "fff.system.hostname")" >
> > +/proc/sys/kernel/hostname
> >  		uci -q set
> "system.@system[0].hostname=${POST_hostname}"
> > -		echo "$(uci -q get "system.@system[0].hostname")" >
> /proc/sys/kernel/hostname
> > -		uci -q set
> "system.@system[0].description=${POST_description}"
> > -		uci -q set "system.@system[0].latitude=${POST_latitude}"
> > -		uci -q set
> "system.@system[0].longitude=${POST_longitude}"
> > -		uci -q set
> "system.@system[0].position_comment=${POST_position_comment}"
> > -		uci -q set "system.@system[0].contact=${POST_contact}"
> > +		uci -q set "fff.system.description=${POST_description}"
> > +		uci -q set "fff.system.latitude=${POST_latitude}"
> > +		uci -q set "fff.system.longitude=${POST_longitude}"
> > +		uci -q set
> "fff.system.position_comment=${POST_position_comment}"
> > +		uci -q set "fff.system.contact=${POST_contact}"
> >
> >  		# Bitratenbegrenzung
> > +		uci -q get "fff.trafficcontrol" > /dev/null || uci -q set
> > +fff.trafficcontrol=fff
> >  		if [ "$POST_traffic_limit" == "on" ] ; then
> > -			uci -q set "simple-tc.example.ifname=wan"
> > +			uci -q set "fff.trafficcontrol.enabled=1"
> >  			uci -q set "simple-tc.example.enabled=1"
> >  		else
> > +			uci -q set "fff.trafficcontrol.enabled=0"
> >  			uci -q set "simple-tc.example.enabled=0"
> >  		fi
> > +		uci -q set "fff.trafficcontrol.limit_in=${POST_limit_ingress}"
> > +		uci -q set "fff.trafficcontrol.limit_out=${POST_limit_egress}"
> > +
> > +		uci -q set "simple-tc.example.ifname=wan"
> >  		uci -q set "simple-
> tc.example.limit_ingress=${POST_limit_ingress}"
> >  		uci -q set "simple-
> tc.example.limit_egress=${POST_limit_egress}"
> >
> > -		uci commit
> > +		uci -q commit
> >
> >  		MSG='<span class="green">Daten gespeichert! - Bitte Router
> neustarten.</span>'
> >  	fi
> > @@ -41,7 +48,7 @@ fi
> >  <%in /www/ssl/cgi-bin/helpers %>
> >  <%
> >  # read
> > -if [ "$(uci -q get 'simple-tc.example.enabled')" == "1" ] ; then
> > +if [ "$(uci -q get 'fff.trafficcontrol.enabled')" == "1" ] ; then
> >  	traffic_checked='checked="checked" '
> >  else
> >  	traffic_checked=""
> > @@ -55,16 +62,16 @@ fi
> >  	<legend>Allgemeine Einstellungen</legend>
> >  	<table>
> >  		<tr><th>Knotenname:</th><td><input type="text"
> name="hostname" value="<%= ${HOSTNAME} %>" /></td></tr>
> > -		<tr><th>Knotenbeschreibung:</th><td><input type="text"
> name="description" value="<%= $(uci -q get
> 'system.@system[0].description') %>" /></td></tr>
> > +		<tr><th>Knotenbeschreibung:</th><td><input type="text"
> > +name="description" value="<%= $(uci -q get 'fff.system.description')
> > +%>" /></td></tr>
> >  		<tr><th>GPS Breitengrad:</th>
> > -			<td><input type="text" name="latitude" value="<%=
> $(uci -q get 'system.@system[0].latitude') %>" /></td>
> > +			<td><input type="text" name="latitude" value="<%=
> $(uci -q get
> > +'fff.system.latitude') %>" /></td>
> >  			<td rowspan="2" style="vertical-align: middle;">
> >  				<button type="button" style="height: 100%;
> width: 126px; margin-left: 5px;" onclick="window.open('/map.html', '_blank',
> 'location=0,status=0,scrollbars=1,width=400,height=300');">Position auf
> Karte anzeigen / setzen</button>
> >  			</td>
> >  		</tr>
> > -		<tr><th>GPS L&auml;ngengrad:</th><td><input type="text"
> name="longitude" value="<%= $(uci -q get 'system.@system[0].longitude')
> %>" /></td></tr>
> > -		<tr><th>Standortbeschreibung:</th><td><input type="text"
> name="position_comment" value="<%= $(uci -q get
> 'system.@system[0].position_comment') %>" /></td></tr>
> > -		<tr><th>E-Mail Adresse:</th><td><input type="email"
> name="contact" value="<%= $(uci -q get 'system.@system[0].contact') %>"
> /></td></tr>
> > +		<tr><th>GPS L&auml;ngengrad:</th><td><input type="text"
> name="longitude" value="<%= $(uci -q get 'fff.system.longitude') %>"
> /></td></tr>
> > +		<tr><th>Standortbeschreibung:</th><td><input type="text"
> name="position_comment" value="<%= $(uci -q get
> 'fff.system.position_comment') %>" /></td></tr>
> > +		<tr><th>E-Mail Adresse:</th><td><input type="email"
> name="contact"
> > +value="<%= $(uci -q get 'fff.system.contact') %>" /></td></tr>
> >  	</table>
> >  </fieldset>
> >  </td><td>
> > @@ -74,8 +81,8 @@ fi
> >  		<tr><th>Aktiviert:</th><td colspan="2">
> >  			<input type="checkbox" name="traffic_limit" <%=
> ${traffic_checked} %>/>
> >  		</td></tr>
> > -		<tr><th>Freifunk&nbsp;Download:</th><td><input
> type="text" name="limit_ingress" value="<%= $(uci -q get 'simple-
> tc.example.limit_ingress') %>" /></td><td>kbit/s</td></tr>
> > -		<tr><th>Freifunk&nbsp;Upload:</th><td><input
> type="text" name="limit_egress" value="<%= $(uci -q get 'simple-
> tc.example.limit_egress') %>" /></td><td>kbit/s</td></tr>
> > +		<tr><th>Freifunk&nbsp;Download:</th><td><input
> type="text" name="limit_ingress" value="<%= $(uci -q get
> 'fff.trafficcontrol.limit_in') %>" /></td><td>kbit/s</td></tr>
> > +		<tr><th>Freifunk&nbsp;Upload:</th><td><input
> type="text"
> > +name="limit_egress" value="<%= $(uci -q get
> > +'fff.trafficcontrol.limit_out') %>" /></td><td>kbit/s</td></tr>
> >  	</table>
> >  </fieldset>
> >  </td></tr>
> > diff --git a/src/packages/fff/fff/Makefile
> > b/src/packages/fff/fff/Makefile index 305ab8d..dce33f9 100644
> > --- a/src/packages/fff/fff/Makefile
> > +++ b/src/packages/fff/fff/Makefile
> > @@ -18,6 +18,7 @@ define Package/fff-base
> >               +ip6tables \
> >               +odhcp6c \
> >               +micrond \
> > +             +fff-config \
> Ich bin mir grad nicht sicher, ob fff-base wirklich davon abhängen sollte.
> Immerhin wird es ja von fff-base nicht benötigt, aber von den anderen
> Paketen.. Naja, tut aber auch nicht weh.. Mir egal. ;)

Haben wir was gemeinsam, ich hab mir eine ähnliche Frage gestellt. Aber irgendwie sind z.B. die Koordinaten ja essentiell für die Funktion.

Grüße

Adrian

> 
> Tim
> 
> >               +fff-nodewatcher \
> >               +fff-web \
> >               +fff-uradvd \
> > --
> > 2.7.4
> >
Tim Niemeyer Nov. 2, 2017, 10:50 p.m.
Hi

Am 2. November 2017 23:24:50 MEZ schrieb mail@adrianschmutzler.de:
>Hallo,
>
>siehe unten.
>
>> -----Original Message-----
>> From: Tim Niemeyer [mailto:tim@tn-x.org]
>> Sent: Donnerstag, 2. November 2017 23:06
>> To: Adrian Schmutzler <freifunk@adrianschmutzler.de>; franken-
>> dev@freifunk.net
>> Subject: Re: [PATCH v11 1/6] Rearrange fff config values into their
>own config
>> file
>> 
>> Hi
>> 
>> Zusammenfassung:
>> - Schaut gut aus, aber bei dem Hostname haben wir scheinbar zwei
>> Probleme.
>> - Downgrade muss raus
>> - Paar Kleinigkeiten die egal sind
>> 
>> Am Mittwoch, den 18.10.2017, 23:30 +0200 schrieb Adrian Schmutzler:
>> > This moves the FFF configuration from
>> > /etc/config/system to a new file /etc/config/fff. Thus, this file
>can
>> > be copied as a whole during upgrade (with compatibility provided)
>and
>> > then resulting values in other files are re-set later.
>> >
>> > This also fixes the bandwidth settings not being persistent during
>> > upgrade. Other settings may join ...
>> >
>> > I tried to go through all the code and update all occurrences of
>the
>> > relevant system variables (looking for "system" both in GitHub and
>my
>> > local src folder).
>> >
>> > When downgrading, this requires rewriting the values into the
>> > /etc/config/system. For this purpose, a script has been added.
>(Which
>> > will be integrated into the WebUI in another patch)
>> >
>> > Changes in v11:
>> >  - Redesign for keyexchange v2.
>> >
>> > Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
>> > Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
>> > ---
>> >  src/packages/fff/fff-config/Makefile               | 40
>> ++++++++++++++++++++++
>> >  .../files/etc/uci-defaults/98-configure-fff        | 25
>++++++++++++++
>> >  .../files/usr/sbin/prepare_firmware_downgrade.sh   | 23
>+++++++++++++
>> >  src/packages/fff/fff-hoods/Makefile                |  2 +-
>> >  .../fff/fff-hoods/files/usr/sbin/configurehood     |  4 +--
>> >  src/packages/fff/fff-nodewatcher/Makefile          |  4 +--
>> >  .../fff/fff-nodewatcher/files/usr/sbin/nodewatcher | 20
>+++++------
>> >  src/packages/fff/fff-sysupgrade/Makefile           |  2 +-
>> >  .../etc/uci-defaults/05-config-system-migration    | 36
>+++++++++++--------
>> >  .../files/etc/uci-defaults/99-fff-sysupgrade       |  2 +-
>> >  src/packages/fff/fff-web/Makefile                  |  4 +--
>> >  .../fff-web/files/www/public/cgi-bin/status.html   | 12 +++----
>> >  .../fff/fff-web/files/www/ssl/cgi-bin/header       |  2 +-
>> >  .../fff-web/files/www/ssl/cgi-bin/settings.html    | 39
>++++++++++++------
>> ---
>> >  src/packages/fff/fff/Makefile                      |  1 +
>> >  15 files changed, 159 insertions(+), 57 deletions(-)  create mode
>> > 100644 src/packages/fff/fff-config/Makefile
>> >  create mode 100644
>> > src/packages/fff/fff-config/files/etc/uci-defaults/98-configure-fff
>> >  create mode 100755
>> >
>src/packages/fff/fff-config/files/usr/sbin/prepare_firmware_downgrade.
>> > sh
>> >
>> > diff --git a/src/packages/fff/fff-config/Makefile
>> > b/src/packages/fff/fff-config/Makefile
>> > new file mode 100644
>> > index 0000000..fe4f5df
>> > --- /dev/null
>> > +++ b/src/packages/fff/fff-config/Makefile
>> > @@ -0,0 +1,40 @@
>> > +include $(TOPDIR)/rules.mk
>> > +
>> > +PKG_NAME:=fff-config
>> > +PKG_VERSION:=1
>> > +PKG_RELEASE:=1
>> > +
>> > +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
>> > +
>> > +include $(INCLUDE_DIR)/package.mk
>> > +
>> > +define Package/$(PKG_NAME)
>> > +    SECTION:=base
>> > +    CATEGORY:=Freifunk
>> > +    TITLE:=Freifunk-Franken Config
>> > +    URL:=http://www.freifunk-franken.de
>> > +    DEPENDS:=+fff-boardname +@BUSYBOX_CONFIG_WGET endef
>> > +
>> > +define Package/$(PKG_NAME)/description
>> > +    This is the Freifunk Franken Firmware Config package.
>> > +    This packages provides utilities for a central FFF config
>file.
>> > +endef
>> > +
>> > +define Build/Prepare
>> > +    echo "all: " > $(PKG_BUILD_DIR)/Makefile endef
>> > +
>> > +define Build/Configure
>> > +    # nothing
>> > +endef
>> > +
>> > +define Build/Compile
>> > +    # nothing
>> > +endef
>> > +
>> > +define Package/$(PKG_NAME)/install
>> > +    $(CP) ./files/* $(1)/
>> > +endef
>> > +
>> > +$(eval $(call BuildPackage,$(PKG_NAME)))
>> > diff --git
>> >
>a/src/packages/fff/fff-config/files/etc/uci-defaults/98-configure-fff
>> >
>b/src/packages/fff/fff-config/files/etc/uci-defaults/98-configure-fff
>> > new file mode 100644
>> > index 0000000..e337e88
>> > --- /dev/null
>> > +++
>b/src/packages/fff/fff-config/files/etc/uci-defaults/98-configure-
>> > +++ fff
>> > @@ -0,0 +1,25 @@
>> > +#!/bin/sh
>> > +# 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=Freifunk-Router"
>> Dieser Teil kollidiert mit dem
>> --- %< ---
>>     [ "$hostname" = "LEDE" ] && hostname="$mac"
>> --- >% ---
>> aus dem Nodewatcher und vpn-select.
>
>LEDE setzt den Hostnamen tatsächlich beim First-Boot, wodurch
>uci-defaults/05-config-system-migration diesen in die fffconfig
>schreibt.
>
>Ich würde die Zeile hier trotzdem drin lassen, weil der Fall eines
>fehlenden Hostnamen trotzdem abgefangen werden sollte. Wenn es dir
>lieber ist, kann ich hier LEDE verwenden.
>
>Ggf. kann man das entsprechend im nodewatcher ergänzen. Im vpn-select
>sollte der Hostname doch obsolet sein.
>
>> 
>> > +fi
>> > +
>> > +FFF_hostname=$(uci -q get "fff.system.hostname") test -n
>> > +"${FFF_hostname}" && uci -q set
>> "system.@system[0].hostname=${FFF_hostname}"
>> Hier wird noch einmal das system.@system[0].hostname gesetzt. Später
>> aber wenn der Hostname z.B. über das web-ui gesetzt wurde nicht mehr.
>
>Das ist eine Vorsichtsmaßnahme. Ich weiß nicht, ob LEDE einen Hostnamen
>braucht, um zu funktionieren. Immerhin setzt es ihn zu Beginn selbst;
>daher habe ich (nur) den Hostnamen immer an beiden Stellen
>gesetzt\geupdatet. Man könnte überlegen, ob man ihn in der system
>config einfach auf LEDE lässt und schaut, was passiert.
>
>> 
>> Ich vermute, dass LEDE irgendwo ein Script mit bringt, welches beim
>booten
>> den Hostname aus dem system.@system[0].hostname setzt. Dieses
>> müssten man noch umschreiben. Ansonsten wäre folgendes Szenario
>> broken:
>> 
>> Update mit Hostname=Test1
>> Web-Ui setzt Hostname=Test2
>> Reboot
>> Knoten heißt Test1
>
>Das wäre jetzt für den Fall, das wir hostname aus system ganz
>rausschmeißen?

Ne. Aber das webui setzt ihn ja nicht mehr im System. Oder hab ich das jetzt übersehen?

Äh, ich glaub ich hab's übersehen..

>Ich finde nicht, das wir das tun sollten. Da müssen wir dann zu viel am
>LEDE rumpatchen und mitdenken. Dann lieber zwei Mal den Wert doppelt
>schreiben.

Ja, sehe ich genauso.


>> 
>> > +test -n "${FFF_hostname}" && echo "${FFF_hostname}" >
>> > +/proc/sys/kernel/hostname
>> > +
>> > +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}"
>> Ich hab grad überlegt, ob es Sinn macht, die in/out Limit's zu
>setzen, auch
>> wenn traffic_enabled false ist. Aber es schadet zumindest auch nicht,
>von
>> daher ok.
>> 
>> > +
>> > +uci -q commit
>> > diff --git
>> >
>a/src/packages/fff/fff-config/files/usr/sbin/prepare_firmware_downgrad
>> > e.sh
>> >
>b/src/packages/fff/fff-config/files/usr/sbin/prepare_firmware_downgrad
>> > e.sh
>> > new file mode 100755
>> > index 0000000..ab96ba4
>> > --- /dev/null
>> > +++
>b/src/packages/fff/fff-config/files/usr/sbin/prepare_firmware_down
>> > +++ grade.sh
>> Das ganze File kommt ja weg, daher hab ich es mir nicht angeschaut..
>> 
>> [..]
>> 
>> > diff --git a/src/packages/fff/fff-hoods/Makefile
>> > b/src/packages/fff/fff-hoods/Makefile
>> > index dd22df4..11ab6d1 100644
>> > --- a/src/packages/fff/fff-hoods/Makefile
>> > +++ b/src/packages/fff/fff-hoods/Makefile
>> > @@ -13,7 +13,7 @@ define Package/$(PKG_NAME)
>> >      CATEGORY:=Freifunk
>> >      TITLE:= Freifunk-Franken hoods
>> >      URL:=http://www.freifunk-franken.de
>> > -    DEPENDS:=+fff-network
>> > +    DEPENDS:=+fff-network +fff-config
>> >  endef
>> >
>> >  define Package/$(PKG_NAME)/description diff --git
>> > a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
>> > b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
>> > index f7ddb6e..e7a6eda 100755
>> > --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
>> > +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
>> > @@ -57,8 +57,8 @@ if [ -f /tmp/hiddenapflag ]; then
>> >  	rm /tmp/hiddenapflag
>> >  fi
>> >
>> > -lat=$(uci -q get system.@system[0].latitude) -long=$(uci -q get
>> > system.@system[0].longitude)
>> > +lat=$(uci -q get fff.system.latitude) long=$(uci -q get
>> > +fff.system.longitude)
>> >
>> >  # if we have Internet, we download the Hoodfile from the
>keyxchangev2
>> > if hasInternet ; then diff --git
>> > a/src/packages/fff/fff-nodewatcher/Makefile
>> > b/src/packages/fff/fff-nodewatcher/Makefile
>> > index 79cb917..7bfd08e 100644
>> > --- a/src/packages/fff/fff-nodewatcher/Makefile
>> > +++ b/src/packages/fff/fff-nodewatcher/Makefile
>> > @@ -1,7 +1,7 @@
>> >  include $(TOPDIR)/rules.mk
>> >
>> >  PKG_NAME:=fff-nodewatcher
>> > -PKG_VERSION:=41
>> > +PKG_VERSION:=43
>> >  PKG_RELEASE:=1
>> >
>> >  PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
>> > @@ -13,7 +13,7 @@ define Package/$(PKG_NAME)
>> >      CATEGORY:=Freifunk
>> >      TITLE:= Freifunk-Franken Nodewatcher
>> >      URL:=http://www.freifunk-franken.de
>> > -    DEPENDS:=+alfred +micrond +fff-random +ip +ip-bridge
>> > +    DEPENDS:=+alfred +micrond +fff-config +fff-random +ip
>+ip-bridge
>> >  endef
>> >
>> >  define Package/$(PKG_NAME)/description diff --git
>> > a/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
>> > b/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
>> > index 35adf91..80548ac 100755
>> > --- a/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
>> > +++ b/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
>> > @@ -2,7 +2,7 @@
>> >  # Netmon Nodewatcher (C) 2010-2012 Freifunk Oldenburg  # License;
>GPL
>> > v3
>> >
>> > -SCRIPT_VERSION="41"
>> > +SCRIPT_VERSION="43"
>> >
>> >  test -f /tmp/started || exit
>> >
>> > @@ -58,20 +58,20 @@ crawl() {
>> >      hostname="$(cat /proc/sys/kernel/hostname)"
>> >      mac=$(awk '{ mac=toupper($1); gsub(":", "", mac); print mac }'
>> /sys/class/net/br-mesh/address 2>/dev/null)
>> >      [ "$hostname" = "LEDE" ] && hostname="$mac"
>> > -    description="$(uci get system.@system[0].description)"
>> > +    description="$(uci -q get fff.system.description)"
>> >      if [ -n "$description" ]; then
>> >         
>description="<description><![CDATA[$description]]></description>"
>> >      fi
>> > -    latitude="$(uci get system.@system[0].latitude)"
>> > -    longitude="$(uci get system.@system[0].longitude)"
>> > +    latitude="$(uci -q get fff.system.latitude)"
>> > +    longitude="$(uci -q get fff.system.longitude)"
>> >      if [ -n "$longitude" -a -n "$latitude" ]; then
>> >         
>geo="<geo><lat>$latitude</lat><lng>$longitude</lng></geo>";
>> >      fi
>> > -    position_comment="$(uci get
>system.@system[0].position_comment)"
>> > +    position_comment="$(uci -q get fff.system.position_comment)"
>> >      if [ -n "$position_comment" ]; then
>> >
>> position_comment="<position_comment><![CDATA[$position_comment]]>
>> </position_comment>"
>> >      fi
>> > -    contact="$(uci get system.@system[0].contact)"
>> > +    contact="$(uci -q get fff.system.contact)"
>> >      if [ -n "$contact" ]; then
>> >          contact="<contact>$contact</contact>"
>> >      fi
>> > @@ -137,10 +137,10 @@ crawl() {
>> >      SYSTEM_DATA=$SYSTEM_DATA"${geo}"
>> >      SYSTEM_DATA=$SYSTEM_DATA"${position_comment}"
>> >      SYSTEM_DATA=$SYSTEM_DATA"${contact}"
>> > -    if [ "$(uci -q get "system.@system[0].hood")" ]
>> > -    then
>> > -        SYSTEM_DATA=$SYSTEM_DATA"<hood>$(uci -q get
>> "system.@system[0].hood")</hood>"
>> > -    fi
>> > +    if [ "$(uci -q get "system.@system[0].hood")" ]
>> > +    then
>> > +        SYSTEM_DATA=$SYSTEM_DATA"<hood>$(uci -q get
>> "system.@system[0].hood")</hood>"
>> > +    fi
>> >      SYSTEM_DATA=$SYSTEM_DATA"<distname>$distname</distname>"
>> >
>> SYSTEM_DATA=$SYSTEM_DATA"<distversion>$distversion</distversion>"
>> >      SYSTEM_DATA=$SYSTEM_DATA"$cpu"
>> > diff --git a/src/packages/fff/fff-sysupgrade/Makefile
>> > b/src/packages/fff/fff-sysupgrade/Makefile
>> > index ab809c9..b2e1ffa 100644
>> > --- a/src/packages/fff/fff-sysupgrade/Makefile
>> > +++ b/src/packages/fff/fff-sysupgrade/Makefile
>> > @@ -13,7 +13,7 @@ define Package/$(PKG_NAME)
>> >      CATEGORY:=Freifunk
>> >      TITLE:=Freifunk-Franken sysupgrade
>> >      URL:=http://www.freifunk-franken.de
>> > -    DEPENDS:=+fff-boardname +fff-hoods +@BUSYBOX_CONFIG_WGET
>> > +    DEPENDS:=+fff-boardname +fff-config +fff-hoods
>> > + +@BUSYBOX_CONFIG_WGET
>> >  endef
>> >
>> >  define Package/$(PKG_NAME)/description diff --git
>> >
>a/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/05-config-sys
>> > tem-migration
>> >
>b/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/05-config-sys
>> > tem-migration
>> > index 0e36587..fe4ad97 100644
>> > ---
>> >
>a/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/05-config-sys
>> > tem-migration
>> > +++
>b/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/05-config
>> > +++ -system-migration
>> > @@ -1,21 +1,27 @@
>> >  #!/bin/sh
>> >
>> > -UPGRADE_hostname=$(uci -q get "system.@system[0].hostname")
>> > -UPGRADE_description=$(uci -q get "system.@system[0].description")
>> > -UPGRADE_latitude=$(uci -q get "system.@system[0].latitude")
>> > -UPGRADE_longitude=$(uci -q get "system.@system[0].longitude")
>> > -UPGRADE_position_comment=$(uci -q get
>> > "system.@system[0].position_comment")
>> > -UPGRADE_contact=$(uci -q get "system.@system[0].contact")
>> > +if [ ! -s /etc/config/fff ] ; then
>> >
>> > -/bin/rm -rf /etc/config/system
>> > +	UPGRADE_hostname=$(uci -q get "system.@system[0].hostname")
>> > +	UPGRADE_description=$(uci -q get
>> "system.@system[0].description")
>> > +	UPGRADE_latitude=$(uci -q get "system.@system[0].latitude")
>> > +	UPGRADE_longitude=$(uci -q get "system.@system[0].longitude")
>> > +	UPGRADE_position_comment=$(uci -q get
>> "system.@system[0].position_comment")
>> > +	UPGRADE_contact=$(uci -q get "system.@system[0].contact")
>> >
>> > -/bin/config_generate
>> > +	/bin/rm -rf /etc/config/system
>> > +
>> > +	/bin/config_generate
>> >
>> > -test -n "${UPGRADE_hostname}" && uci -q set
>> "system.@system[0].hostname=${UPGRADE_hostname}"
>> > -test -n "${UPGRADE_description}" && uci -q set
>> "system.@system[0].description=${UPGRADE_description}"
>> > -test -n "${UPGRADE_latitude}" && uci -q set
>> "system.@system[0].latitude=${UPGRADE_latitude}"
>> > -test -n "${UPGRADE_longitude}" && uci -q set
>> "system.@system[0].longitude=${UPGRADE_longitude}"
>> > -test -n "${UPGRADE_position_comment}" && uci -q set
>> "system.@system[0].position_comment=${UPGRADE_position_comment}"
>> > -test -n "${UPGRADE_contact}" && uci -q set
>> "system.@system[0].contact=${UPGRADE_contact}"
>> > +	touch /etc/config/fff
>> >
>> > -uci -q commit system
>> > +	uci -q set fff.system=fff
>> > +	test -n "${UPGRADE_hostname}" && uci -q set
>> "fff.system.hostname=${UPGRADE_hostname}"
>> > +	test -n "${UPGRADE_description}" && uci -q set
>> "fff.system.description=${UPGRADE_description}"
>> > +	test -n "${UPGRADE_latitude}" && uci -q set
>> "fff.system.latitude=${UPGRADE_latitude}"
>> > +	test -n "${UPGRADE_longitude}" && uci -q set
>> "fff.system.longitude=${UPGRADE_longitude}"
>> > +	test -n "${UPGRADE_position_comment}" && uci -q set
>> "fff.system.position_comment=${UPGRADE_position_comment}"
>> > +	test -n "${UPGRADE_contact}" && uci -q set
>> "fff.system.contact=${UPGRADE_contact}"
>> > +
>> > +	uci -q commit fff
>> > +fi
>> > diff --git
>> >
>a/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/99-fff-sysupg
>> > rade
>> >
>b/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/99-fff-sysupg
>> > rade
>> > index ab6f2de..847ce1e 100644
>> > ---
>> >
>a/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/99-fff-sysupg
>> > rade
>> > +++
>b/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/99-fff-sy
>> > +++ supgrade
>> > @@ -8,5 +8,5 @@ cat > /etc/sysupgrade.conf <<-__EOF__
>> > /etc/dropbear/dropbear_rsa_host_key
>> >  /etc/dropbear/authorized_keys
>> >  /etc/network.config
>> > -/etc/config/system
>> > +/etc/config/fff
>> >  __EOF__
>> > diff --git a/src/packages/fff/fff-web/Makefile
>> > b/src/packages/fff/fff-web/Makefile
>> > index 708dbb9..d7201e2 100644
>> > --- a/src/packages/fff/fff-web/Makefile
>> > +++ b/src/packages/fff/fff-web/Makefile
>> > @@ -1,7 +1,7 @@
>> >  include $(TOPDIR)/rules.mk
>> >
>> >  PKG_NAME:=fff-web
>> > -PKG_VERSION:=0.0.4
>> > +PKG_VERSION:=5
>> >  PKG_RELEASE:=2
>> >
>> >  PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
>> > @@ -13,7 +13,7 @@ define Package/$(PKG_NAME)
>> >      CATEGORY:=Freifunk
>> >      TITLE:= Freifunk-Franken Webinterface
>> >      URL:=http://www.freifunk-franken.de
>> > -    DEPENDS:=+uhttpd +libustream-mbedtls +haserl +px5g +simple-tc
>+fff-
>> boardname +fff-network
>> > +    DEPENDS:=+uhttpd +libustream-mbedtls +haserl +px5g +simple-tc
>> > + +fff-boardname +fff-config +fff-network
>> >  endef
>> >
>> >  define Package/$(PKG_NAME)/description diff --git
>> > a/src/packages/fff/fff-web/files/www/public/cgi-bin/status.html
>> > b/src/packages/fff/fff-web/files/www/public/cgi-bin/status.html
>> > index f96846c..96d657b 100755
>> > --- a/src/packages/fff/fff-web/files/www/public/cgi-bin/status.html
>> > +++ b/src/packages/fff/fff-web/files/www/public/cgi-bin/status.html
>> > @@ -2,13 +2,13 @@
>> >
>> >  <%
>> >  echo -en "Content-Type: text/html\r\n\r\n"
>> > -HOSTNAME=$(uci -q get 'system.@system[0].hostname')
>> > +HOSTNAME="$(uci -q get "fff.system.hostname")"
>> >  hood="$(uci -q get "system.@system[0].hood")"
>> >
>> >  MAC="$(uci -q get network.mesh.macaddr)"
>> > -lat="$(uci -q get system.@system[0].latitude)"
>> > -lon="$(uci -q get system.@system[0].longitude)"
>> > -contact="$(uci -q get system.@system[0].contact)"
>> > +lat="$(uci -q get "fff.system.latitude")"
>> > +lon="$(uci -q get "fff.system.longitude")"
>> > +contact="$(uci -q get "fff.system.contact")"
>> >
>> >  . /etc/firmware_release
>> >
>> > @@ -48,11 +48,11 @@ contact="$(uci -q get
>system.@system[0].contact)"
>> >  								<tr><th>MAC-
>> Adresse:</th><td style="text-transform: uppercase;"><a
>>
>href="https://monitoring.freifunk-franken.de/api/get_router_by_mac/<%=
>> $MAC %>"><%= $MAC %></a></td></tr>
>> >
>> 	<tr><th>Modell:</th><td><% cat /tmp/sysinfo/model 2>/dev/null
>> %></td></tr>
>> >
>> 	<tr><th>Firmware:</th><td><%= ${FIRMWARE_VERSION}
>> %></td></tr>
>> > -
>> 	<tr><th>Beschreibung:</th><td><% uci -q get
>> 'system.@system[0].description' %></td></tr>
>> > +
>> 	<tr><th>Beschreibung:</th><td><% uci -q get
>> > +'fff.system.description' %></td></tr>
>> >
>> 	<tr><th>Position:</th><td><% if [ -n "$lat" -a -n "$lon" ]; then
>> >  									echo
>> "<a href=\"https://monitoring.freifunk-
>> franken.de/map?mapcenter=$lat,$lon,16\">${lat:0:8}N, ${lon:0:8}E</a>"
>> >  								fi
>> %></td></tr>
>> > -
>> 	<tr><th>Standort:</th><td><% uci -q get
>> 'system.@system[0].position_comment' %></td></tr>
>> > +
>> 	<tr><th>Standort:</th><td><% uci -q get
>> > +'fff.system.position_comment' %></td></tr>
>> >  								<tr><th>E-Mail
>> Adresse:</th><td><a href="mailto:<%= $contact %>"><%= $contact
>> %></a></td></tr>
>> >  							</table>
>> >  						</fieldset>
>> > diff --git a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/header
>> > b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/header
>> > index c327013..f98a3f3 100755
>> > --- a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/header
>> > +++ b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/header
>> > @@ -12,7 +12,7 @@ nav_entry() {
>> >  	echo -ne "\t<li${class_active}><a
>> href=\"${script_file}\">$2</a></li>\n\t\t"
>> >  }
>> >
>> > -HOSTNAME=$(uci -q get 'system.@system[0].hostname')
>> > +HOSTNAME="$(uci -q get "fff.system.hostname")"
>> >  hood="$(uci -q get "system.@system[0].hood")"
>> >
>> >  NOW=$(date +%s)
>> > diff --git
>> > a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/settings.html
>> > b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/settings.html
>> > index e7bc3e9..b785aed 100755
>> > --- a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/settings.html
>> > +++ b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/settings.html
>> > @@ -13,25 +13,32 @@ if [ "$REQUEST_METHOD" == "POST" ] ; then
>> >  		MSG='<span class="red">Knotenname enth&auml;lt
>> ung&uuml;ltige Zeichen!</span>'
>> >  	else
>> >  		# Allgemeine Einstellungen
>> > +		uci -q set "fff.system.hostname=${POST_hostname}"
>> > +		echo "$(uci -q get "fff.system.hostname")" >
>> > +/proc/sys/kernel/hostname
>> >  		uci -q set
>> "system.@system[0].hostname=${POST_hostname}"
>> > -		echo "$(uci -q get "system.@system[0].hostname")" >
>> /proc/sys/kernel/hostname
>> > -		uci -q set
>> "system.@system[0].description=${POST_description}"
>> > -		uci -q set "system.@system[0].latitude=${POST_latitude}"
>> > -		uci -q set
>> "system.@system[0].longitude=${POST_longitude}"
>> > -		uci -q set
>> "system.@system[0].position_comment=${POST_position_comment}"
>> > -		uci -q set "system.@system[0].contact=${POST_contact}"
>> > +		uci -q set "fff.system.description=${POST_description}"
>> > +		uci -q set "fff.system.latitude=${POST_latitude}"
>> > +		uci -q set "fff.system.longitude=${POST_longitude}"
>> > +		uci -q set
>> "fff.system.position_comment=${POST_position_comment}"
>> > +		uci -q set "fff.system.contact=${POST_contact}"
>> >
>> >  		# Bitratenbegrenzung
>> > +		uci -q get "fff.trafficcontrol" > /dev/null || uci -q set
>> > +fff.trafficcontrol=fff
>> >  		if [ "$POST_traffic_limit" == "on" ] ; then
>> > -			uci -q set "simple-tc.example.ifname=wan"
>> > +			uci -q set "fff.trafficcontrol.enabled=1"
>> >  			uci -q set "simple-tc.example.enabled=1"
>> >  		else
>> > +			uci -q set "fff.trafficcontrol.enabled=0"
>> >  			uci -q set "simple-tc.example.enabled=0"
>> >  		fi
>> > +		uci -q set "fff.trafficcontrol.limit_in=${POST_limit_ingress}"
>> > +		uci -q set "fff.trafficcontrol.limit_out=${POST_limit_egress}"
>> > +
>> > +		uci -q set "simple-tc.example.ifname=wan"
>> >  		uci -q set "simple-
>> tc.example.limit_ingress=${POST_limit_ingress}"
>> >  		uci -q set "simple-
>> tc.example.limit_egress=${POST_limit_egress}"
>> >
>> > -		uci commit
>> > +		uci -q commit
>> >
>> >  		MSG='<span class="green">Daten gespeichert! - Bitte Router
>> neustarten.</span>'
>> >  	fi
>> > @@ -41,7 +48,7 @@ fi
>> >  <%in /www/ssl/cgi-bin/helpers %>
>> >  <%
>> >  # read
>> > -if [ "$(uci -q get 'simple-tc.example.enabled')" == "1" ] ; then
>> > +if [ "$(uci -q get 'fff.trafficcontrol.enabled')" == "1" ] ; then
>> >  	traffic_checked='checked="checked" '
>> >  else
>> >  	traffic_checked=""
>> > @@ -55,16 +62,16 @@ fi
>> >  	<legend>Allgemeine Einstellungen</legend>
>> >  	<table>
>> >  		<tr><th>Knotenname:</th><td><input type="text"
>> name="hostname" value="<%= ${HOSTNAME} %>" /></td></tr>
>> > -		<tr><th>Knotenbeschreibung:</th><td><input type="text"
>> name="description" value="<%= $(uci -q get
>> 'system.@system[0].description') %>" /></td></tr>
>> > +		<tr><th>Knotenbeschreibung:</th><td><input type="text"
>> > +name="description" value="<%= $(uci -q get
>'fff.system.description')
>> > +%>" /></td></tr>
>> >  		<tr><th>GPS Breitengrad:</th>
>> > -			<td><input type="text" name="latitude" value="<%=
>> $(uci -q get 'system.@system[0].latitude') %>" /></td>
>> > +			<td><input type="text" name="latitude" value="<%=
>> $(uci -q get
>> > +'fff.system.latitude') %>" /></td>
>> >  			<td rowspan="2" style="vertical-align: middle;">
>> >  				<button type="button" style="height: 100%;
>> width: 126px; margin-left: 5px;" onclick="window.open('/map.html',
>'_blank',
>> 'location=0,status=0,scrollbars=1,width=400,height=300');">Position
>auf
>> Karte anzeigen / setzen</button>
>> >  			</td>
>> >  		</tr>
>> > -		<tr><th>GPS L&auml;ngengrad:</th><td><input type="text"
>> name="longitude" value="<%= $(uci -q get
>'system.@system[0].longitude')
>> %>" /></td></tr>
>> > -		<tr><th>Standortbeschreibung:</th><td><input type="text"
>> name="position_comment" value="<%= $(uci -q get
>> 'system.@system[0].position_comment') %>" /></td></tr>
>> > -		<tr><th>E-Mail Adresse:</th><td><input type="email"
>> name="contact" value="<%= $(uci -q get 'system.@system[0].contact')
>%>"
>> /></td></tr>
>> > +		<tr><th>GPS L&auml;ngengrad:</th><td><input type="text"
>> name="longitude" value="<%= $(uci -q get 'fff.system.longitude') %>"
>> /></td></tr>
>> > +		<tr><th>Standortbeschreibung:</th><td><input type="text"
>> name="position_comment" value="<%= $(uci -q get
>> 'fff.system.position_comment') %>" /></td></tr>
>> > +		<tr><th>E-Mail Adresse:</th><td><input type="email"
>> name="contact"
>> > +value="<%= $(uci -q get 'fff.system.contact') %>" /></td></tr>
>> >  	</table>
>> >  </fieldset>
>> >  </td><td>
>> > @@ -74,8 +81,8 @@ fi
>> >  		<tr><th>Aktiviert:</th><td colspan="2">
>> >  			<input type="checkbox" name="traffic_limit" <%=
>> ${traffic_checked} %>/>
>> >  		</td></tr>
>> > -		<tr><th>Freifunk&nbsp;Download:</th><td><input
>> type="text" name="limit_ingress" value="<%= $(uci -q get 'simple-
>> tc.example.limit_ingress') %>" /></td><td>kbit/s</td></tr>
>> > -		<tr><th>Freifunk&nbsp;Upload:</th><td><input
>> type="text" name="limit_egress" value="<%= $(uci -q get 'simple-
>> tc.example.limit_egress') %>" /></td><td>kbit/s</td></tr>
>> > +		<tr><th>Freifunk&nbsp;Download:</th><td><input
>> type="text" name="limit_ingress" value="<%= $(uci -q get
>> 'fff.trafficcontrol.limit_in') %>" /></td><td>kbit/s</td></tr>
>> > +		<tr><th>Freifunk&nbsp;Upload:</th><td><input
>> type="text"
>> > +name="limit_egress" value="<%= $(uci -q get
>> > +'fff.trafficcontrol.limit_out') %>" /></td><td>kbit/s</td></tr>
>> >  	</table>
>> >  </fieldset>
>> >  </td></tr>
>> > diff --git a/src/packages/fff/fff/Makefile
>> > b/src/packages/fff/fff/Makefile index 305ab8d..dce33f9 100644
>> > --- a/src/packages/fff/fff/Makefile
>> > +++ b/src/packages/fff/fff/Makefile
>> > @@ -18,6 +18,7 @@ define Package/fff-base
>> >               +ip6tables \
>> >               +odhcp6c \
>> >               +micrond \
>> > +             +fff-config \
>> Ich bin mir grad nicht sicher, ob fff-base wirklich davon abhängen
>sollte.
>> Immerhin wird es ja von fff-base nicht benötigt, aber von den anderen
>> Paketen.. Naja, tut aber auch nicht weh.. Mir egal. ;)
>
>Haben wir was gemeinsam, ich hab mir eine ähnliche Frage gestellt. Aber
>irgendwie sind z.B. die Koordinaten ja essentiell für die Funktion.

Nur, wenn das webui, der nodewatcher und hoods an sind. ;)

Tim

>Grüße
>
>Adrian
>
>> 
>> Tim
>> 
>> >               +fff-nodewatcher \
>> >               +fff-web \
>> >               +fff-uradvd \
>> > --
>> > 2.7.4
>> >