[RFC PATCH] fff-network: Tidy up network files on startup

Adrian Schmutzler freifunk at adrianschmutzler.de
Di Jul 4 20:42:57 CEST 2017


To prevent lots of network configurations crowding the /etc
directory, this renames the correct file to network.config
and deletes all the others. The network.config is never
overwritten, so changes may be made here.

Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>

Tested-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
---
 src/packages/fff/fff-network/files/usr/sbin/configurenetwork | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
index 7ecfa3b..d3c9b49 100755
--- a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
+++ b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
@@ -10,7 +10,17 @@
 # GNU General Public License for more details.
 
 BOARD="$(uci get board.model.name)"
-. /etc/network.$BOARD
+
+if [ ! -s /etc/network.config ] ; then
+    cp /etc/network.$BOARD /etc/network.config && find /etc/network.* -type f -maxdepth 0 ! -name 'network.mode' ! -name 'network.config' -exec rm {} \+
+fi
+
+if [ -s /etc/network.config ] ; then
+    . /etc/network.config
+else
+    . /etc/network.$BOARD # Fallback option if copying did not work
+fi
+
 
 if ! uci get network.$SWITCHDEV.ifname; then
 
-- 
2.7.4



Mehr Informationen über die Mailingliste franken-dev