aboutsummaryrefslogtreecommitdiff
path: root/target/linux/mediatek/base-files/etc/uci-defaults/99_fwenv-store-ethaddr.sh
blob: 0afb434c97d7488177efafcb8438dbe2c30c6bda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
[ ! -e /etc/fw_env.config ] && exit 0

. /lib/functions/system.sh

case "$(board_name)" in
bananapi,bpi-r2|\
bananapi,bpi-r64|\
unielec,u7623-02)
	[ -z "$(fw_printenv -n ethaddr 2>/dev/null)" ] &&
		fw_setenv ethaddr "$(cat /sys/class/net/eth0/address)"
	;;
bananapi,bpi-r3|\
bananapi,bpi-r3-mini|\
bananapi,bpi-4)
	[ -z "$(fw_printenv -n ethaddr 2>/dev/null)" ] &&
		fw_setenv ethaddr "$(cat /sys/class/net/eth0/address)"
	[ -z "$(fw_printenv -n eth1addr 2>/dev/null)" ] &&
		fw_setenv eth1addr "$(macaddr_add $(cat /sys/class/net/eth0/address) 1)"
	;;
esac

exit 0