No subject


Thu Jun 25 05:52:11 EDT 2020


preferable to switch to the new syntax entirely:
- It will only change for new installations/sysupgrade -n anyway
- It is more logical to extend when the user adds a member to lan
  manually later
- No duplicate setup code
- Uniform names for device nodes

Please share your views on this aspect.
---
 package/base-files/files/bin/config_generate | 27 +++++++++++++++-----
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/package/base-files/files/bin/config_generate b/package/base-files/files/bin/config_generate
index 3ca035ca8b..874ce289cf 100755
--- a/package/base-files/files/bin/config_generate
+++ b/package/base-files/files/bin/config_generate
@@ -85,12 +85,27 @@ generate_network() {
 		set network.$1.proto='none'
 	EOF
 
-	[ -n "$macaddr" ] && uci -q batch <<-EOF
-		delete network.$1_dev
-		set network.$1_dev='device'
-		set network.$1_dev.name='$ifname'
-		set network.$1_dev.macaddr='$macaddr'
-	EOF
+	[ -n "$macaddr" ] && case "$ifname" in
+	*\ *)
+		uci -q delete network.$1_dev
+		for name in $ifname; do
+			uci -q batch <<-EOF
+				delete network.${name/./_}_dev
+				set network.${name/./_}_dev='device'
+				set network.${name/./_}_dev.name='$name'
+				set network.${name/./_}_dev.macaddr='$macaddr'
+			EOF
+		done
+		;;
+	*)
+		uci -q batch <<-EOF
+			delete network.$1_dev
+			set network.$1_dev='device'
+			set network.$1_dev.name='$ifname'
+			set network.$1_dev.macaddr='$macaddr'
+		EOF
+		;;
+	esac
 
 	case "$protocol" in
 		static)
-- 
2.20.1


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



More information about the openwrt-devel mailing list