From d386ccdcf8e168c608bd0d43e77ece3b726c93b8 Mon Sep 17 00:00:00 2001
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Fri, 10 Jul 2015 20:22:27 +0200
Subject: [PATCH] Always use eth0 address as primary address on x86 and
 brcm2708

These targets don't have a WLAN adapter by default, so it doesn't make
sense to default to the phy0 address.
---
 .../files/lib/gluon/upgrade/010-primary-mac       | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/package/gluon-core/files/lib/gluon/upgrade/010-primary-mac b/package/gluon-core/files/lib/gluon/upgrade/010-primary-mac
index d7c6e968c..25c13bac8 100755
--- a/package/gluon-core/files/lib/gluon/upgrade/010-primary-mac
+++ b/package/gluon-core/files/lib/gluon/upgrade/010-primary-mac
@@ -15,19 +15,18 @@ local util = require 'luci.util'
 
 
 local try_files = {
-  '/sys/class/ieee80211/phy0/macaddress',
-  '/sys/class/net/eth0/address',
+  '/sys/class/net/eth0/address'
 }
 
-if platform.match('ar71xx', 'generic', {'tl-wdr3600', 'tl-wdr4300'}) then
-  table.insert(try_files, 1, '/sys/class/ieee80211/phy1/macaddress')
+if not util.contains({'x86', 'brcm2708'}, platform.get_target()) then
+  table.insert(try_files, 1, '/sys/class/ieee80211/phy0/macaddress')
 end
 
-if platform.match('ar71xx', 'generic', {'unifi-outdoor-plus'}) then
+if platform.match('ar71xx', 'generic', {'tl-wdr3600', 'tl-wdr4300'}) then
+  table.insert(try_files, 1, '/sys/class/ieee80211/phy1/macaddress')
+elseif platform.match('ar71xx', 'generic', {'unifi-outdoor-plus'}) then
   table.insert(try_files, 1, '/sys/class/net/eth0/address')
-end
-
-if platform.match('ar71xx', 'generic', {'archer-c5', 'archer-c7'}) then
+elseif platform.match('ar71xx', 'generic', {'archer-c5', 'archer-c7'}) then
   table.insert(try_files, 1, '/sys/class/net/eth1/address')
 end
 
-- 
GitLab