bsdinstall netconfig: Replace dialog(1) with bsddialog(1)

Replace (LGPL) dialog(1) with (BSD-2-Clause) bsddialog(1).

Approved by:		bapt (mentor)
Differential Revision:	https://reviews.freebsd.org/D34682
This commit is contained in:
Alfonso S. Siciliano 2022-04-02 21:29:37 +02:00
parent 52106f072f
commit 6833ac673d
No known key found for this signature in database
GPG Key ID: 3F9EEFACFD371E37

View File

@ -32,14 +32,14 @@
# $FreeBSD$
INTERFACES=""
DIALOG_TAGS=""
BSDDIALOG_ITEMS=""
: ${DIALOG_OK=0}
: ${DIALOG_CANCEL=1}
: ${DIALOG_HELP=2}
: ${DIALOG_EXTRA=3}
: ${DIALOG_ITEM_HELP=4}
: ${DIALOG_ESC=255}
: ${BSDDIALOG_OK=0}
: ${BSDDIALOG_CANCEL=1}
: ${BSDDIALOG_HELP=2}
: ${BSDDIALOG_EXTRA=3}
: ${BSDDIALOG_ESC=5}
: ${BSDDIALOG_ERROR=255}
for IF in `ifconfig -l`; do
test "$IF" = "lo0" && continue
@ -59,19 +59,19 @@ is_wireless_if() {
for IF in $INTERFACES; do
DESC=`sysctl -n dev.$(echo $IF | sed -E 's/([[:alpha:]]*)([[:digit:]]*)/\1.\2/g').%desc`
DIALOG_TAGS="$DIALOG_TAGS $IF \"$DESC\""
BSDDIALOG_ITEMS="$BSDDIALOG_ITEMS $IF \"$DESC\""
done
if [ -z "$INTERFACES" ]; then
dialog --backtitle 'FreeBSD Installer' \
bsddialog --backtitle 'FreeBSD Installer' \
--title 'Network Configuration Error' \
--msgbox 'No network interfaces present to configure.' 0 0
exit 1
fi
exec 3>&1
INTERFACE=`echo $DIALOG_TAGS | xargs dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' --menu 'Please select a network interface to configure:' 0 0 0 2>&1 1>&3`
if [ $? -eq $DIALOG_CANCEL ]; then exit 1; fi
INTERFACE=`echo $BSDDIALOG_ITEMS | xargs -o bsddialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' --menu 'Please select a network interface to configure:' 0 0 0 2>&1 1>&3`
if [ $? -eq $BSDDIALOG_CANCEL ]; then exit 1; fi
exec 3>&-
: > $BSDINSTALL_TMPETC/._rc.conf.net
@ -101,9 +101,9 @@ case $? in
esac
if [ ${IPV4_AVAIL} -eq 1 ]; then
dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' \
bsddialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' \
--yesno 'Would you like to configure IPv4 for this interface?' 0 0
if [ $? -eq $DIALOG_OK ]; then
if [ $? -eq $BSDDIALOG_OK ]; then
bsdinstall netconfig_ipv4 ${INTERFACE} "${IFCONFIG_PREFIX}" || \
exec $0
else
@ -116,9 +116,9 @@ if [ ${IPV4_AVAIL} -eq 0 -a -n ${IFCONFIG_PREFIX} ]; then
echo ifconfig_${INTERFACE}=\"${IFCONFIG_PREFIX}\" >> $BSDINSTALL_TMPETC/._rc.conf.net
fi
if [ ${IPV6_AVAIL} -eq 1 ]; then
dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' \
bsddialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' \
--yesno 'Would you like to configure IPv6 for this interface?' 0 0
if [ $? -eq $DIALOG_OK ]; then
if [ $? -eq $BSDDIALOG_OK ]; then
bsdinstall netconfig_ipv6 ${INTERFACE} || exec $0
else
IPV6_AVAIL=0
@ -158,34 +158,34 @@ done < ${BSDINSTALL_TMPETC}/resolv.conf
RESOLV=""
if [ ${IPV6_AVAIL} -eq 1 -a ${IPV4_AVAIL} -eq 1 ]; then
RESOLV="
'Search' 1 0 \"${SEARCH}\" 1 16 50 0 0
'Nameserver' 2 0 \"Nameserver\" 2 16 50 0 2
'IPv6 DNS #1' 2 0 \"${IP6_1}\" 2 16 50 0 0
'IPv6 DNS #2' 3 0 \"${IP6_2}\" 3 16 50 0 0
'IPv4 DNS #1' 4 0 \"${IP4_1}\" 4 16 16 0 0
'IPv4 DNS #2' 5 0 \"${IP4_2}\" 5 16 16 0 0"
'Search' 1 1 \"${SEARCH}\" 1 16 50 50 0
'Nameserver' 2 1 \"Nameserver\" 2 1 11 11 2
'IPv6 DNS #1' 2 1 \"${IP6_1}\" 2 16 50 50 0
'IPv6 DNS #2' 3 1 \"${IP6_2}\" 3 16 50 50 0
'IPv4 DNS #1' 4 1 \"${IP4_1}\" 4 16 16 16 0
'IPv4 DNS #2' 5 1 \"${IP4_2}\" 5 16 16 16 0"
elif [ ${IPV6_AVAIL} -eq 1 ]; then
RESOLV="
'Search' 1 0 \"${SEARCH}\" 1 16 50 0 0
'Nameserver' 2 0 \"Nameserver\" 2 16 50 0 2
'IPv6 DNS #1' 2 0 \"${IP6_1}\" 2 16 50 0 0
'IPv6 DNS #2' 3 0 \"${IP6_2}\" 3 16 50 0 0"
'Search' 1 1 \"${SEARCH}\" 1 16 50 50 0
'Nameserver' 2 1 \"Nameserver\" 2 1 11 11 2
'IPv6 DNS #1' 2 1 \"${IP6_1}\" 2 16 50 50 0
'IPv6 DNS #2' 3 1 \"${IP6_2}\" 3 16 50 50 0"
elif [ ${IPV4_AVAIL} -eq 1 ]; then
RESOLV="
'Search' 1 0 \"${SEARCH}\" 1 16 50 0 0
'Nameserver' 2 0 \"Nameserver\" 2 16 50 0 2
'IPv4 DNS #1' 2 0 \"${IP4_1}\" 2 16 16 0 0
'IPv4 DNS #2' 3 0 \"${IP4_2}\" 3 16 16 0 0"
'Search' 1 1 \"${SEARCH}\" 1 16 50 50 0
'Nameserver' 2 1 \"Nameserver\" 2 1 11 11 2
'IPv4 DNS #1' 2 1 \"${IP4_1}\" 2 16 16 16 0
'IPv4 DNS #2' 3 1 \"${IP4_2}\" 3 16 16 16 0"
else
exit 0
fi
exec 3>&1
RESOLV=$(echo "${RESOLV}" | xargs dialog --backtitle 'FreeBSD Installer' \
RESOLV=$(echo "${RESOLV}" | xargs -o bsddialog --backtitle 'FreeBSD Installer' \
--title 'Network Configuration' \
--mixedform 'Resolver Configuration' 0 0 0 \
2>&1 1>&3)
if [ $? -eq $DIALOG_CANCEL ]; then exec $0; fi
if [ $? -eq $BSDDIALOG_CANCEL ]; then exec $0; fi
exec 3>&-
echo ${RESOLV} | tr ' ' '\n' | \