From patchwork Tue Jul 4 18:42:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [RFC] fff-network: Tidy up network files on startup From: Adrian Schmutzler X-Patchwork-Id: 370 Message-Id: <1499193777-30971-1-git-send-email-freifunk@adrianschmutzler.de> To: franken-dev@freifunk.net Cc: Adrian Schmutzler Date: Tue, 4 Jul 2017 20:42:57 +0200 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 Tested-by: Adrian Schmutzler --- 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