The function get_mac_ascii() will fail when there are two or more
same MAC address variable names in the mtd partition. Only retain
the first variable to workaround this rare situation.
Fixes: https://github.com/openwrt/openwrt/issues/17236
Signed-off-by: Shiji Yang <yangshiji66@qq.com>
Link: https://github.com/openwrt/openwrt/pull/17262
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
local key="$2"
local mac_dirty
- mac_dirty=$(strings "$part" | sed -n 's/^'"$key"'=//p')
+ mac_dirty=$(strings "$part" | sed -n 's/^'"$key"'=//p' | head -n 1)
# "canonicalize" mac
[ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty"