diff options
author | Roman Yeryomin <roman@advem.lv> | 2014-03-11 00:54:50 +0200 |
---|---|---|
committer | Roman Yeryomin <roman@advem.lv> | 2014-03-11 00:54:50 +0200 |
commit | 68861cc62872ac7a2cf40acc70c4a8688660bc8e (patch) | |
tree | f98a1ee4a6024a2cc7769090455a4bbf095969cd /target/linux/realtek/base-files/lib/preinit/06_set_iface_mac | |
parent | d53bc6bfaf30d6180d4b2e18ea54409a4bafeebc (diff) |
Add preinit and uci-defaults scripts infrastructure. Generate network config automagically. Read lan/wan MAC addresses from MIB.
Signed-off-by: Roman Yeryomin <roman@advem.lv>
Diffstat (limited to 'target/linux/realtek/base-files/lib/preinit/06_set_iface_mac')
-rw-r--r-- | target/linux/realtek/base-files/lib/preinit/06_set_iface_mac | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/target/linux/realtek/base-files/lib/preinit/06_set_iface_mac b/target/linux/realtek/base-files/lib/preinit/06_set_iface_mac new file mode 100644 index 000000000..ff27fc952 --- /dev/null +++ b/target/linux/realtek/base-files/lib/preinit/06_set_iface_mac @@ -0,0 +1,35 @@ +# +# Copyright (C) 2014 OpenWrt.org +# + +preinit_set_mac_address() { + local mac + + . /lib/functions.sh + . /lib/realtek.sh + + case $(realtek_board_name) in + generic |\ + nprove |\ + nprove2) + mac=$(rtkmib --get mac0) + ifconfig eth0 hw ether $mac 2>/dev/null + ;; + sl-r7205) + mac=$(mtd_get_mac_binary factory 4) + mac=$(macaddr_setbit_la "$mac") + ifconfig eth0 hw ether $mac 2>/dev/null + ;; + dir-645) + mac=$(mtd_get_mac_ascii nvram lanmac) + mac=$(macaddr_setbit_la "$mac") + ifconfig eth0 hw ether $mac 2>/dev/null + ;; + xdxrn502j) + mac=$(mtd_get_mac_binary factory 40) + ifconfig eth0 hw ether $mac 2>/dev/null + ;; + esac +} + +boot_hook_add preinit_main preinit_set_mac_address |