Date: Sat, 8 Jun 2013 19:13:49 +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: r251549 - in head/usr.sbin/bsdconfig/usermgmt: . include Message-ID: <201306081913.r58JDn6q075315@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dteske Date: Sat Jun 8 19:13:49 2013 New Revision: 251549 URL: http://svnweb.freebsd.org/changeset/base/251549 Log: Add a prompt to the "Add User" and "Add Group" sub-menu items (under the "Login Management" module): Use default values for all account details? If you select "Yes" (the default is "No"), you'll jump past all the prompts and jump straight to the review screen with all-default values. Makes adding a lot of users/groups faster/easier if you don't need to customize more than one or two different values from their defaults. Modified: head/usr.sbin/bsdconfig/usermgmt/groupinput head/usr.sbin/bsdconfig/usermgmt/include/messages.subr head/usr.sbin/bsdconfig/usermgmt/userinput Modified: head/usr.sbin/bsdconfig/usermgmt/groupinput ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/groupinput Sat Jun 8 18:25:08 2013 (r251548) +++ head/usr.sbin/bsdconfig/usermgmt/groupinput Sat Jun 8 19:13:49 2013 (r251549) @@ -157,19 +157,27 @@ save_flag= hline="$hline_arrows_tab_enter" if [ "$mode" = "Add" ]; then - # - # Ask a series of questions to pre-fill the editor screen. - # - # The defaults used in each dialog should allow the user to simply - # hit ENTER to proceed, because cancelling a single dialog will - # cause them to be returned to the main groupmenu. - # - f_dialog_input_group_name || exit 0 - [ "$passwdtype" = "yes" ] && - { f_dialog_input_group_password || exit 0; } - f_dialog_input_group_gid || exit 0 - f_dialog_input_group_members || exit 0 + + f_dialog_noyes "$msg_use_default_values_for_all_account_details" + retval=$? + + if [ $retval -eq 255 ]; then # User pressed ESC + exit $SUCCESS + elif [ $retval -ne $SUCCESS ]; then + # + # Ask a series of questions to pre-fill the editor screen. + # + # The defaults used in each dialog should allow the user to + # simply hit ENTER to proceed, because cancelling a single + # dialog will cause them to be returned to the main groupmenu. + # + + [ "$passwdtype" = "yes" ] && + { f_dialog_input_group_password || exit 0; } + f_dialog_input_group_gid || exit 0 + f_dialog_input_group_members || exit 0 + fi fi if [ "$mode" = "Edit/View" -o "$mode" = "Delete" ]; then Modified: head/usr.sbin/bsdconfig/usermgmt/include/messages.subr ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/include/messages.subr Sat Jun 8 18:25:08 2013 (r251548) +++ head/usr.sbin/bsdconfig/usermgmt/include/messages.subr Sat Jun 8 19:13:49 2013 (r251549) @@ -105,6 +105,7 @@ msg_separated_by_commas="Separated by co msg_select_group_members_from_list="Select Group Members from a list" msg_select_login_shell="Select Login Shell" msg_shell="Shell" +msg_use_default_values_for_all_account_details="Use default values for all account details?" msg_user="User" msg_user_id="UID" msg_user_id_leave_empty_for_default="UID (Leave empty for default)" Modified: head/usr.sbin/bsdconfig/usermgmt/userinput ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/userinput Sat Jun 8 18:25:08 2013 (r251548) +++ head/usr.sbin/bsdconfig/usermgmt/userinput Sat Jun 8 19:13:49 2013 (r251549) @@ -238,32 +238,53 @@ save_flag= hline="$hline_arrows_tab_enter" if [ "$mode" = "Add" ]; then + f_dialog_input_name || exit 0 + # - # Ask a series of questions to pre-fill the editor screen. - # - # The defaults used in each dialog should allow the user to simply - # hit ENTER to proceed, because cancelling a single dialog will - # cause them to be returned to the main usermenu. + # Set some sensible defaults for account attributes # + pw_gecos="${pw_gecos-$pw_name}" + pw_home_dir="${pw_home_dir:-$homeprefix/$pw_name}" + if [ -d "$pw_home_dir" ]; then + pw_home_create="${pw_home_create:-$msg_no}" + pw_dotfiles_create="${pw_dotfiles_create:-$msg_no}" + else + pw_home_create="${pw_home_create:-$msg_yes}" + pw_dotfiles_create="${pw_dotfiles_create:-$msg_yes}" + fi + pw_shell="${pw_shell:-$defaultshell}" - f_dialog_input_name || exit 0 - f_dialog_input_gecos "$pw_name" || exit 0 - [ "$passwdtype" = "yes" ] && - { f_dialog_input_password || exit 0; } - f_dialog_input_uid || exit 0 - f_dialog_input_gid || exit 0 - f_dialog_input_member_groups || exit 0 - f_dialog_input_class || exit 0 - f_dialog_input_expire_password || exit 0 - f_dialog_input_expire_account || exit 0 - f_dialog_input_home_dir "$homeprefix/$pw_name" || exit 0 - pw_dotfiles_create="$msg_no" - if [ ! -d "$homeprefix/$pw_name" ]; then - f_dialog_input_home_create || exit 0 - [ "$pw_home_create" = "$msg_yes" ] && - { f_dialog_input_dotfiles_create || exit 0; } + f_dialog_noyes "$msg_use_default_values_for_all_account_details" + retval=$? + + if [ $retval -eq 255 ]; then # User pressed ESC + exit $SUCCESS + elif [ $retval -ne $SUCCESS ]; then + # + # Ask a series of questions to pre-fill the editor screen. + # + # The defaults used in each dialog should allow the user to + # simply hit ENTER to proceed, because cancelling a single + # dialog will cause them to be returned to the main usermenu. + # + + f_dialog_input_gecos "$pw_gecos" || exit 0 + [ "$passwdtype" = "yes" ] && + { f_dialog_input_password || exit 0; } + f_dialog_input_uid || exit 0 + f_dialog_input_gid || exit 0 + f_dialog_input_member_groups || exit 0 + f_dialog_input_class || exit 0 + f_dialog_input_expire_password || exit 0 + f_dialog_input_expire_account || exit 0 + f_dialog_input_home_dir "$pw_home_dir" || exit 0 + if [ ! -d "$pw_home_dir" ]; then + f_dialog_input_home_create || exit 0 + [ "$pw_home_create" = "$msg_yes" ] && + { f_dialog_input_dotfiles_create || exit 0; } + fi + f_dialog_input_shell "$pw_shell" || exit 0 fi - f_dialog_input_shell "$defaultshell" || exit 0 fi if [ "$mode" = "Edit/View" -o "$mode" = "Delete" ]; then
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201306081913.r58JDn6q075315>