Page MenuHomeFreeBSD

bsdinstall netconfig_ipv4: replace dialog(1) with bsddialog(1)
ClosedPublic

Authored by asiciliano on May 20 2022, 1:35 AM.

Details

Summary

Replace dialog(1) with bsddialog(1).

Test Plan

The new use case is only "--form ". Testing:

#!/bin/sh

: ${BSDDIALOG_OK=0}
: ${BSDDIALOG_CANCEL=1}

# My interface
INTERFACE=wlan99

IP_ADDRESS=`ifconfig $INTERFACE inet | awk '/inet/ {printf("%s\n", $2); }'`
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=$(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 $BSDDIALOG_CANCEL ]; then exit 1; fi
exec 3>&-

echo $INTERFACE $IF_CONFIG

% ./test_netconfig_iv4

           ┌───────┤Network Configuration├───────┐
           │ Static Network Interface            │  
           │ Configuration                       │  
           │┌───────────────────────────────────┐│  
           ││IP Address         192.168.1.3     ││  
           ││Subnet Mask        0xffffff00      ││  
           ││Default Router     192.168.1.1     ││  
           │└───────────────────────────────────┘│  
           ├─────────────────────────────────────┤  
           │         [  OK  ]   [Cancel]         │  
           └─────────────────────────────────────┘  
                                                    



wlan99 192.168.1.3 0xffffff00 192.168.1.1

Diff Detail

Repository
rG FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.