2 # Copyright (C) 2018 OpenWrt.org
4 RECOVERY_PART
=/dev
/mmcblk0p1
6 preinit_set_mac_address
() {
10 .
/lib
/functions
/system.sh
14 if [ -b $RECOVERY_PART ]; then
19 mkdir
-p /tmp
/recovery
20 mount
-o rw
,noatime
$RECOVERY_PART /tmp
/recovery
22 if [ -f "/tmp/recovery/mac_addr" ];
24 mac
=$
(cat /tmp
/recovery
/mac_addr
)
26 mac
=$
(cat /sys
/class
/net
/eth
0/address
)
27 echo "$mac" > /tmp
/recovery
/mac_addr
35 ip link
set dev wan address
$mac 2> /dev
/null
37 mac
=$
(macaddr_add
$mac 1)
39 ip link
set dev lan0 address
$mac 2>/dev
/null
40 ip link
set dev lan1 address
$mac 2>/dev
/null
41 ip link
set dev lan2 address
$mac 2>/dev
/null
42 ip link
set dev lan3 address
$mac 2>/dev
/null
47 boot_hook_add preinit_main preinit_set_mac_address