From owner-svn-src-head@FreeBSD.ORG Sat Jun 8 19:13:50 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BCD9B9A5; Sat, 8 Jun 2013 19:13:50 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9D6A110AA; Sat, 8 Jun 2013 19:13:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r58JDos0075320; Sat, 8 Jun 2013 19:13:50 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r58JDn6q075315; Sat, 8 Jun 2013 19:13:49 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306081913.r58JDn6q075315@svn.freebsd.org> From: Devin Teske Date: Sat, 8 Jun 2013 19:13:49 +0000 (UTC) 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 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 19:13:50 -0000 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