It is always a bad idea to mix up different languages
in one environment. Another point is, to bury awk in
base-files. There is no reason for it, these are only
quick hacks from the old days of whiterussian 8-).

IMHO this a lot better and not that ugly, like with
awk. The function_name() says what it does. If
the function disturbs, than we should move it to an
include, but this has nothing to do with this patch.
(maybe a function manual_coldplugging_on_boot() )

Signed-off-by: Bastian Bittorf <bitt...@bluebottle.com>

>From 848263afbe42087b2c51387688816be5590f090b Mon Sep 17 00:00:00 2001
From: Bastian Bittorf <bitt...@bluebottle.com>
Date: Sun, 16 Jan 2011 11:39:09 +0100
Subject: [PATCH] refactoring manual_coldplugging_of_interfaces_during_boot / without awk / 2nd try (coding style)

---
 package/base-files/files/etc/init.d/boot |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/package/base-files/files/etc/init.d/boot b/package/base-files/files/etc/init.d/boot
index 7927af1..308d91a 100755
--- a/package/base-files/files/etc/init.d/boot
+++ b/package/base-files/files/etc/init.d/boot
@@ -68,8 +68,19 @@ start() {
 			--set-rules-file /etc/hotplug2.rules \
 			--max-children 1 >/dev/null 2>&1 &
 
+	list_network_interfaces()
+	{
+		local line
+
+		while read line; do {
+			case "$line" in
+				*:*) echo ${line%:*} ;;
+			esac
+		} done </proc/net/dev		
+	}
+
 	# the coldplugging of network interfaces needs to happen later, so we do it manually here
-	for iface in $(awk -F: '/:/ {print $1}' /proc/net/dev); do
+	for iface in $( list_network_interfaces ); do
 		/usr/bin/env -i ACTION=add INTERFACE="$iface" /sbin/hotplug-call net
 	done
-- 
1.6.3.3

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to