Date: Sun, 2 Jun 2013 20:02:50 +0000 (UTC) From: Devin Teske <dteske@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251264 - in head/usr.sbin/bsdconfig: . console mouse networking networking/share password/share security share share/media share/packages startup startup/share timezone usermgmt usermg... Message-ID: <201306022002.r52K2oZ3024839@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dteske Date: Sun Jun 2 20:02:50 2013 New Revision: 251264 URL: http://svnweb.freebsd.org/changeset/base/251264 Log: Standardize the way functions build their arguments leading up to a dialog invocation. Specifically, "top-load" your arguments and in the order in- which they will be displayed. For example, many [if not all] widgets display information in the following order, top-to-bottom (visually): + backtitle (displayed behind the widget at top-left) + title (at the top of the `window') + prompt text (just below the title and above whatever widget you choose) + Depending on widget, _one_ of the following: - menu list - radio list - check list - text input box with initial text - [Xdialog(1)] 2x or 3x text input boxes - [dialog(1)] a multi-part form - progress bar - etc. (many more widget choices) + buttons (right below the selected widget) + [dialog(1)] the hline (displayed at bottom of `window') NOTE: Xdialog(1) accepts and silently ignores --hline When building local arguments for your dialog invocation, if the value can't be cleanly loaded into a local, add "# Calculated below" to the end of the local declaration while retaining the block order of argument declarations. Move other local declarations that are not associated with this top-loading the dialog arguments to right-above where they are first-used. Also, standardize on the names of the arguments. For example, always use $prompt (instead of sometimes $msg and sometimes $prompt); use $menu_list or $shell_list or $radio_list for those respective widgets; ad nauseum. While we're doing this, flush-out full arguments for many invocations that were passing NULL strings (making it unapparent if you were staring at this one invocation what argument that NULL string was supposed to represent). Last, while we're in startup/rcconf let's remove the unnecessary use of a GLOBAL (RCCONF_MENU_LIST) for the menu_list. Modified: head/usr.sbin/bsdconfig/bsdconfig head/usr.sbin/bsdconfig/console/console head/usr.sbin/bsdconfig/console/font head/usr.sbin/bsdconfig/console/keymap head/usr.sbin/bsdconfig/console/repeat head/usr.sbin/bsdconfig/console/saver head/usr.sbin/bsdconfig/console/screenmap head/usr.sbin/bsdconfig/console/ttys head/usr.sbin/bsdconfig/mouse/mouse head/usr.sbin/bsdconfig/mouse/port head/usr.sbin/bsdconfig/mouse/type head/usr.sbin/bsdconfig/networking/networking head/usr.sbin/bsdconfig/networking/share/resolv.subr head/usr.sbin/bsdconfig/password/share/password.subr head/usr.sbin/bsdconfig/security/kern_securelevel head/usr.sbin/bsdconfig/security/security head/usr.sbin/bsdconfig/share/media/any.subr head/usr.sbin/bsdconfig/share/media/ftp.subr head/usr.sbin/bsdconfig/share/media/options.subr head/usr.sbin/bsdconfig/share/mustberoot.subr head/usr.sbin/bsdconfig/share/packages/packages.subr head/usr.sbin/bsdconfig/startup/misc head/usr.sbin/bsdconfig/startup/rcadd head/usr.sbin/bsdconfig/startup/rcconf head/usr.sbin/bsdconfig/startup/rcdelete head/usr.sbin/bsdconfig/startup/rcvar head/usr.sbin/bsdconfig/startup/share/rcconf.subr head/usr.sbin/bsdconfig/startup/startup head/usr.sbin/bsdconfig/timezone/timezone head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr head/usr.sbin/bsdconfig/usermgmt/usermgmt Modified: head/usr.sbin/bsdconfig/bsdconfig ============================================================================== --- head/usr.sbin/bsdconfig/bsdconfig Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/bsdconfig Sun Jun 2 20:02:50 2013 (r251264) @@ -50,7 +50,8 @@ USAGE_HELPFILE=$BSDCFG_LIBE/include/usag # usage() { - local index="INDEX" cmd_list="" + local index="INDEX" + local cmd_list # Calculated below cd $BSDCFG_LIBE # No need to preserve CWD (headed toward exit) @@ -145,13 +146,12 @@ dialog_menu_main() local title="$DIALOG_TITLE" local btitle="$DIALOG_BACKTITLE" local prompt="$msg_menu_text" - local menu_list - local defaultitem= # Calculated below - - menu_list=" + local menu_list=" 'X' '$msg_exit' '$msg_exit_bsdconfig' '1' '$msg_usage' '$msg_quick_start_how_to_use_this_menu_system' " # END-QUOTE + local defaultitem= # Calculated below + local hline= local sanitize_awk="{ gsub(/'/, \"'\\\\''\"); print }" @@ -185,7 +185,7 @@ dialog_menu_main() \"\$title\" \ \"\$btitle\" \ \"\$prompt\" \ - \"\" \ + \"\$hline\" \ $menu_list # Obtain default-item from previously stored selection @@ -196,6 +196,7 @@ dialog_menu_main() --clear \ --title \"\$title\" \ --backtitle \"\$btitle\" \ + --hline \"\$hline\" \ --item-help \ --ok-label \"\$msg_ok\" \ --cancel-label \"\$msg_exit_bsdconfig\" \ Modified: head/usr.sbin/bsdconfig/console/console ============================================================================== --- head/usr.sbin/bsdconfig/console/console Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/console/console Sun Jun 2 20:02:50 2013 (r251264) @@ -48,12 +48,8 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_ # dialog_menu_main() { - local menu_list - local hline="$hline_configure_system_console_settings" local prompt="$msg_console_menu_text" - local defaultitem= # Calculated below - - menu_list=" + local menu_list=" 'X $msg_exit' '$msg_exit_this_menu' '2 $msg_font' '$msg_choose_alternate_screen_font' '3 $msg_keymap' '$msg_choose_alternate_keyboard_map' @@ -62,6 +58,8 @@ dialog_menu_main() '6 $msg_screenmap' '$msg_choose_alternate_screenmap' '7 $msg_ttys' '$msg_choose_console_terminal_type' " # END-QUOTE + local defaultitem= # Calculated below + local hline="$hline_configure_system_console_settings" local height width rows eval f_dialog_menu_size height width rows \ Modified: head/usr.sbin/bsdconfig/console/font ============================================================================== --- head/usr.sbin/bsdconfig/console/font Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/console/font Sun Jun 2 20:02:50 2013 (r251264) @@ -49,11 +49,8 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_ # dialog_menu_main() { - local menu_list defaultitem= - local hline="$hline_choose_a_font" local prompt="$msg_font_menu_text" - - menu_list=" + local menu_list=" '1 $msg_none' '$msg_use_hardware_default_font' '2 $msg_ibm_437' '$msg_ibm_437_desc' '3 $msg_ibm_850' '$msg_ibm_850_desc' @@ -69,6 +66,8 @@ dialog_menu_main() 'd $msg_iso_8859_15' '$msg_iso_8859_15_desc' 'e $msg_swiss' '$msg_swiss_desc' " # END-QUOTE + local defaultitem= # Calculated below + local hline="$hline_choose_a_font" local height width rows eval f_dialog_menu_size height width rows \ Modified: head/usr.sbin/bsdconfig/console/keymap ============================================================================== --- head/usr.sbin/bsdconfig/console/keymap Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/console/keymap Sun Jun 2 20:02:50 2013 (r251264) @@ -77,9 +77,9 @@ KEYMAP_NAMES=" # dialog_menu_main() { - local menu_list defaultitem= - local hline="$hline_choose_a_keyboard_map" local prompt="$msg_keymap_menu_text" + local menu_list defaultitem= # Calculated below + local hline="$hline_choose_a_keyboard_map" # # Export variables for awk(1) ENVIRON visibility Modified: head/usr.sbin/bsdconfig/console/repeat ============================================================================== --- head/usr.sbin/bsdconfig/console/repeat Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/console/repeat Sun Jun 2 20:02:50 2013 (r251264) @@ -49,16 +49,15 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_ # dialog_menu_main() { - local menu_list defaultitem= - local hline="$hline_choose_a_keyboard_repeat_rate" local prompt="$msg_repeat_menu_text" - - menu_list=" + local menu_list=" '$msg_default' '$msg_default_desc' '$msg_slow' '$msg_slow_desc' '$msg_normal' '$msg_normal_desc' '$msg_fast' '$msg_fast_desc' " # END-QUOTE + local defaultitem= # Calculated below + local hline="$hline_choose_a_keyboard_repeat_rate" local height width rows eval f_dialog_menu_size height width rows \ Modified: head/usr.sbin/bsdconfig/console/saver ============================================================================== --- head/usr.sbin/bsdconfig/console/saver Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/console/saver Sun Jun 2 20:02:50 2013 (r251264) @@ -49,11 +49,8 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_ # dialog_menu_main() { - local menu_list defaultitem= - local hline="$hline_choose_a_screen_saver" local prompt="$msg_saver_menu_text" - - menu_list=" + local menu_list=" '1 $msg_blank' '$msg_blank_desc' '2 $msg_beastie' '$msg_beastie_desc' '3 $msg_daemon' '$msg_daemon_desc' @@ -69,6 +66,8 @@ dialog_menu_main() 'd $msg_none' '$msg_none_saver_desc' '$msg_timeout' '$msg_timeout_desc' " # END-QUOTE + local defaultitem= # Calculated below + local hline="$hline_choose_a_screen_saver" local height width rows eval f_dialog_menu_size height width rows \ Modified: head/usr.sbin/bsdconfig/console/screenmap ============================================================================== --- head/usr.sbin/bsdconfig/console/screenmap Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/console/screenmap Sun Jun 2 20:02:50 2013 (r251264) @@ -49,11 +49,8 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_ # dialog_menu_main() { - local menu_list defaultitem= - local hline="$hline_choose_a_screen_map" local prompt="$msg_screenmap_menu_text" - - menu_list=" + local menu_list=" '1 $msg_none' '$msg_none_screenmap_desc' '2 $msg_iso_8859_1_to_ibm437' '$msg_iso_8859_1_to_ibm437_desc' '3 $msg_iso_8859_7_to_ibm437' '$msg_iso_8859_7_to_ibm437_desc' @@ -61,6 +58,8 @@ dialog_menu_main() '5 $msg_koi8_r_to_ibm866' '$msg_koi8_r_to_ibm866_desc' '6 $msg_koi8_u_to_ibm866u' '$msg_koi8_u_to_ibm866u_desc' " # END-QUOTE + local defaultitem= # Calculated below + local hline="$hline_choose_a_screen_map" local height width rows eval f_dialog_menu_size height width rows \ Modified: head/usr.sbin/bsdconfig/console/ttys ============================================================================== --- head/usr.sbin/bsdconfig/console/ttys Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/console/ttys Sun Jun 2 20:02:50 2013 (r251264) @@ -72,8 +72,8 @@ TTY_MENU_LIST=" # dialog_menu_main() { - local hline="$hline_choose_a_terminal_type" local prompt="$msg_ttys_menu_text" + local hline="$hline_choose_a_terminal_type" local height width rows eval f_dialog_menu_size height width rows \ Modified: head/usr.sbin/bsdconfig/mouse/mouse ============================================================================== --- head/usr.sbin/bsdconfig/mouse/mouse Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/mouse/mouse Sun Jun 2 20:02:50 2013 (r251264) @@ -48,12 +48,8 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_ # dialog_menu_main() { - local menu_list - local hline="" local prompt="$msg_menu_text" - local defaultitem= # Calculated below - - menu_list=" + local menu_list=" 'X $msg_exit' '$msg_exit_this_menu' '2 $msg_enable' '$msg_test_and_run_the_mouse_daemon' '3 $msg_type' '$msg_select_mouse_protocol_type' @@ -61,6 +57,8 @@ dialog_menu_main() '5 $msg_flags' '$msg_set_additional_flags' '6 $msg_disable' '$msg_disable_the_mouse_daemon' " # END-QUOTE + local defaultitem= # Calculated below + local hline= local height width rows eval f_dialog_menu_size height width rows \ Modified: head/usr.sbin/bsdconfig/mouse/port ============================================================================== --- head/usr.sbin/bsdconfig/mouse/port Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/mouse/port Sun Jun 2 20:02:50 2013 (r251264) @@ -49,11 +49,8 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_ # dialog_menu_main() { - local menu_list defaultitem= - local hline="" local prompt="$msg_port_menu_text" - - menu_list=" + local menu_list=" '1 $msg_ps2' '$msg_ps2_desc' '2 $msg_com1' '$msg_com1_desc' '3 $msg_com2' '$msg_com2_desc' @@ -61,6 +58,8 @@ dialog_menu_main() '5 $msg_com4' '$msg_com4_desc' '6 $msg_busmouse' '$msg_busmouse_desc' " # END-QUOTE + local defaultitem= # Calculated below + local hline= local height width rows eval f_dialog_menu_size height width rows \ Modified: head/usr.sbin/bsdconfig/mouse/type ============================================================================== --- head/usr.sbin/bsdconfig/mouse/type Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/mouse/type Sun Jun 2 20:02:50 2013 (r251264) @@ -49,11 +49,8 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_ # dialog_menu_main() { - local menu_list defaultitem= - local hline="" local prompt="$msg_protocol_menu_text" - - menu_list=" + local menu_list=" '1 $msg_auto' '$msg_auto_desc' '2 $msg_glidepoint' '$msg_glidepoint_desc' '3 $msg_hitachi' '$msg_hitachi_desc' @@ -65,6 +62,8 @@ dialog_menu_main() '9 $msg_mousesystems' '$msg_mousesystems_desc' 'A $msg_thinkingmouse' '$msg_thinkingmouse_desc' " # END-QUOTE + local defaultitem= # Calculated below + local hline= local height width rows eval f_dialog_menu_size height width rows \ Modified: head/usr.sbin/bsdconfig/networking/networking ============================================================================== --- head/usr.sbin/bsdconfig/networking/networking Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/networking/networking Sun Jun 2 20:02:50 2013 (r251264) @@ -48,23 +48,22 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_ # dialog_menu_main() { - local menu_list - local hline="$hline_arrows_tab_enter" - local defaultitem= # Calculated below - - menu_list=" + local prompt= + local menu_list=" 'X' '$msg_exit' '1' '$msg_hostname_domain' '2' '$msg_network_interfaces' '3' '$msg_default_router' '4' '$msg_dns_nameservers' " # END-QUOTE + local defaultitem= # Calculated below + local hline="$hline_arrows_tab_enter" local height width rows eval f_dialog_menu_size height width rows \ \"\$DIALOG_TITLE\" \ \"\$DIALOG_BACKTITLE\" \ - \"\" \ + \"\$prompt\" \ \"\$hline\" \ $menu_list @@ -79,7 +78,7 @@ dialog_menu_main() --ok-label \"\$msg_ok\" \ --cancel-label \"\$msg_cancel\" \ --default-item \"\$defaultitem\" \ - --menu \"\" \ + --menu \"\$prompt\" \ $height $width $rows \ $menu_list \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD Modified: head/usr.sbin/bsdconfig/networking/share/resolv.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/share/resolv.subr Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/networking/share/resolv.subr Sun Jun 2 20:02:50 2013 (r251264) @@ -392,23 +392,24 @@ f_dialog_input_nameserver() # f_dialog_menu_nameservers() { + local prompt="$msg_dns_configuration" + local menu_list # Calculated below + local hline="$hline_arrows_tab_enter" + local defaultitem= local height width rows local opt_exit="$msg_return_to_previous_menu" local opt_add="$msg_add_nameserver" - local hline="$hline_arrows_tab_enter" - local prompt defaultitem= # # Loop forever until the user has finished configuring nameservers # - prompt="$msg_dns_configuration" while :; do # # Re/Build list of nameservers # local nameservers="$( f_resolv_conf_nameservers )" - local menu_list="$( + menu_list=$( index=1 echo "'X $msg_exit' '$opt_exit'" @@ -423,7 +424,7 @@ f_dialog_menu_nameservers() echo "'$tag nameserver' '$ns'" index=$(( $index + 1 )) done - )" + ) # # Display configuration-edit menu Modified: head/usr.sbin/bsdconfig/password/share/password.subr ============================================================================== --- head/usr.sbin/bsdconfig/password/share/password.subr Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/password/share/password.subr Sun Jun 2 20:02:50 2013 (r251264) @@ -45,24 +45,23 @@ f_include_lang $BSDCFG_LIBE/$APP_DIR/inc # f_dialog_input_password() { + local prompt1="$msg_enter_new_password" + local prompt2="$msg_reenter_password" local hline="$hline_alnum_punc_tab_enter" - local msg rmsg - msg=$( printf "$msg_enter_new_password" ) local height1 width1 f_dialog_inputbox_size height1 width1 \ "$DIALOG_TITLE" \ "$DIALOG_BACKTITLE" \ - "$msg" \ + "$prompt1" \ "" \ "$hline" - rmsg=$( printf "$msg_reenter_password" ) local height2 width2 f_dialog_inputbox_size height2 width2 \ "$DIALOG_TITLE" \ "$DIALOG_BACKTITLE" \ - "$rmsg" \ + "$prompt2" \ "" \ "$hline" @@ -78,7 +77,7 @@ f_dialog_input_password() --ok-label "$msg_ok" \ --cancel-label "$msg_cancel" \ --insecure \ - --passwordbox "$msg" \ + --passwordbox "$prompt1" \ $height1 $width1 \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) || return $? @@ -92,7 +91,7 @@ f_dialog_input_password() --ok-label "$msg_ok" \ --cancel-label "$msg_cancel" \ --insecure \ - --passwordbox "$rmsg" \ + --passwordbox "$prompt2" \ $height2 $width2 \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) || return $? Modified: head/usr.sbin/bsdconfig/security/kern_securelevel ============================================================================== --- head/usr.sbin/bsdconfig/security/kern_securelevel Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/security/kern_securelevel Sun Jun 2 20:02:50 2013 (r251264) @@ -51,16 +51,15 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_ # dialog_menu_main() { - local menu_list defaultitem= - local hline="$hline_select_securelevel_to_operate_at" local prompt="$msg_securelevels_menu_text" - - menu_list=" + local menu_list=" '$msg_disabled' '$msg_disable_securelevels' '$msg_secure' '$msg_secure_mode' '$msg_highly_secure' '$msg_highly_secure_mode' '$msg_network_secure' '$msg_network_secure_mode' " # END-QUOTE + local defaultitem= # Calculated below + local hline="$hline_select_securelevel_to_operate_at" local height width rows eval f_dialog_menu_size height width rows \ Modified: head/usr.sbin/bsdconfig/security/security ============================================================================== --- head/usr.sbin/bsdconfig/security/security Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/security/security Sun Jun 2 20:02:50 2013 (r251264) @@ -49,21 +49,21 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_ # dialog_menu_main() { - local menu_list mark=" " defaultitem= - local hline="$hline_arrows_tab_enter" local prompt="$msg_menu_text" + local menu_list=" + 'X <<< $msg_exit' '$msg_exit_this_menu' + " # END-QUOTE + local defaultitem= # Calculated below + local hline="$hline_arrows_tab_enter" # Obtain default-item (adjusted below for dynamic tags) f_dialog_default_fetch defaultitem local ditem="${defaultitem%%[$IFS]*}" - menu_list=" - 'X <<< $msg_exit' '$msg_exit_this_menu' - " # END-QUOTE - # # Add dynamically tagged entry for kern_securelevels # + local mark=" " case "$( f_sysrc_get kern_securelevel_enable )" in [Yy][Ee][Ss]) local kern_securelevel="$( f_sysrc_get kern_securelevel )" Modified: head/usr.sbin/bsdconfig/share/media/any.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/media/any.subr Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/share/media/any.subr Sun Jun 2 20:02:50 2013 (r251264) @@ -68,10 +68,7 @@ f_media_get_type() local title="$DIALOG_TITLE" btitle="$DIALOG_BACKTITLE" f_dialog_title_restore local prompt="$msg_choose_installation_media_description" - local hline="$hline_choose_help_for_more_information_on_media_types" - local menu_list - - menu_list=" + local menu_list=" '1 $msg_cd_dvd' '$msg_install_from_a_freebsd_cd_dvd' '2 $msg_ftp' '$msg_install_from_an_ftp_server' '3 $msg_ftp_passive' @@ -85,6 +82,7 @@ f_media_get_type() 'A $msg_usb' '$msg_install_from_a_usb_drive' 'X $msg_options' '$msg_view_set_various_media_options' " # END-QUOTE + local hline="$hline_choose_help_for_more_information_on_media_types" local height width rows eval f_dialog_menu_size height width rows \ Modified: head/usr.sbin/bsdconfig/share/media/ftp.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/media/ftp.subr Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/share/media/ftp.subr Sun Jun 2 20:02:50 2013 (r251264) @@ -72,9 +72,7 @@ f_dialog_menu_media_ftp() f_dialog_title "$msg_please_select_a_freebsd_ftp_distribution_site" local title="$DIALOG_TITLE" btitle="$DIALOG_BACKTITLE" f_dialog_title_restore - local prompt="$msg_please_select_the_site_closest_to_you_or_other" - local hline="$msg_select_a_site_thats_close" local menu_list=" '$msg_main_site' 'ftp.freebsd.org' 'URL' '$msg_specify_some_other_ftp_site' @@ -228,6 +226,7 @@ f_dialog_menu_media_ftp() ' $msg_usa #14' 'ftp14.us.freebsd.org' ' $msg_usa #15' 'ftp15.us.freebsd.org' " # END-QUOTE + local hline="$msg_select_a_site_thats_close" local height width rows eval f_dialog_menu_size height width rows \ Modified: head/usr.sbin/bsdconfig/share/media/options.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/media/options.subr Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/share/media/options.subr Sun Jun 2 20:02:50 2013 (r251264) @@ -53,9 +53,10 @@ f_media_options_menu() f_dialog_title "$msg_options_editor" local title="$DIALOG_TITLE" btitle="$DIALOG_BACKTITLE" f_dialog_title_restore - local prompt="" + local prompt= + local menu_list # Calculated below + local defaultitem= local hline="$hline_arrows_tab_enter" - local menu_list cp # # A hack so that the dialogs below are always interactive in a script @@ -66,7 +67,7 @@ f_media_options_menu() unset $VAR_NONINTERACTIVE fi - local defaultitem= + local cp while :; do menu_list="" Modified: head/usr.sbin/bsdconfig/share/mustberoot.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/mustberoot.subr Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/share/mustberoot.subr Sun Jun 2 20:02:50 2013 (r251264) @@ -77,7 +77,7 @@ SECURE_DIVULGE_UNKNOWN_USER= # f_become_root_via_sudo() { - local msg hline height width rows + local prompt hline height width rows msg [ "$( id -u )" = "0" ] && return $SUCCESS @@ -90,18 +90,19 @@ f_become_root_via_sudo() # local checkpath="${HOME%/}/.bsdconfig_uses_sudo" if [ ! -e "$checkpath" ]; then + prompt=$( printf "$msg_you_are_not_root_but" bsdconfig ) msg=$( printf "$msg_always_try_sudo_when_run_as" "$USER" ) local menu_list=" 'X' '$msg_cancel_exit' '1' '$msg' '2' '$msg_try_sudo_only_this_once' " # END-QUOTE - msg=$( printf "$msg_you_are_not_root_but" bsdconfig ) hline="$hline_arrows_tab_enter" + eval f_dialog_menu_size height width rows \ \"\$DIALOG_TITLE\" \ \"\$DIALOG_BACKTITLE\" \ - \"\$msg\" \ + \"\$prompt\" \ \"\$hline\" \ $menu_list @@ -112,7 +113,7 @@ f_become_root_via_sudo() --hline \"\$hline\" \ --ok-label \"\$msg_ok\" \ --cancel-label \"\$msg_cancel\" \ - --menu \"\$msg\" \ + --menu \"\$prompt\" \ $height $width $rows \ $menu_list \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD @@ -147,12 +148,12 @@ f_become_root_via_sudo() # # sudo(8) access denied. Prompt for their password. # - msg="$msg_please_enter_password" + prompt="$msg_please_enter_password" hline="$hline_alnum_punc_tab_enter" f_dialog_inputbox_size height width \ "$DIALOG_TITLE" \ "$DIALOG_BACKTITLE" \ - "$msg" \ + "$prompt" \ "$hline" # @@ -168,7 +169,7 @@ f_become_root_via_sudo() --hline "$hline" \ --ok-label "$msg_ok" \ --cancel-label "$msg_cancel" \ - --password --inputbox "$msg" \ + --password --inputbox "$prompt" \ $height $width \ 2>&1 > /dev/null ) retval=$? @@ -184,7 +185,7 @@ f_become_root_via_sudo() --ok-label "$msg_ok" \ --cancel-label "$msg_cancel" \ --insecure \ - --passwordbox "$msg" \ + --passwordbox "$prompt" \ $height $width \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) || exit $? Modified: head/usr.sbin/bsdconfig/share/packages/packages.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/packages/packages.subr Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/share/packages/packages.subr Sun Jun 2 20:02:50 2013 (r251264) @@ -277,25 +277,26 @@ f_package_calculate_rundeps() # f_package_menu_categories() { - local var_to_get="$1" defaultitem="$2" category_list menu_list + local var_to_get="$1" defaultitem="$2" + local prompt="$msg_please_select_a_category_to_display" + local menu_list=" + '> $msg_review' '$msg_review_desc' '$msg_review_help' + " # End-Quote + local hline= f_package_calculate_rundeps # updates package mark variables and SELECTED_PACKAGES f_package_calculate_totals # creates _{varcat}_ninstalled and _{varcat}_nselected + local category_list debug= f_getvar "$var_to_get" category_list || return $FAILURE # Accent the category menu list with ninstalled/nselected eval f_package_accent_category_menu category_list $category_list - local prompt="$msg_please_select_a_category_to_display" - local hline="" - - menu_list=" - '> $msg_review' '$msg_review_desc' '$msg_review_help' - $category_list - " # End-Quote + # Add list of categories to menu list + menu_list="$menu_list $category_list" local height width rows eval f_dialog_menu_with_help_size height width rows \ @@ -365,22 +366,26 @@ f_package_index_get_page() # f_package_menu_select() { - local category="$1" page="${2:-1}" defaultitem="$3" - local varcat npkgs=0 npages menu_list + local category="$1" page="${2:-1}" + local prompt= # Calculated below + local menu_list # Calculated below + local defaultitem="$3" + local hline="$hline_arrows_tab_punc_enter" f_isinteger "$page" || return $FAILURE + local varcat f_str2varname "$category" varcat - f_package_index_get_page "$category" $page index_page # Get number of packages for this category + local npkgs=0 case "$category" in "$msg_all"|"") npkgs="${_npkgs:-0}";; *) f_getvar _npkgs_$varcat npkgs esac # Calculate number of pages - npages=$(( ${npkgs:=0} / $PACKAGE_MENU_PAGESIZE )) + local npages=$(( ${npkgs:=0} / $PACKAGE_MENU_PAGESIZE )) # Add a page to the pagecount if not evenly divisible [ $(( $npages * $PACKAGE_MENU_PAGESIZE )) -lt $npkgs ] && @@ -407,6 +412,9 @@ f_package_menu_select() next_page="$next_page*" fi + local index_page + f_package_index_get_page "$category" $page index_page + menu_list=" ${add_prev:+'> $previous_page' '' ${SHOW_DESC:+''}} ${add_next:+'> $next_page' '' ${SHOW_DESC:+''}} @@ -446,7 +454,6 @@ f_package_menu_select() ${add_next:+'> $next_page' '' ${SHOW_DESC:+''}} " # End-Quote - local prompt="" # Accept/Translate i18n "All" but other category names must # match tree definitions from INDEX, ports, FTP, etc. case "$category" in @@ -456,7 +463,6 @@ f_package_menu_select() prompt="$prompt $( printf "$msg_page_of_npages" \ "$page" "$npages" )" - local hline="$hline_arrows_tab_punc_enter" local mheight mwidth mrows f_dialog_menu${SHOW_DESC:+_with_help}_size mheight mwidth mrows \ \"\$DIALOG_TITLE\" \"\$DIALOG_BACKTITLE\" \ @@ -509,14 +515,16 @@ f_package_menu_select() # f_package_menu_deselect() { - local package="$1" prompt menu_list - prompt=$( printf "$msg_what_would_you_like_to_do_with" "$package" ) - local hline="$hline_alnum_arrows_punc_tab_enter" - menu_list=" + local package="$1" + local prompt # Calculated below + local menu_list=" 'X $msg_installed' '$msg_installed_desc' 'R $msg_reinstall' '$msg_reinstall_desc' 'U $msg_uninstall' '$msg_uninstall_desc' " # End-Quote + local hline="$hline_alnum_arrows_punc_tab_enter" + + prompt=$( printf "$msg_what_would_you_like_to_do_with" "$package" ) local height width rows eval f_dialog_menu_size height width rows \ @@ -551,12 +559,16 @@ f_package_menu_deselect() # f_package_review() { - local prompt package varpkg mark menu_list= - prompt=$( printf "$msg_reviewing_selected_packages" \ - "$_All_nselected" ) + local prompt # Calculated below + local menu_list # Calculated below local hline="$hline_alnum_arrows_punc_tab_enter" + f_dprintf "f_package_review: SELECTED_PACKAGES=[%s]" \ "$SELECTED_PACKAGES" + + prompt=$( printf "$msg_reviewing_selected_packages" "$_All_nselected" ) + + local package varpkg mark for package in $SELECTED_PACKAGES; do mark= f_str2varname "$package" varpkg Modified: head/usr.sbin/bsdconfig/startup/misc ============================================================================== --- head/usr.sbin/bsdconfig/startup/misc Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/startup/misc Sun Jun 2 20:02:50 2013 (r251264) @@ -56,19 +56,14 @@ UNAME_P=$( uname -p ) # Processor Archit # dialog_menu_main() { - local menu_list var_list defaultitem= - local hline="$hline_arrows_tab_enter" local prompt="$msg_miscellaneous_menu_text" - - # Obtain default-item (adjusted below for dynamic tags) - f_dialog_default_fetch defaultitem - local ditem="${defaultitem%%[$IFS]*}" - - menu_list=" + local menu_list=" 'X <<< $msg_exit' '$msg_exit_this_menu' " # END-QUOTE + local defaultitem= # Calculated below + local hline="$hline_arrows_tab_enter" - var_list=" + local var_list=" accounting_enable local_startup lpd_enable @@ -88,6 +83,10 @@ dialog_menu_main() " # END-QUOTE fi + # Obtain default-item (adjusted below for dynamic tags) + f_dialog_default_fetch defaultitem + local ditem="${defaultitem%%[$IFS]*}" + eval "$( . "$RC_DEFAULTS" source_rc_confs Modified: head/usr.sbin/bsdconfig/startup/rcadd ============================================================================== --- head/usr.sbin/bsdconfig/startup/rcadd Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/startup/rcadd Sun Jun 2 20:02:50 2013 (r251264) @@ -57,14 +57,12 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_ # dialog_menu_main() { - local menu_list - local hline="$hline_arrows_tab_enter" - local prompt="" - - menu_list=" + local prompt= + local menu_list=" '1' '$msg_add_from_list' '2' '$msg_add_custom' " # END-QUOTE + local hline="$hline_arrows_tab_enter" local height width rows eval f_dialog_menu_size height width rows \ Modified: head/usr.sbin/bsdconfig/startup/rcconf ============================================================================== --- head/usr.sbin/bsdconfig/startup/rcconf Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/startup/rcconf Sun Jun 2 20:02:50 2013 (r251264) @@ -49,7 +49,6 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_ # RCCONF_MAP= _RCCONF_MAP= -RCCONF_MENU_LIST= # # Options @@ -79,11 +78,8 @@ fi # dialog_menu_main() { - local hline="$hline_arrows_tab_enter" - local prompt="" - local defaultitem= # Calculated below - - RCCONF_MENU_LIST=" + local prompt= + local menu_list=" 'X $msg_exit' '$msg_exit_desc' ${SHOW_DESC:+'$msg_exit_help'} '> $msg_add_new' '$msg_add_new_desc' @@ -95,6 +91,8 @@ dialog_menu_main() ${SHOW_DESC:+'$msg_view_details_help'} } " # END-QUOTE + local defaultitem= # Calculated below + local hline="$hline_arrows_tab_enter" if [ ! "$_RCCONF_MAP" ]; then # Genreate RCCONF_MAP of `var desc ...' per-line @@ -110,7 +108,7 @@ dialog_menu_main() [ "$SHOW_DEFAULT_VALUE" -o "$SHOW_CONFIGURED" ] && f_dialog_info "$msg_creating_menu_list" - RCCONF_MENU_LIST="$RCCONF_MENU_LIST $( + menu_list="$menu_list $( . "$RC_DEFAULTS" > /dev/null source_rc_confs > /dev/null var_list=$( f_startup_rcconf_list ) @@ -169,7 +167,7 @@ dialog_menu_main() \"\$DIALOG_BACKTITLE\" \ \"\$prompt\" \ \"\$hline\" \ - $RCCONF_MENU_LIST + $menu_list # Obtain default-item from previously stored selection f_dialog_default_fetch defaultitem @@ -187,7 +185,7 @@ dialog_menu_main() --default-item \"\$defaultitem\" \ --menu \"\$prompt\" \ $height $width $rows \ - $RCCONF_MENU_LIST \ + $menu_list \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) local retval=$? Modified: head/usr.sbin/bsdconfig/startup/rcdelete ============================================================================== --- head/usr.sbin/bsdconfig/startup/rcdelete Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/startup/rcdelete Sun Jun 2 20:02:50 2013 (r251264) @@ -146,9 +146,23 @@ dialog_create_main() # dialog_menu_main() { - local hline="$hline_arrows_tab_enter" - local prompt="" + local prompt= + local menu_list=" + 'X $msg_exit_cancel' '$msg_exit_cancel_desc' + ${SHOW_DESC:+'$msg_exit_cancel_help'} + '> $msg_delete_selected' '$msg_delete_selected_desc' + ${SHOW_DESC:+'$msg_delete_selected_help'} + '> $msg_all' '$msg_all_desc' + ${SHOW_DESC:+'$msg_all_help'} + '> $msg_none' '$msg_none_desc' + ${SHOW_DESC:+'$msg_none_help'} + ${USE_XDIALOG:+ + '> $msg_view_details' '$msg_view_details_desc' + ${SHOW_DESC:+'$msg_view_details_help'} + } + " # END-QUOTE local defaultitem= # Calculated below + local hline="$hline_arrows_tab_enter" # # [Re-]Accent the menu list before incorporating it @@ -178,22 +192,7 @@ dialog_menu_main() menu_buf="$menu_buf '$rcconf_var' '$details' ${SHOW_DESC:+'$help'}" # End-Quote done - - local menu_list=" - 'X $msg_exit_cancel' '$msg_exit_cancel_desc' - ${SHOW_DESC:+'$msg_exit_cancel_help'} - '> $msg_delete_selected' '$msg_delete_selected_desc' - ${SHOW_DESC:+'$msg_delete_selected_help'} - '> $msg_all' '$msg_all_desc' - ${SHOW_DESC:+'$msg_all_help'} - '> $msg_none' '$msg_none_desc' - ${SHOW_DESC:+'$msg_none_help'} - ${USE_XDIALOG:+ - '> $msg_view_details' '$msg_view_details_desc' - ${SHOW_DESC:+'$msg_view_details_help'} - } - $menu_buf - " # END-QUOTE + menu_list="$menu_list $menu_buf" set -f # noglob (descriptions in $RCCONF_MENU_LIST may contain *) @@ -244,9 +243,9 @@ dialog_menu_main() # dialog_menu_confirm_delete() { - local hline="$hline_arrows_tab_enter" local prompt="$msg_are_you_sure_you_want_delete_the_following" - local var_list menu_list + local menu_list # Calculated below + local hline="$hline_arrows_tab_enter" [ $# -ge 1 ] || return $FAILURE @@ -255,6 +254,7 @@ dialog_menu_confirm_delete() return $? fi + local var_list var_list=$( for var in $*; do echo "$var"; done | sort -u ) menu_list=$( . "$RC_DEFAULTS" Modified: head/usr.sbin/bsdconfig/startup/rcvar ============================================================================== --- head/usr.sbin/bsdconfig/startup/rcvar Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/startup/rcvar Sun Jun 2 20:02:50 2013 (r251264) @@ -65,8 +65,8 @@ RCVAR_MENU_LIST= # dialog_menu_main() { + local prompt= local hline="$hline_arrows_tab_enter" - local prompt="" local defaultitem= # Calculated below RCVAR_MENU_LIST=" Modified: head/usr.sbin/bsdconfig/startup/share/rcconf.subr ============================================================================== --- head/usr.sbin/bsdconfig/startup/share/rcconf.subr Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/startup/share/rcconf.subr Sun Jun 2 20:02:50 2013 (r251264) @@ -273,15 +273,16 @@ f_startup_rcconf_map_expand() # f_dialog_input_view_details() { - local menu_list + local prompt= + local menu_list # calculated below + local defaultitem= # calculated below local hline="$hline_arrows_tab_enter" - local prompt="" local md=" " if [ "$SHOW_DESC" ]; then md="X" fi - local m1=" " m2=" " m3=" " defaultitem= + local m1=" " m2=" " m3=" " if [ "$SHOW_VALUE" ]; then m1="*" defaultitem="1 ($m1) $msg_show_value" @@ -367,13 +368,11 @@ f_dialog_input_view_details() # f_dialog_input_rclist() { - local hline="$hline_arrows_tab_enter" local prompt="$msg_please_select_an_rcconf_directive" - local menu_list - - menu_list=" + local menu_list=" 'X $msg_exit' '' ${SHOW_DESC:+'$msg_exit_help'} " # END-QUOTE + local hline="$hline_arrows_tab_enter" if [ ! "$_RCCONF_MAP" ]; then # Generate RCCONF_MAP of `var desc ...' per-line Modified: head/usr.sbin/bsdconfig/startup/startup ============================================================================== --- head/usr.sbin/bsdconfig/startup/startup Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/startup/startup Sun Jun 2 20:02:50 2013 (r251264) @@ -48,17 +48,15 @@ ipgm=$( f_index_menusel_keyword $BSDCFG_ # dialog_menu_main() { - local menu_list - local hline="$hline_arrows_tab_enter" - local prompt="" - local defaultitem= # Calculated below - - menu_list=" + local prompt= + local menu_list=" 'X' '$msg_exit' '1' '$msg_toggle_startup_services' '2' '$msg_view_edit_startup_configuration' '3' '$msg_miscellaneous_startup_services' " # END-QUOTE + local defaultitem= # Calculated below + local hline="$hline_arrows_tab_enter" local height width rows eval f_dialog_menu_size height width rows \ Modified: head/usr.sbin/bsdconfig/timezone/timezone ============================================================================== --- head/usr.sbin/bsdconfig/timezone/timezone Sun Jun 2 18:10:16 2013 (r251263) +++ head/usr.sbin/bsdconfig/timezone/timezone Sun Jun 2 20:02:50 2013 (r251264) @@ -84,13 +84,14 @@ dialog_menu_main() local btitle="$DIALOG_BACKTITLE" local prompt="$msg_select_region" local defaultitem= # Calculated below + local hline= local height width rows eval f_dialog_menu_size height width rows \ \"\$title\" \ \"\$btitle\" \ \"\$prompt\" \ - \"\" \ + \"\$hline\" \ $continent_menu_list *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201306022002.r52K2oZ3024839>