summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bsdconfig/networking
diff options
context:
space:
mode:
authordteske <dteske@FreeBSD.org>2013-06-18 09:43:10 +0000
committerdteske <dteske@FreeBSD.org>2013-06-18 09:43:10 +0000
commit4e50a558f974fca2963b15902e0bd08fcfa8c47c (patch)
tree851fb0e5ce9b281d9518cc4099f80834d4468a52 /usr.sbin/bsdconfig/networking
parentc6e53d8f4efe032a9ce880fdaa359e300012e8ba (diff)
downloadFreeBSD-src-4e50a558f974fca2963b15902e0bd08fcfa8c47c.zip
FreeBSD-src-4e50a558f974fca2963b15902e0bd08fcfa8c47c.tar.gz
Perform some code consolidation and add some additional error
checking/reporting. (similar to SVN revision 251919)
Diffstat (limited to 'usr.sbin/bsdconfig/networking')
-rw-r--r--usr.sbin/bsdconfig/networking/include/messages.subr1
-rwxr-xr-xusr.sbin/bsdconfig/networking/networking46
2 files changed, 21 insertions, 26 deletions
diff --git a/usr.sbin/bsdconfig/networking/include/messages.subr b/usr.sbin/bsdconfig/networking/include/messages.subr
index 3a3d1bc..2c4c668 100644
--- a/usr.sbin/bsdconfig/networking/include/messages.subr
+++ b/usr.sbin/bsdconfig/networking/include/messages.subr
@@ -99,6 +99,7 @@ msg_saving_network_interface="Saving %s network interface settings..."
msg_scanning_for_dhcp="Scanning for DHCP servers on %s interface..."
msg_select_network_interface="Select a network interface to configure.\n\n* Interface is marked as \"active\""
msg_supported_media_options="Below is a list of supported media options for the %s interface. Please select the options that you would like to set for the %s network interface"
+msg_unknown_networking_menu_selection="Unknown networking menu selection"
xmsg_please_enter_fqhn="Please enter your fully qualified hostname (e.g. foo.bar.com).\n The domain portion of the hostname will be configured in resolv.conf(5)."
xmsg_please_enter_nameserver_existing="Please enter the new IP address of the DNS nameserver\n(set to the NULL string to remove entry):"
xmsg_supported_media_options="Below is a list of supported media options for the %s interface. Please\nselect the options that you would like to set for the %s network interface"
diff --git a/usr.sbin/bsdconfig/networking/networking b/usr.sbin/bsdconfig/networking/networking
index ba34af3..36122ca 100755
--- a/usr.sbin/bsdconfig/networking/networking
+++ b/usr.sbin/bsdconfig/networking/networking
@@ -119,35 +119,29 @@ while :; do
dialog_menu_main || f_die
f_dialog_menutag_fetch mtag
+ command=
case "$mtag" in
- X) # Exit
- break
- ;;
-
- 1) # Hostname/Domain
- $BSDCFG_LIBE/$APP_DIR/hostname ${USE_XDIALOG:+-X}
- ;;
-
- 2) # Network Interfaces
- $BSDCFG_LIBE/$APP_DIR/devices ${USE_XDIALOG:+-X}
-
- # Make subsequent uses of this menu faster by not performing
- # "ifconfig up" (limiting the pain one must endure). See also
- # `$BSDCFG_SHARE/networking/device.subr'.
- #
- export DIALOG_MENU_NETDEV_KICK_INTERFACES=
- ;;
-
- 3) # Default Router/Gateway
- $BSDCFG_LIBE/$APP_DIR/defaultrouter ${USE_XDIALOG:+-X}
- ;;
-
- 4) # DNS nameservers
- $BSDCFG_LIBE/$APP_DIR/nameservers ${USE_XDIALOG:+-X}
- ;;
-
+ X) break ;;
+ 1) command=hostname ;; # Hostname/Domain
+ 2) command=devices ;; # Network Interfaces
+ 3) command=defaultrouter ;; # Default Router/Gateway
+ 4) command=nameservers ;; # DNS nameservers
esac
+ if [ "$command" ]; then
+ $BSDCFG_LIBE/$APP_DIR/$command ${USE_XDIALOG:+-X}
+ else
+ f_die 1 "$msg_unknown_networking_menu_selection"
+ fi
+
+ if [ "$mtag" = "devices" ]; then
+ #
+ # Make subsequent uses of this menu faster by not performing
+ # "ifconfig up" (limiting the pain one must endure). See also
+ # `$BSDCFG_SHARE/networking/device.subr'.
+ #
+ export DIALOG_MENU_NETDEV_KICK_INTERFACES=
+ fi
done
exit $SUCCESS
OpenPOWER on IntegriCloud