fix: replace ifconfig in armbian-firstrun-config
ifconfig is no longer included in a default install of Armbian Bookworm, causing armbian-firstrun-config to silently fail when attempting to retrieve a list of network adapters. Using nmcli instead.
This commit is contained in:
parent
e13a128f78
commit
9ed7437fe2
@ -69,35 +69,9 @@ do_firstrun_automated_user_configuration()
|
||||
#-----------------------------------------------------------------------------
|
||||
# Set Network
|
||||
if [[ $FR_net_change_defaults == 1 ]]; then
|
||||
# - Get 1st index of available wlan and eth adapters
|
||||
local fp_ifconfig_tmp='/tmp/.ifconfig'
|
||||
ifconfig -a | sed 's/[ \t].*//;/^\(lo\|\|bond0\|sit0\|ip6tnl0\)$/d' > "$fp_ifconfig_tmp" #export to file, should be quicker in loop than calling ifconfig each time.
|
||||
|
||||
# find eth[0-9]
|
||||
for ((i=0; i<=9; i++))
|
||||
do
|
||||
if (( $(grep -ci -m1 "eth$i" "$fp_ifconfig_tmp") )); then
|
||||
eth_index=eth${i}
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Predictable Network Interface Names
|
||||
[[ -z $eth_index ]] && eth_index=$(grep -m1 "en" "$fp_ifconfig_tmp" | cut -f1 -d":" | head -1)
|
||||
|
||||
# find wlan[0-9]
|
||||
for ((i=0; i<=9; i++))
|
||||
do
|
||||
if (( $(grep -ci -m1 "wlan$i" "$fp_ifconfig_tmp") )); then
|
||||
wlan_index=wlan${i}
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Predictable Network Interface Names
|
||||
[[ -z $wlan_index ]] && wlan_index=$(grep -m1 "wl" "$fp_ifconfig_tmp" | cut -f1 -d":" | head -1)
|
||||
|
||||
rm "$fp_ifconfig_tmp"
|
||||
# - Get name of 1st available ethernet and wifi adapter
|
||||
eth_index="$(nmcli d | grep ethernet | cut -d ' ' -f 1 | head -n 1)"
|
||||
wlan_index="$(nmcli d | grep wifi | cut -d ' ' -f 1 | head -n 1)"
|
||||
|
||||
# for static IP we only append settings
|
||||
if [[ $FR_net_use_static == 1 ]]; then
|
||||
|
||||
Loading…
Reference in New Issue
Block a user