mediatek: bpi-r4: store random MAC addresses for the BPi-R4
[openwrt/staging/nbd.git] / target / linux / mediatek / base-files / etc / uci-defaults / 99_fwenv-store-ethaddr.sh
1 [ ! -e /etc/fw_env.config ] && exit 0
2
3 . /lib/functions/system.sh
4
5 case "$(board_name)" in
6 bananapi,bpi-r2|\
7 bananapi,bpi-r64|\
8 unielec,u7623-02)
9 [ -z "$(fw_printenv -n ethaddr 2>/dev/null)" ] &&
10 fw_setenv ethaddr "$(cat /sys/class/net/eth0/address)"
11 ;;
12 bananapi,bpi-r3|\
13 bananapi,bpi-r3-mini|\
14 bananapi,bpi-4)
15 [ -z "$(fw_printenv -n ethaddr 2>/dev/null)" ] &&
16 fw_setenv ethaddr "$(cat /sys/class/net/eth0/address)"
17 [ -z "$(fw_printenv -n eth1addr 2>/dev/null)" ] &&
18 fw_setenv eth1addr "$(macaddr_add $(cat /sys/class/net/eth0/address) 1)"
19 ;;
20 esac
21
22 exit 0