git: 1ad9134e1112 - main - bsdinstall netconfig_ipv4: Fix resolv.conf rebuild

From: Alfonso S. Siciliano <asiciliano_at_FreeBSD.org>
Date: Sat, 30 Apr 2022 15:35:32 UTC
The branch main has been updated by asiciliano:

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

commit 1ad9134e1112cec3bc29c9ae36b5e02526edb388
Author:     Alfonso S. Siciliano <asiciliano@FreeBSD.org>
AuthorDate: 2022-04-30 15:25:57 +0000
Commit:     Alfonso S. Siciliano <asiciliano@FreeBSD.org>
CommitDate: 2022-04-30 15:34:53 +0000

    bsdinstall netconfig_ipv4: Fix resolv.conf rebuild
    
    After an installation restart (for error or choice) dhclient does not
    rebuild resolv.conf so `dialog --mixedform' of "Resolver Configuration"
    in bsdinstall/scripts/netconfig draws empty forms. It causes a bad UX,
    to see PR262262. Fixed resetting the interface before to run dhclient.
    
    PR:                     262262
    Reviewed by:            bapt
    Differential Revision:  https://reviews.freebsd.org/D35094
---
 usr.sbin/bsdinstall/scripts/netconfig_ipv4 | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/usr.sbin/bsdinstall/scripts/netconfig_ipv4 b/usr.sbin/bsdinstall/scripts/netconfig_ipv4
index 2acd9029d150..44dc8cf21f1d 100755
--- a/usr.sbin/bsdinstall/scripts/netconfig_ipv4
+++ b/usr.sbin/bsdinstall/scripts/netconfig_ipv4
@@ -49,6 +49,9 @@ esac
 dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' --yesno 'Would you like to use DHCP to configure this interface?' 0 0
 if [ $? -eq $DIALOG_OK ]; then
 	if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then
+		# XXX: get interface down otherwise after installation restart
+		# dhclient does not build a new resolv.conf (see PR262262).
+		ifconfig $INTERFACE down
 		ifconfig $INTERFACE up
 		dialog --backtitle 'FreeBSD Installer' --infobox "Acquiring DHCP lease..." 0 0
 		err=$( pkill -F /var/run/dhclient/dhclient.${INTERFACE}.pid; dhclient $INTERFACE 2>&1 )