git: 90943fbfeb1a - main - bsdinstall netconfig_ipv4: Replace dialog with bsddialog

From: Alfonso S. Siciliano <asiciliano_at_FreeBSD.org>
Date: Sat, 21 May 2022 15:41:31 UTC
The branch main has been updated by asiciliano:

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

commit 90943fbfeb1a3cbe2be99acddb5cae45d48e1e52
Author:     Alfonso S. Siciliano <asiciliano@FreeBSD.org>
AuthorDate: 2022-05-21 15:37:12 +0000
Commit:     Alfonso S. Siciliano <asiciliano@FreeBSD.org>
CommitDate: 2022-05-21 15:40:34 +0000

    bsdinstall netconfig_ipv4: Replace dialog with bsddialog
    
    Replace (LGPL) dialog utility with (BSD-2-Clause) bsddialog utility.
    
    Reviewed by:            bapt
    Differential Revision:  https://reviews.freebsd.org/D35267
---
 usr.sbin/bsdinstall/scripts/netconfig_ipv4 | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/usr.sbin/bsdinstall/scripts/netconfig_ipv4 b/usr.sbin/bsdinstall/scripts/netconfig_ipv4
index 44dc8cf21f1d..e0e540188aba 100755
--- a/usr.sbin/bsdinstall/scripts/netconfig_ipv4
+++ b/usr.sbin/bsdinstall/scripts/netconfig_ipv4
@@ -36,28 +36,31 @@ f_include $BSDCFG_SHARE/dialog.subr
 
 ############################################################ MAIN
 
+: ${BSDDIALOG_OK=0}
+: ${BSDDIALOG_CANCEL=1}
+
 INTERFACE=$1
 IFCONFIG_PREFIX="$2"
 test -z "$IFCONFIG_PREFIX" || IFCONFIG_PREFIX="$2 "
 case "${INTERFACE}" in
-"")	dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' \
+"")	bsddialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' \
 	    --msgbox 'No interface specified for IPv4 configuration.' 0 0
 	exit 1
 	;;
 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
+bsddialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' --yesno 'Would you like to use DHCP to configure this interface?' 0 0
+if [ $? -eq $BSDDIALOG_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
+		bsddialog --backtitle 'FreeBSD Installer' --infobox "Acquiring DHCP lease..." 0 0
 		err=$( pkill -F /var/run/dhclient/dhclient.${INTERFACE}.pid; dhclient $INTERFACE 2>&1 )
 		if [ $? -ne 0 ]; then
 			f_dprintf "%s" "$err"
-			dialog --backtitle 'FreeBSD Installer' --msgbox "DHCP lease acquisition failed." 0 0
+			bsddialog --backtitle 'FreeBSD Installer' --msgbox "DHCP lease acquisition failed." 0 0
 			exec $0 ${INTERFACE} "${IFCONFIG_PREFIX}"
 		fi
 	fi
@@ -70,12 +73,12 @@ NETMASK=`ifconfig $INTERFACE inet | awk '/inet/ {printf("%s\n", $4); }'`
 ROUTER=`netstat -rn -f inet | awk '/default/ {printf("%s\n", $2);}'`
 
 exec 3>&1
-IF_CONFIG=$(dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' --form 'Static Network Interface Configuration' 0 0 0 \
-	'IP Address' 1 0 "$IP_ADDRESS" 1 20 16 0 \
-	'Subnet Mask' 2 0 "$NETMASK" 2 20 16 0 \
-	'Default Router' 3 0 "$ROUTER" 3 20 16 0 \
+IF_CONFIG=$(bsddialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' --form 'Static Network Interface Configuration' 0 0 0 \
+	'IP Address' 1 1 "$IP_ADDRESS" 1 20 16 0 \
+	'Subnet Mask' 2 1 "$NETMASK" 2 20 16 0 \
+	'Default Router' 3 1 "$ROUTER" 3 20 16 0 \
 2>&1 1>&3)
-if [ $? -eq $DIALOG_CANCEL ]; then exit 1; fi
+if [ $? -eq $BSDDIALOG_CANCEL ]; then exit 1; fi
 exec 3>&-
 
 echo $INTERFACE $IF_CONFIG |