ce5c1fc4bf1777a21e674d6b02fa519e50a2f7fd
[openwrt/staging/dedeckeh.git] / target / linux / ipq40xx / base-files / lib / preinit / 05_set_iface_mac_ipq40xx.sh
1 #!/bin/sh
2
3 . /lib/functions.sh
4
5 preinit_set_mac_address() {
6 case $(board_name) in
7 asus,map-ac2200)
8 base_mac=$(mtd_get_mac_binary_ubi Factory 4102)
9 ip link set dev eth0 address $(macaddr_add "$base_mac" +1)
10 ip link set dev eth1 address $(macaddr_add "$base_mac" +3)
11 ;;
12 meraki,mr33)
13 mac_lan=$(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 102)
14 [ -n "$mac_lan" ] && ip link set dev eth0 address "$mac_lan"
15 ;;
16 zyxel,nbg6617)
17 base_mac=$(cat /sys/class/net/eth0/address)
18 ip link set dev eth0 address $(macaddr_add "$base_mac" +2)
19 ip link set dev eth1 address $(macaddr_add "$base_mac" +3)
20 esac
21 }
22
23 boot_hook_add preinit_main preinit_set_mac_address