add preinit modularization work by Daniel Dickinson (cshore)
[openwrt/openwrt.git] / target / linux / gemini / base-files / lib / preinit / 05_set_ether_mac_gemini
1 #!/bin/sh
2
3 set_ether_mac() {
4 CONFIG_PARTITION="$(grep "VCTL" /proc/mtd | cut -d: -f1)"
5 MAC1="$(strings /dev/$CONFIG_PARTITION |grep MAC|cut -d: -f2|cut -c3-14|sed -e 's,\(..\),:\1,g' -e 's,^:,,')"
6 MAC2="$(strings /dev/$CONFIG_PARTITION |grep MAC|cut -d: -f8|cut -c3-14|sed -e 's,\(..\),:\1,g' -e 's,^:,,')"
7
8 ifconfig eth0 hw ether $MAC1 2>/dev/null
9 ifconfig eth1 hw ether $MAC2 2>/dev/null
10 }
11
12 boot_hook_add preinit_main set_ether_mac
13