git: b809c7d6a269 - main - bsdinstall: Fix netconfig script when no interfaces are present

From: Jessica Clarke <jrtc27_at_FreeBSD.org>
Date: Sat, 03 Feb 2024 02:00:33 UTC
The branch main has been updated by jrtc27:

URL: https://cgit.FreeBSD.org/src/commit/?id=b809c7d6a26924ac351e49a15011da718cc3feec

commit b809c7d6a26924ac351e49a15011da718cc3feec
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2024-02-03 01:52:37 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2024-02-03 01:52:37 +0000

    bsdinstall: Fix netconfig script when no interfaces are present
    
    The script uses [ -z "$INTERFACES" ] to check if the list of interfaces
    is empty and will exit early if so, but INTERFACES always contains at
    least a space due to the way it appends the list of wireless devices.
    Fix this by only adding the space when there are devices to append,
    mirroring the behaviour for non-wireless devices above (both will result
    in a redundant leading space when the list is non-empty, but that one is
    harmless).
    
    Fixes:          159ca5c844cd ("Adapt to new wireless scheme where base wlan interfaces do not show up in ifconfig anymore.")
    MFC after:      1 week
---
 usr.sbin/bsdinstall/scripts/netconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/usr.sbin/bsdinstall/scripts/netconfig b/usr.sbin/bsdinstall/scripts/netconfig
index addf5cb527d6..a370d455e211 100755
--- a/usr.sbin/bsdinstall/scripts/netconfig
+++ b/usr.sbin/bsdinstall/scripts/netconfig
@@ -49,7 +49,8 @@ for IF in `ifconfig -l`; do
 	INTERFACES="$INTERFACES $IF"
 done
 
-INTERFACES="$INTERFACES $(sysctl -in net.wlan.devices)"
+WIRELESS_INTERFACES="$(sysctl -in net.wlan.devices)"
+INTERFACES="$INTERFACES${WIRELESS_INTERFACES:+ }$WIRELESS_INTERFACES"
 is_wireless_if() {
 	for IF in $(sysctl -in net.wlan.devices); do
 		if [ $IF = $1 ]; then