target/x86: set eth0 as dhcp client if single network interface

This commit is contained in:
Liangbin Lian 2024-01-02 14:55:01 +08:00
parent 8ec571c675
commit eb4edb9882
2 changed files with 5 additions and 2 deletions

View File

@ -10,8 +10,10 @@ board_config_update
json_is_a network object && exit 0
ETHNUM=$(ls /sys/class/net/ | grep eth | wc -l)
[ $ETHNUM == 0 ] && exit 0
if [ $ETHNUM == 1 ]; then
ucidef_set_interface_lan 'eth0'
ucidef_set_interface_lan 'eth0' 'dhcp'
else
[ -d /sys/class/net/eth0 ] && ucidef_set_interface_wan 'eth0'
interface=""

View File

@ -10,7 +10,8 @@ board_config_update
case "$(board_name)" in
innotek-gmbh-virtualbox)
ucidef_set_interface "lan" ipaddr "192.168.56.2"
ETHNUM=$(ls /sys/class/net/ | grep eth | wc -l)
[ $ETHNUM -gt 1 ] && ucidef_set_interface "lan" ipaddr "192.168.56.2"
;;
esac