Date: Wed, 15 Jan 2014 07:36:34 +0000 (UTC) From: Devin Teske <dteske@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260675 - in stable/10/usr.sbin/bsdconfig: . console console/include dot include includes mouse/include networking/include networking/share share share/media startup/include usermgmt/in... Message-ID: <201401150736.s0F7aYj6012794@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dteske Date: Wed Jan 15 07:36:34 2014 New Revision: 260675 URL: http://svnweb.freebsd.org/changeset/base/260675 Log: MFC r258355,258360,258400-258401,258406-258407,258418,258430,258439,258589- 258590,258592,258727-258728,258785, with the following descriptions: Revisions 258400-258401,258406-258407,258590,258727-258728,258785: + Add a new `includes' module (see: bsdconfig includes -h) for exploring the bsdconfig(8) API Remaining revisions: 258592: Sort all the messages.subr files 258355: Fix typo in a comment in networking/device.subr 258360: Whitespace, style, and other changes in networking/device.subr 258418: Quote interface names for good measure in networking/device.subr 258430: Remove an unused line in networking/device.subr 258439: Minor bugfix to f_die() function in common.subr 258589: Minor bugfix to syscons_ttys module Added: stable/10/usr.sbin/bsdconfig/includes/ - copied from r258400, head/usr.sbin/bsdconfig/includes/ Modified: stable/10/usr.sbin/bsdconfig/Makefile stable/10/usr.sbin/bsdconfig/console/include/messages.subr stable/10/usr.sbin/bsdconfig/console/ttys stable/10/usr.sbin/bsdconfig/dot/dot stable/10/usr.sbin/bsdconfig/include/messages.subr stable/10/usr.sbin/bsdconfig/includes/USAGE stable/10/usr.sbin/bsdconfig/includes/includes stable/10/usr.sbin/bsdconfig/mouse/include/messages.subr stable/10/usr.sbin/bsdconfig/networking/include/messages.subr stable/10/usr.sbin/bsdconfig/networking/share/device.subr stable/10/usr.sbin/bsdconfig/share/media/tcpip.subr stable/10/usr.sbin/bsdconfig/share/variable.subr stable/10/usr.sbin/bsdconfig/startup/include/messages.subr stable/10/usr.sbin/bsdconfig/usermgmt/include/messages.subr Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/bsdconfig/Makefile ============================================================================== --- stable/10/usr.sbin/bsdconfig/Makefile Wed Jan 15 06:17:15 2014 (r260674) +++ stable/10/usr.sbin/bsdconfig/Makefile Wed Jan 15 07:36:34 2014 (r260675) @@ -6,6 +6,7 @@ SUBDIR= console \ dot \ examples \ include \ + includes \ mouse \ networking \ packages \ Modified: stable/10/usr.sbin/bsdconfig/console/include/messages.subr ============================================================================== --- stable/10/usr.sbin/bsdconfig/console/include/messages.subr Wed Jan 15 06:17:15 2014 (r260674) +++ stable/10/usr.sbin/bsdconfig/console/include/messages.subr Wed Jan 15 07:36:34 2014 (r260675) @@ -51,8 +51,8 @@ msg_cancel="Cancel" msg_central_european_iso="Central European ISO" msg_central_european_iso_desc="Central European ISO keymap" msg_choose_alternate_keyboard_map="Choose an alternate keyboard map" -msg_choose_alternate_screenmap="Choose an alternate screenmap" msg_choose_alternate_screen_font="Choose an alternate screen font" +msg_choose_alternate_screenmap="Choose an alternate screenmap" msg_choose_console_terminal_type="Choose console terminal type" msg_configure_screen_saver="Configure the screen saver" msg_console_menu_text="The system console driver for FreeBSD has a number of configuration\noptions which may be set according to your preference.\n\nWhen you are done setting configuration options, select Cancel." @@ -74,9 +74,9 @@ msg_enter_timeout_period="Enter time-out msg_estonian_cp850="Estonian CP850" msg_estonian_cp850_desc="Estonian Code Page 850 keymap" msg_estonian_iso="Estonian ISO" -msg_estonian_iso_desc="Estonian ISO keymap" msg_estonian_iso_15="Estonian ISO 15" msg_estonian_iso_15_desc="Estonian ISO 8859-15 keymap" +msg_estonian_iso_desc="Estonian ISO keymap" msg_exit="Exit" msg_exit_this_menu="Exit this menu" msg_fade="Fade" @@ -97,8 +97,6 @@ msg_french_iso_accent_desc="French ISO k msg_french_iso_desc="French ISO keymap" msg_french_iso_macbook="French ISO/Macbook" msg_french_iso_macbook_desc="French ISO keymap on macbook" -msg_green="Green" -msg_green_desc="\"Green\" power saving mode (if supported by monitor)" msg_german_cp850="German CP850" msg_german_cp850_desc="German Code Page 850 keymap" msg_german_iso="German ISO" @@ -109,10 +107,14 @@ msg_greek_104="Greek 104" msg_greek_104_desc="Greek ISO keymap (104 keys)" msg_greek_elot="Greek ELOT" msg_greek_elot_desc="Greek ISO keymap (ELOT 1000)" +msg_green="Green" +msg_green_desc="\"Green\" power saving mode (if supported by monitor)" msg_hungarian_101="Hungarian 101" msg_hungarian_101_desc="Hungarian ISO keymap (101 key)" msg_hungarian_102="Hungarian 102" msg_hungarian_102_desc="Hungarian ISO keymap (102 key)" +msg_ibm_1251="IBM 1251" +msg_ibm_1251_desc="Cyrillic, MS Windows encoding" msg_ibm_437="IBM 437" msg_ibm_437_desc="English and others, VGA default" msg_ibm_437_vga_default="IBM437 (VGA default)" @@ -124,12 +126,12 @@ msg_ibm_866="IBM 866" msg_ibm_866_desc="Russian, IBM encoding (use with KOI8-R screenmap)" msg_ibm_866u="IBM 866u" msg_ibm_866u_desc="Ukrainian, IBM encoding (use with KOI8-U screenmap)" -msg_ibm_1251="IBM 1251" -msg_ibm_1251_desc="Cyrillic, MS Windows encoding" msg_icelandic="Icelandic" msg_icelandic_accent="Icelandic (accent)" msg_icelandic_accent_desc="Icelandic ISO keymap (accent keys)" msg_icelandic_desc="Icelandic ISO keymap" +msg_iso_8859_15="ISO 8859-15" +msg_iso_8859_15_desc="Europe, ISO encoding" msg_iso_8859_1="ISO 8859-1" msg_iso_8859_1_desc="Western Europe, ISO encoding" msg_iso_8859_1_to_ibm437="ISO 8859-1 to IBM437" @@ -144,8 +146,6 @@ msg_iso_8859_7_to_ibm437="ISO 8859-7 to msg_iso_8859_7_to_ibm437_desc="Greek ISO 8859-1 to IBM 437 screenmap" msg_iso_8859_8="ISO 8859-8" msg_iso_8859_8_desc="Hebrew, ISO encoding" -msg_iso_8859_15="ISO 8859-15" -msg_iso_8859_15_desc="Europe, ISO encoding" msg_italian="Italian" msg_italian_desc="Italian ISO keymap" msg_japanese_106="Japanese 106" @@ -153,9 +153,9 @@ msg_japanese_106_desc="Japanese 106 keym msg_keymap="Keymap" msg_keymap_menu_text="The system console driver for FreeBSD defaults to a standard\n\"US\" keyboard map. Users may wish to choose one of the\nother keymaps below." msg_koi8_r="KOI8-R" -msg_koi8_u="KOI8-U" msg_koi8_r_to_ibm866="KOI8-R to IBM866" msg_koi8_r_to_ibm866_desc="Russian KOI8-R to IBM 866 screenmap" +msg_koi8_u="KOI8-U" msg_koi8_u_to_ibm866u="KOI8-U to IBM866u" msg_koi8_u_to_ibm866u_desc="Ukrainian KOI8-U to IBM 866u screenmap" msg_latin_american="Latin American" @@ -224,8 +224,8 @@ msg_swiss_german_iso_accent_desc="Swiss msg_swiss_german_iso_desc="Swiss German ISO keymap" msg_system_console_configuration="System Console Configuration" msg_system_console_font="System Console Font" -msg_system_console_keymap="System Console Keymap" msg_system_console_keyboard_repeat_rate="System Console Keyboard Repeat Rate" +msg_system_console_keymap="System Console Keymap" msg_system_console_screen_saver="System Console Screen Saver" msg_system_console_screenmap="System Console Screenmap" msg_system_console_terminal_type="System Console Terminal Type" Modified: stable/10/usr.sbin/bsdconfig/console/ttys ============================================================================== --- stable/10/usr.sbin/bsdconfig/console/ttys Wed Jan 15 06:17:15 2014 (r260674) +++ stable/10/usr.sbin/bsdconfig/console/ttys Wed Jan 15 07:36:34 2014 (r260675) @@ -113,7 +113,7 @@ ttys_set_type() # # Create new temporary file to write our ttys(5) update with new types. # - local tmpfile="$( mktemp -t "pgm" )" + local tmpfile="$( mktemp -t "$pgm" )" [ "$tmpfile" ] || return $FAILURE # Modified: stable/10/usr.sbin/bsdconfig/dot/dot ============================================================================== --- stable/10/usr.sbin/bsdconfig/dot/dot Wed Jan 15 06:17:15 2014 (r260674) +++ stable/10/usr.sbin/bsdconfig/dot/dot Wed Jan 15 07:36:34 2014 (r260675) @@ -163,7 +163,7 @@ while getopts cdhi flag; do done shift $(( $OPTIND - 1 )) -cd $BSDCFG_LIBE || f_die 1 "$msg_directory_not_found" "$BSDCFG_LIB" +cd $BSDCFG_LIBE || f_die # Pedantic # # Get a list of menu programs Modified: stable/10/usr.sbin/bsdconfig/include/messages.subr ============================================================================== --- stable/10/usr.sbin/bsdconfig/include/messages.subr Wed Jan 15 06:17:15 2014 (r260674) +++ stable/10/usr.sbin/bsdconfig/include/messages.subr Wed Jan 15 07:36:34 2014 (r260675) @@ -170,8 +170,8 @@ msg_install_from_an_http_server="Install msg_install_from_the_existing_filesystem="Install from the existing filesystem" msg_install_over_nfs="Install over NFS" msg_installed="Installed" -msg_installed_lc="installed" msg_installed_desc="Leave package as-is, installed" +msg_installed_lc="installed" msg_invalid_gateway_ipv4_address_specified="Invalid gateway IPv4 address specified" msg_invalid_hostname_value="Invalid hostname value" msg_invalid_ipv4_address="Invalid IPv4 address" @@ -261,7 +261,6 @@ msg_ok="OK" msg_options="Options" msg_options_editor="Options Editor" msg_other="other" -msg_pkg_delete_failed="Warning: pkg-delete(8) of %s failed.\n Run with debugging for details." msg_package_is_needed_by_other_installed_packages="Warning: Package %s is needed by\n %d other installed package%s." msg_package_not_installed_cannot_delete="Warning: package %s not installed\n No package can be deleted." msg_package_temp="Package Temp" @@ -273,6 +272,7 @@ msg_parallel_desc="Applications dealing msg_pear_desc="Software related to the Pear PHP framework." msg_perl5_desc="Utilities/modules for the PERL5 language." msg_permission_denied="%s: %s: Permission denied" +msg_pkg_delete_failed="Warning: pkg-delete(8) of %s failed.\n Run with debugging for details." msg_pkg_install_apparently_did_not_like_the_package="pkg-install(8) apparently did not like the %s package." msg_plan9_desc="Software from the Plan9 operating system." msg_please_check_the_url_and_try_again="No such directory: %s\nplease check the URL and try again.\n" @@ -375,9 +375,9 @@ msg_unable_to_get_file_from_selected_med msg_unable_to_get_proper_ftp_path="Unable to get proper FTP path. FTP media not initialized." msg_unable_to_initialize_media_type_for_package_extract="Unable to initialize media type for package extract." msg_unable_to_make_directory_mountpoint="Unable to make %s directory mountpoint for %s!" -msg_unable_to_pkg_rquery_package_dependencies="Unable to pkg-rquery(8) package dependencies!" -msg_unable_to_pkg_rquery_package_categories="Unable to pkg-rquery(8) package categories!" msg_unable_to_open="Unable to open %s" +msg_unable_to_pkg_rquery_package_categories="Unable to pkg-rquery(8) package categories!" +msg_unable_to_pkg_rquery_package_dependencies="Unable to pkg-rquery(8) package dependencies!" msg_unable_to_update_pkg_from_selected_media="Unable to update pkg(8) from selected media." msg_uninstall="Uninstall" msg_uninstall_desc="Mark this package for deletion" Modified: stable/10/usr.sbin/bsdconfig/includes/USAGE ============================================================================== --- head/usr.sbin/bsdconfig/includes/USAGE Wed Nov 20 20:37:21 2013 (r258400) +++ stable/10/usr.sbin/bsdconfig/includes/USAGE Wed Jan 15 07:36:34 2014 (r260675) @@ -28,6 +28,7 @@ Usage: bsdconfig @PROGRAM_NAME@ [OPTIONS OPTIONS: -a Always use color even when output is not to a terminal. + -d Print description for each function selected. Implies `-f'. -f Show functions for selected includes. -F pattern If `-f', only print functions matching pattern. Without `-f' @@ -64,3 +65,7 @@ EXAMPLES: bsdconfig @PROGRAM_NAME@ -F show common NB: The `.subr' suffix on the end of the include is optional. + + Show descriptions of each of the `show' functions: + + bsdconfig @PROGRAM_NAME@ -dF show Modified: stable/10/usr.sbin/bsdconfig/includes/includes ============================================================================== --- head/usr.sbin/bsdconfig/includes/includes Wed Nov 20 20:37:21 2013 (r258400) +++ stable/10/usr.sbin/bsdconfig/includes/includes Wed Jan 15 07:36:34 2014 (r260675) @@ -29,7 +29,7 @@ ############################################################ INCLUDES # Prevent common.subr from auto initializing debugging (this is not an inter- -# active utility that requires debugging). +# active utility that requires debugging; also `-d' has been repurposed). # DEBUG_SELF_INITIALIZE=NO @@ -50,6 +50,7 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_ # Options # USE_COLOR=1 +SHOW_DESC= SHOW_FUNCS= FUNC_PATTERN= @@ -64,24 +65,62 @@ show_include() local file="${1#./}" local pattern="${FUNC_PATTERN:-.*}" - output=$( awk -v use_color=${USE_COLOR:-0} -v re="$pattern" ' + output=$( awk \ + -v use_color=${USE_COLOR:-0} \ + -v re="$pattern" \ + -v show_desc=${SHOW_DESC:-0} ' + function asorti(src, dest) + { + # Copy src indices to dest and calculate array length + nitems = 0; for (i in src) dest[++nitems] = i + + # Sort the array of indices (dest) using insertion sort method + for (i = 1; i <= nitems; k = i++) + { + idx = dest[i] + while ((k > 0) && (dest[k] > idx)) + { + dest[k+1] = dest[k] + k-- + } + dest[k+1] = idx + } + + return nitems + } /^$/,/^#/ { if ($0 ~ /^# f_/) { if (!match($2, re)) next + fn = $2 if (use_color) - printf " %s[1;31m%s[0m%s\n", + syntax[fn] = sprintf("+%s[1;31m%s[0m%s\n", substr($0, 2, RSTART), substr($0, 2 + RSTART, RLENGTH), - substr($0, 2 + RSTART + RLENGTH) + substr($0, 2 + RSTART + RLENGTH)) else - print substr($0, 2) - print_more = substr($0, length($0)) == "\\" + syntax[fn] = "+" substr($0, 2) "\n" + if (show_desc) + print_more = 1 + else + print_more = substr($0, length($0)) == "\\" } - while (print_more) { + if (show_desc && print_more) { + getline + while ($0 ~ /^#/) { + syntax[fn] = syntax[fn] " " substr($0, 2) "\n" + getline + } + print_more = 0 + } else while (print_more) { getline - print substr($0, 2) + syntax[fn] = syntax[fn] " " substr($0, 2) "\n" print_more = substr($0, length($0)) == "\\" } + } + END { + n = asorti(syntax, sorted_indices) + for (i = 1; i <= n; i++) + printf "%s", syntax[sorted_indices[i]] }' "$file" ) if [ "$output" ]; then if [ ! "$SHOW_FUNCS" ]; then @@ -89,10 +128,10 @@ show_include() return $SUCCESS fi if [ "$FUNC_PATTERN" ]; then - printf "$msg_functions_in_matching\n" \ + printf ">>> $msg_functions_in_matching\n" \ "$file" "$FUNC_PATTERN" else - printf "$msg_functions_in\n" "$file" + printf ">>> $msg_functions_in\n" "$file" fi echo "$output" echo # blank line to simplify awk(1)-based reparse @@ -110,9 +149,10 @@ show_include() # # Process command-line arguments # -while getopts afF:hn flag; do +while getopts adfF:hn flag; do case "$flag" in a) USE_COLOR=1 ;; + d) SHOW_DESC=1 SHOW_FUNCS=1 ;; f) SHOW_FUNCS=1 ;; F) FUNC_PATTERN="$OPTARG" ;; n) USE_COLOR= ;; @@ -122,7 +162,7 @@ done shift $(( $OPTIND - 1 )) # cd(1) to `share' dir so relative paths work for find and positional args -cd $BSDCFG_SHARE || f_die 1 "$msg_directory_not_found" "$BSDCFG_SHARE" +cd $BSDCFG_SHARE || f_die # Pedantic # # If given an argument, operate on it specifically (implied `-f') and exit @@ -132,9 +172,11 @@ for include in "$@"; do # See if they've just omitted the `*.subr' suffix [ -f "$include.subr" -a ! -f "$include" ] && include="$include.subr" if [ ! -f "$include" ]; then - f_die 1 "$msg_no_such_file_or_directory" "$0" "$include" + printf "$msg_no_such_file_or_directory\n" "$0" "$include" + exit $FAILURE elif [ ! -r "$include" ]; then - f_die 1 "$msg_permission_denied" "$0" "$include" + printf "$msg_permission_denied\n" "$0" "$include" + exit $FAILURE fi show_include "$include" || f_die done Modified: stable/10/usr.sbin/bsdconfig/mouse/include/messages.subr ============================================================================== --- stable/10/usr.sbin/bsdconfig/mouse/include/messages.subr Wed Jan 15 06:17:15 2014 (r260674) +++ stable/10/usr.sbin/bsdconfig/mouse/include/messages.subr Wed Jan 15 07:36:34 2014 (r260675) @@ -58,14 +58,14 @@ msg_microsoft="Microsoft" msg_microsoft_desc="Microsoft protocol (serial)" msg_mm_series="MM Series" msg_mm_series_desc="MM Series protocol (serial)" -msg_mouseman="MouseMan" -msg_mouseman_desc="Logitech MouseMan/TrackMan models (serial)" -msg_mousesystems="MouseSystems" -msg_mousesystems_desc="MouseSystems protocol (serial)" msg_mouse_daemon_is_disabled="The mouse daemon is disabled." msg_mouse_disable="Mouse Disable" msg_mouse_enable="Mouse Enable" msg_mouse_flags="Mouse Flags" +msg_mouseman="MouseMan" +msg_mouseman_desc="Logitech MouseMan/TrackMan models (serial)" +msg_mousesystems="MouseSystems" +msg_mousesystems_desc="MouseSystems protocol (serial)" msg_now_move_the_mouse="Now move the mouse and see if it works.\n(Note that buttons don't have any effect for now.)\n\n Is the mouse cursor moving?\n" msg_ok="OK" msg_please_configure_your_mouse="Please configure your mouse" Modified: stable/10/usr.sbin/bsdconfig/networking/include/messages.subr ============================================================================== --- stable/10/usr.sbin/bsdconfig/networking/include/messages.subr Wed Jan 15 06:17:15 2014 (r260674) +++ stable/10/usr.sbin/bsdconfig/networking/include/messages.subr Wed Jan 15 07:36:34 2014 (r260675) @@ -59,15 +59,15 @@ msg_ipv4_addr_octet_contains_invalid_cha msg_ipv4_addr_octet_exceeds_max_value="ERROR! One or more individual octets within the IPv4 address\n(separated by dots) exceeds the maximum of 255.\n\nInvalid IP Address: %s" msg_ipv4_addr_octet_is_null="ERROR! One or more individual octets within the IPv4 address\n(separated by dots) are null and/or missing.\n\nInvalid IP Address: %s" msg_ipv4_addr_octet_missing_or_extra="ERROR! The IPv4 address entered has either too few (less than\nfour) or too many (more than four) octets, separated by dots.\n\nInvalid IP Address: %s" -msg_ipv6_addr_segment_contains_invalid_chars="ERROR! One or more individual segments within the IP address\n(separated by colons) contains one or more invalid characters.\nSegments must contain only combinations of the characters 0-9,\nA-F, or a-f.\n\nInvalid IPv6 Address: %s" -msg_ipv6_addr_segment_contains_too_many_chars="ERROR! One or more individual segments within the IP address\n(separated by colons) exceeds the length of 4 hex-digits.\n\nInvalid IPv6 Address: %s" -msg_ipv6_addr_too_few_or_extra_segments="ERROR! The IP address entered has either too few (less than 3), too\nmany (more than 8), or not enough segments, separated by colons.\n\nInvalid IPv6 Address: %s" -msg_ipv6_addr_too_many_null_segments="ERROR! Too many/incorrect null segments. A single null\nsegment is allowed within the IP address (separated by\ncolons) but not allowed at the beginning or end (unless\na double-null segment; i.e., \"::*\" or \"*::\").\n\nInvalid IPv6 Address: %s" msg_ipv4_mask_field_contains_invalid_chars="ERROR! One or more individual fields within the subnet mask\n(separated by dots) contains one or more invalid characters.\n\nInvalid Subnet Mask: %s" msg_ipv4_mask_field_exceeds_max_value="ERROR! One or more individual fields within the subnet mask\n(separated by dots) exceeds the maximum of 255.\n\nInvalid Subnet Mask: %s" msg_ipv4_mask_field_invalid_value="ERROR! One or more individual fields within the subnet mask\n(separated by dots) contains one or more invalid integers.\nFields must be one of 0/128/192/224/240/248/252/254/255.\n\nInvalid Subnet Mask: %s" msg_ipv4_mask_field_is_null="ERROR! One or more individual fields within the subnet mask\n(separated by dots) are null and/or missing.\n\nInvalid Subnet Mask: %s" msg_ipv4_mask_field_missing_or_extra="ERROR! The subnet mask entered has either too few or too many\nfields.\n\nInvalid Subnet Mask: %s" +msg_ipv6_addr_segment_contains_invalid_chars="ERROR! One or more individual segments within the IP address\n(separated by colons) contains one or more invalid characters.\nSegments must contain only combinations of the characters 0-9,\nA-F, or a-f.\n\nInvalid IPv6 Address: %s" +msg_ipv6_addr_segment_contains_too_many_chars="ERROR! One or more individual segments within the IP address\n(separated by colons) exceeds the length of 4 hex-digits.\n\nInvalid IPv6 Address: %s" +msg_ipv6_addr_too_few_or_extra_segments="ERROR! The IP address entered has either too few (less than 3), too\nmany (more than 8), or not enough segments, separated by colons.\n\nInvalid IPv6 Address: %s" +msg_ipv6_addr_too_many_null_segments="ERROR! Too many/incorrect null segments. A single null\nsegment is allowed within the IP address (separated by\ncolons) but not allowed at the beginning or end (unless\na double-null segment; i.e., \"::*\" or \"*::\").\n\nInvalid IPv6 Address: %s" msg_netmask="netmask" msg_network_configuration="%s Network Configuration:\nChoose Save/Exit when finished or Cancel." msg_network_interfaces="Network Interfaces" Modified: stable/10/usr.sbin/bsdconfig/networking/share/device.subr ============================================================================== --- stable/10/usr.sbin/bsdconfig/networking/share/device.subr Wed Jan 15 06:17:15 2014 (r260674) +++ stable/10/usr.sbin/bsdconfig/networking/share/device.subr Wed Jan 15 07:36:34 2014 (r260675) @@ -62,7 +62,8 @@ f_include_lang $BSDCFG_LIBE/$APP_DIR/inc # f_dialog_menu_netdev() { - local defaultitem="${1%\*}" # Tim trailing asterisk if present + local menu_list # Calculated below + local defaultitem="${1%\*}" # Trim trailing asterisk if present # # Display a message to let the user know we're working... @@ -73,20 +74,15 @@ f_dialog_menu_netdev() # # Get list of usable network interfaces # - local d='[[:digit:]]+:' - local iflist="`echo "$(ifconfig -l):" | sed -E -e " - # Convert all spaces to colons - y/ /:/ - - # Prune unsavory interfaces - s/lo$d//g - s/ppp$d//g - s/sl$d//g - s/faith$d//g - - # Convert all colons back into spaces - y/:/ / - "`" + local if iflist= # Calculated below + for if in $( ifconfig -l ); do + # Skip unsavory interfaces + case "$if" in + lo[0-9]*|ppp[0-9]*|sl[0-9]*|faith[0-9]*) continue ;; + esac + iflist="$iflist $if" + done + iflist="${iflist# }" # # Optionally kick interfaces in the head to get them to accurately @@ -110,20 +106,17 @@ f_dialog_menu_netdev() # Mark any "active" interfaces with an asterisk (*) # to the right of the device name. # - interfaces=$( + menu_list=$( for ifn in $iflist; do - active=$( ifconfig $ifn | awk \ - ' - ( $1 == "status:" ) \ - { - if ( $2 == "active" ) { print 1; exit } - } - ' ) + active=$( ifconfig $ifn 2> /dev/null | awk ' + ($1 == "status:") { + if ($2 == "active") { print 1; exit } + }' ) printf "'%s%s' '%s'\n" \ $ifn "${active:+*}" "$( f_device_desc $ifn )" done ) - if [ ! "$interfaces" ]; then + if [ ! "$menu_list" ]; then f_show_msg "$msg_no_network_interfaces" return $DIALOG_CANCEL fi @@ -132,8 +125,8 @@ f_dialog_menu_netdev() # Maybe the default item was marked as active # if [ "$defaultitem" ]; then - ifconfig "$defaultitem" 2> /dev/null | awk \ - '( $1 == "status:" && $2 != "active" ) { exit 0 }' || + ifconfig "$defaultitem" 2> /dev/null | + awk '($1 == "status:" && $2 == "active"){exit 1}' || defaultitem="$defaultitem*" fi @@ -149,7 +142,7 @@ f_dialog_menu_netdev() \"\$DIALOG_BACKTITLE\" \ \"\$prompt\" \ \"\$hline\" \ - $interfaces + $menu_list local menu_choice menu_choice=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ @@ -160,7 +153,7 @@ f_dialog_menu_netdev() --default-item \"\$defaultitem\" \ --menu \"\$prompt\" \ $height $width $rows \ - $interfaces \ + $menu_list \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) local retval=$? @@ -284,22 +277,23 @@ f_dialog_menu_netdev_edit() msg=$( printf "$msg_scanning_for_dhcp" "$interface" ) if [ "$USE_XDIALOG" ]; then ( - f_quietly ifconfig $interface delete - f_quietly dhclient $interface + f_quietly ifconfig "$interface" delete + f_quietly dhclient "$interface" ) | f_xdialog_info "$msg" else f_dialog_info "$msg" - f_quietly ifconfig $interface delete - f_quietly dhclient $interface + f_quietly ifconfig "$interface" delete + f_quietly dhclient "$interface" fi ) retval=$? trap 'interrupt' SIGINT if [ $retval -eq $DIALOG_OK ]; then dhcp=1 - ipaddr=$( f_ifconfig_inet $interface ) - netmask=$( f_ifconfig_netmask $interface ) + f_ifconfig_inet "$interface" ipaddr + f_ifconfig_inet6 "$interface" ipaddr6 + f_ifconfig_netmask "$interface" netmask options= # Fixup search/domain in resolv.conf(5) Modified: stable/10/usr.sbin/bsdconfig/share/media/tcpip.subr ============================================================================== --- stable/10/usr.sbin/bsdconfig/share/media/tcpip.subr Wed Jan 15 06:17:15 2014 (r260674) +++ stable/10/usr.sbin/bsdconfig/share/media/tcpip.subr Wed Jan 15 07:36:34 2014 (r260675) @@ -110,10 +110,11 @@ f_struct_define DHCP_LEASE \ # begin or end with a hyphen). # 3 One or more individual labels within the hostname are null. # -# f_dialog_validate_hostname $hostname +# To call this function and display an appropriate error message to the user +# based on the above error codes, use the following function defined in +# dialog.subr: # -# If the hostname is determined to be invalid, the appropriate error will be -# displayed using the f_show_msg function. +# f_dialog_validate_hostname $hostname # f_validate_hostname() { Modified: stable/10/usr.sbin/bsdconfig/share/variable.subr ============================================================================== --- stable/10/usr.sbin/bsdconfig/share/variable.subr Wed Jan 15 06:17:15 2014 (r260674) +++ stable/10/usr.sbin/bsdconfig/share/variable.subr Wed Jan 15 07:36:34 2014 (r260675) @@ -179,7 +179,7 @@ f_debugging() f_getvar $VAR_DEBUG value && [ "$value" ] } -# f_interactive() +# f_interactive # # Are we running interactively? Return error if $nonInteractive is set and non- # NULL, otherwise return success. @@ -190,7 +190,7 @@ f_interactive() ! f_getvar $VAR_NONINTERACTIVE value || [ ! "$value" ] } -# f_netinteractive() +# f_netinteractive # # Has the user specifically requested the network-portion of configuration and # setup to be performed interactively? Returns success if the user has asked @@ -205,7 +205,7 @@ f_netinteractive() f_getvar $VAR_NETINTERACTIVE value && [ "$value" ] } -# f_zfsinteractive() +# f_zfsinteractive # # Has the user specifically requested the ZFS-portion of configuration and # setup to be performed interactively? Returns success if the user has asked Modified: stable/10/usr.sbin/bsdconfig/startup/include/messages.subr ============================================================================== --- stable/10/usr.sbin/bsdconfig/startup/include/messages.subr Wed Jan 15 06:17:15 2014 (r260674) +++ stable/10/usr.sbin/bsdconfig/startup/include/messages.subr Wed Jan 15 07:36:34 2014 (r260675) @@ -39,8 +39,8 @@ msg_all_desc="Select all directives" msg_all_help="Select all displayed rc.conf(5) configuration directives" msg_apm="APM" msg_apm_desc="Auto-power management services (typically laptops)" -msg_are_you_sure_you_want_to_delete="Are you sure you want to delete the \`%s' directive\nfrom the rc.conf(5) collection of system configuration files?" msg_are_you_sure_you_want_delete_the_following="Are you sure you want to delete the following directives\nfrom the rc.conf(5) collection of system configuration files?" +msg_are_you_sure_you_want_to_delete="Are you sure you want to delete the \`%s' directive\nfrom the rc.conf(5) collection of system configuration files?" msg_cancel="Cancel" msg_choose_view_details="Choose View Details" msg_creating_menu_list="Creating menu list...\nThis may take a while." @@ -67,8 +67,8 @@ msg_exit_this_menu="Exit this menu" msg_info="Info" msg_lpd="lpd" msg_lpd_desc="This host has a printer and wants to run lpd." -msg_miscellaneous_startup_services="Miscellaneous Startup Services" msg_miscellaneous_menu_text="This menu allows you to configure various aspects of your system's\nstartup configuration. Use [SPACE] or [ENTER] to select items, and\n[TAB] to move to the buttons. Select Exit to leave this menu." +msg_miscellaneous_startup_services="Miscellaneous Startup Services" msg_named="named" msg_named_desc="Run a local name server on this host" msg_named_flags="named flags" Modified: stable/10/usr.sbin/bsdconfig/usermgmt/include/messages.subr ============================================================================== --- stable/10/usr.sbin/bsdconfig/usermgmt/include/messages.subr Wed Jan 15 06:17:15 2014 (r260674) +++ stable/10/usr.sbin/bsdconfig/usermgmt/include/messages.subr Wed Jan 15 07:36:34 2014 (r260675) @@ -32,9 +32,9 @@ hline_arrows_space_tab_enter="Use arrows hline_arrows_tab_enter="Press arrows, TAB or ENTER" hline_num_arrows_tab_enter="Use numbers, arrows, TAB or ENTER" hline_num_tab_enter="Use numbers, TAB or ENTER" +msg_account_does_not_expire="Account does not expire" msg_account_expires_in_how_many_days="Account expires in how many days?" msg_account_expires_on="Account Expires on" -msg_account_does_not_expire="Account does not expire" msg_add="Add" msg_add_group="Add Group" msg_add_login="Add Login" @@ -65,9 +65,9 @@ msg_group="Group" msg_group_added="Group Added" msg_group_already_used="%s: Group is already used." msg_group_deleted="Group Deleted" -msg_group_is_empty="Group is empty." msg_group_id="Group ID" msg_group_id_leave_empty_for_default="Group ID (Leave empty for default)" +msg_group_is_empty="Group is empty." msg_group_members="Group Members" msg_group_must_start_with_letter="Group must start with a letter." msg_group_not_found="%s: Group not found." @@ -89,21 +89,21 @@ msg_login_not_found="Login not found." msg_login_updated="Login Updated" msg_member_of_groups="Member of Groups" msg_n_a="N/A" -msg_number_of_seconds_since_epoch="Number of seconds since the Epoch\n(1 = %s)\nNULL or zero to disable:" msg_no="No" +msg_number_of_seconds_since_epoch="Number of seconds since the Epoch\n(1 = %s)\nNULL or zero to disable:" msg_ok="OK" msg_password="Password" +msg_password_does_not_expire="Password does not expire" msg_password_expires_in_how_many_days="Password expires in how many days?" msg_password_expires_on="Password Expires on" msg_passwords_do_not_match="Passwords do not match." -msg_password_does_not_expire="Password does not expire" msg_reenter_group_password="Re-enter Group Password" msg_reenter_password="Re-enter Password" msg_save="Save" msg_save_exit_or_cancel="Choose Save/Exit when finished or Cancel." -msg_separated_by_commas="Separated by commas" msg_select_group_members_from_list="Select Group Members from a list" msg_select_login_shell="Select Login Shell" +msg_separated_by_commas="Separated by commas" msg_shell="Shell" msg_unknown_user_management_menu_selection="Unknown user management menu selection" msg_use_default_values_for_all_account_details="Use default values for all account details?"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201401150736.s0F7aYj6012794>