[PATCH] fff-network: Make custom port configuration update-safe

Adrian Schmutzler freifunk at adrianschmutzler.de
Sa Jul 22 19:03:59 CEST 2017


This writes CLIENT/BATMAN/WAN port configurations for devices
with switches to a separate file. This file can be changed
based on the desired setup and is then preserved during
firmware upgrade. In case of a future bugfix concerning the
entries of a specific network.* file, this will still be
effective as only the port configurations reside in the
new file, while the other settings could be overriden by the
upgrade.

Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
---
 src/packages/fff/fff-network/Makefile                         |  2 +-
 src/packages/fff/fff-network/files/usr/sbin/configurenetwork  | 11 +++++++++++
 .../fff-sysupgrade/files/etc/uci-defaults/99-fff-sysupgrade   |  1 +
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/packages/fff/fff-network/Makefile b/src/packages/fff/fff-network/Makefile
index f7dc63c..23a1345 100644
--- a/src/packages/fff/fff-network/Makefile
+++ b/src/packages/fff/fff-network/Makefile
@@ -1,7 +1,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=fff-network
-PKG_VERSION:=7
+PKG_VERSION:=8
 PKG_RELEASE:=1
 
 PKG_BUILD_DIR:=$(BUILD_DIR)/fff-network
diff --git a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
index 249227e..94ffa95 100755
--- a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
+++ b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
@@ -12,6 +12,17 @@
 BOARD="$(uci get board.model.name)"
 . /etc/network.$BOARD
 
+if [ -s /etc/network.config ] ; then
+    . /etc/network.config
+else
+    echo "CLIENT_PORTS='$CLIENT_PORTS'" > /etc/network.config
+    echo "BATMAN_PORTS='$BATMAN_PORTS'" >> /etc/network.config
+    if [ -n "$WAN_PORTS" ] ; then
+        echo "WAN_PORTS='$WAN_PORTS'" >> /etc/network.config
+    fi
+    echo "FORCEPARSE='0'" >> /etc/network.config
+fi
+
 if ! uci -q get network.$SWITCHDEV > /dev/null || [ "$FORCEPARSE" = '1' ] ; then
 
     SWITCHHW=$(swconfig list | awk '{ print $4 }')
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 4c5061a..1e56df8 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,6 @@ cat > /etc/sysupgrade.conf <<-__EOF__
 /etc/dropbear/dropbear_rsa_host_key
 /etc/dropbear/authorized_keys
 /etc/network.mode
+/etc/network.config
 /etc/config/fff
 __EOF__
-- 
2.7.4



Mehr Informationen über die Mailingliste franken-dev