OpenWrt – Blame information for rev 2
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | #!/bin/sh |
2 | # Copyright (C) 2018 OpenWrt.org |
||
3 | |||
4 | RECOVERY_PART=/dev/mmcblk0p1 |
||
5 | |||
6 | preinit_set_mac_address() { |
||
7 | local mac |
||
8 | |||
9 | . /lib/functions.sh |
||
10 | . /lib/functions/system.sh |
||
11 | |||
12 | case $(board_name) in |
||
13 | "unielec,u7623"*) |
||
14 | if [ -b $RECOVERY_PART ]; then |
||
15 | insmod nls_cp437 |
||
16 | insmod nls_iso8859-1 |
||
17 | insmod fat |
||
18 | insmod vfat |
||
19 | mkdir -p /tmp/recovery |
||
20 | mount -o rw,noatime $RECOVERY_PART /tmp/recovery |
||
21 | |||
22 | if [ -f "/tmp/recovery/mac_addr" ]; |
||
23 | then |
||
24 | mac=$(cat /tmp/recovery/mac_addr) |
||
25 | else |
||
26 | mac=$(cat /sys/class/net/eth0/address) |
||
27 | echo "$mac" > /tmp/recovery/mac_addr |
||
28 | fi |
||
29 | |||
30 | sync |
||
31 | umount /tmp/recovery |
||
32 | rm -rf /tmp/recovery |
||
33 | fi |
||
34 | |||
35 | ip link set dev wan address $mac 2> /dev/null |
||
36 | |||
37 | mac=$(macaddr_add $mac 1) |
||
38 | |||
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 |
||
43 | ;; |
||
44 | esac |
||
45 | } |
||
46 | |||
47 | boot_hook_add preinit_main preinit_set_mac_address |