. /lib/functions/system.sh . /lib/functions/uci-defaults.sh ath79_setup_interfaces() { local board="$1" case "$board" in mikrotik,routerboard-493g) ucidef_set_interfaces_lan_wan "eth0.1 eth1.1" "eth0.2" ucidef_add_switch "switch0" \ "0@eth0" "1:lan:4" "2:lan:1" "3:lan:3" "4:lan:2" "5:wan" ucidef_add_switch "switch1" \ "0@eth1" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3" ;; mikrotik,routerboard-911-lite|\ mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-lhg-2nd|\ mikrotik,routerboard-lhg-5nd|\ mikrotik,routerboard-mapl-2nd|\ mikrotik,routerboard-sxt-5nd-r2|\ mikrotik,routerboard-wap-2nd|\ mikrotik,routerboard-wap-g-5hact2hnd|\ mikrotik,routerboard-wapr-2nd) ucidef_set_interface_lan "eth0" ;; mikrotik,routerboard-951ui-2hnd|\ mikrotik,routerboard-951ui-2nd|\ mikrotik,routerboard-952ui-5ac2nd) ucidef_set_interface_wan "eth1" ucidef_add_switch "switch0" \ "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" ;; mikrotik,routerboard-map-2nd) ucidef_set_interface_lan "eth0 eth1" ;; mikrotik,routerboard-951g-2hnd|\ mikrotik,routerboard-962uigs-5hact2hnt) ucidef_add_switch "switch0" \ "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" ;; *) ucidef_set_interfaces_lan_wan "eth0" "eth1" ;; esac } ath79_setup_macs() { local board="$1" local lan_mac="" local wan_mac="" local label_mac="" local mac_base="$(cat /sys/firmware/mikrotik/hard_config/mac_base)" case "$board" in mikrotik,routerboard-911-lite|\ mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-lhg-2nd|\ mikrotik,routerboard-lhg-5nd|\ mikrotik,routerboard-map-2nd|\ mikrotik,routerboard-mapl-2nd|\ mikrotik,routerboard-sxt-5nd-r2|\ mikrotik,routerboard-wap-2nd|\ mikrotik,routerboard-wap-g-5hact2hnd|\ mikrotik,routerboard-wapr-2nd) label_mac="$mac_base" lan_mac="$mac_base" ;; mikrotik,routerboard-921gs-5hpacd-15s|\ mikrotik,routerboard-922uags-5hpacd) label_mac="$mac_base" lan_mac="$mac_base" wan_mac=$(macaddr_add $mac_base 1) ;; *) label_mac="$mac_base" wan_mac="$mac_base" lan_mac=$(macaddr_add $mac_base 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) ath79_setup_interfaces $board ath79_setup_macs $board board_config_flush exit 0