Re: git: 6833ac673d98 - main - bsdinstall netconfig: Replace dialog(1) with bsddialog(1)
Date: Wed, 13 Jul 2022 23:53:38 UTC
On 2 Apr 2022, at 22:34, Alfonso S. Siciliano <asiciliano@FreeBSD.org> wrote:
>
> The branch main has been updated by asiciliano:
>
> URL: https://cgit.FreeBSD.org/src/commit/?id=6833ac673d98275ef72a8873372714011c73eb15
>
> commit 6833ac673d98275ef72a8873372714011c73eb15
> Author: Alfonso S. Siciliano <asiciliano@FreeBSD.org>
> AuthorDate: 2022-04-02 19:29:37 +0000
> Commit: Alfonso S. Siciliano <asiciliano@FreeBSD.org>
> CommitDate: 2022-04-02 19:33:40 +0000
>
> 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
> ---
> usr.sbin/bsdinstall/scripts/netconfig | 62 +++++++++++++++++------------------
> 1 file changed, 31 insertions(+), 31 deletions(-)
>
> diff --git a/usr.sbin/bsdinstall/scripts/netconfig b/usr.sbin/bsdinstall/scripts/netconfig
> index f9913c324228..11ee646c403d 100755
> --- a/usr.sbin/bsdinstall/scripts/netconfig
> +++ b/usr.sbin/bsdinstall/scripts/netconfig
> @@ -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 \
Not having the --hline "Use TAB and Enter to select OK" for this like
hostname makes it rather confusing as to why pressing Enter on this
screen no longer works.
Jess
> 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' | \