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
This commit is contained in:
parent
4effc38819
commit
90943fbfeb
@ -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 |
|
||||
|
Loading…
Reference in New Issue
Block a user