Commit f0032879 authored by fuyanbin's avatar fuyanbin
Browse files

没有固定mac地址的设备支持持久化设备的mac地址

parent 46e61e7c
#!/system/bin/sh
if [[ -f /system/.no_macaddres_in_eeprom ]]
if [ "$(cat /sys/class/net/eth0/addr_assign_type)" != "0" ]
then
macaddress=$(cat /data/.macaddress)
if [[ -z $macaddress ]]
if [ -z "$macaddress" ]
then
MAC_ADDRESS_OUIID="2c:f0:5d"
macaddress=$(hexdump -n3 -e"/3 \"$MAC_ADDRESS_OUIID\" 3/1 \":%02x\"" /dev/random)
echo $macaddress > /data/.macaddress
fi
macaddress="$(ip link show eth0 |grep "link/ether" | head -n 1 | awk '{print $2}')"
echo "$macaddress" > /data/.macaddress
else
ip link set eth0 down
ip link set dev eth0 addr $macaddress
ip link set dev eth0 addr "$macaddress"
ip link set eth0 up
restart netd
fi
fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment