You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
810 B
Bash
46 lines
810 B
Bash
#!/bin/sh
|
|
|
|
. /lib/functions/uci-defaults.sh
|
|
. /lib/functions/system.sh
|
|
|
|
rockchip_setup_interfaces()
|
|
{
|
|
local board="$1"
|
|
|
|
case "$board" in
|
|
friendlyarm,nanopi-r2s)
|
|
ucidef_set_interfaces_lan_wan 'eth1' 'eth0'
|
|
;;
|
|
*)
|
|
ucidef_set_interface_lan 'eth0'
|
|
;;
|
|
esac
|
|
}
|
|
|
|
rockchip_setup_macs()
|
|
{
|
|
local board="$1"
|
|
local lan_mac=""
|
|
local wan_mac=""
|
|
local label_mac=""
|
|
|
|
case "$board" in
|
|
friendlyarm,nanopi-r2s)
|
|
wan_mac=$(macaddr_random)
|
|
lan_mac=$(macaddr_add "$wan_mac" +1)
|
|
;;
|
|
esac
|
|
|
|
[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
|
|
[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
|
|
[ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
|
|
}
|
|
|
|
board_config_update
|
|
board=$(board_name)
|
|
rockchip_setup_interfaces $board
|
|
rockchip_setup_macs $board
|
|
board_config_flush
|
|
|
|
exit 0
|