svn commit: r251967 - in head/usr.sbin/bsdconfig: console console/include startup startup/include usermgmt usermgmt/include
Devin Teske
dteske at FreeBSD.org
Tue Jun 18 21:44:36 UTC 2013
Author: dteske
Date: Tue Jun 18 21:44:35 2013
New Revision: 251967
URL: http://svnweb.freebsd.org/changeset/base/251967
Log:
Perform some code consolidation and add some additional error
checking/reporting. (similar to SVN revisions 251919 and 251928)
Modified:
head/usr.sbin/bsdconfig/console/console
head/usr.sbin/bsdconfig/console/include/messages.subr
head/usr.sbin/bsdconfig/startup/include/messages.subr
head/usr.sbin/bsdconfig/startup/startup
head/usr.sbin/bsdconfig/usermgmt/include/messages.subr
head/usr.sbin/bsdconfig/usermgmt/usermgmt
Modified: head/usr.sbin/bsdconfig/console/console
==============================================================================
--- head/usr.sbin/bsdconfig/console/console Tue Jun 18 21:41:06 2013 (r251966)
+++ head/usr.sbin/bsdconfig/console/console Tue Jun 18 21:44:35 2013 (r251967)
@@ -121,21 +121,22 @@ while :; do
dialog_menu_main || f_die
f_dialog_menutag_fetch mtag
+ command=
case "$mtag" in
- "X $msg_exit") break ;;
- "2 $msg_font") # Choose an alternate screen font
- $BSDCFG_LIBE/$APP_DIR/font ${USE_XDIALOG:+-X} ;;
- "3 $msg_keymap") # Choose an alternate keyboard map
- $BSDCFG_LIBE/$APP_DIR/keymap ${USE_XDIALOG:+-X} ;;
- "4 $msg_repeat") # Set the rate at which keys repeat
- $BSDCFG_LIBE/$APP_DIR/repeat ${USE_XDIALOG:+-X} ;;
- "5 $msg_saver") # Configure the screen saver
- $BSDCFG_LIBE/$APP_DIR/saver ${USE_XDIALOG:+-X} ;;
- "6 $msg_screenmap") # Choose an alternate screenmap
- $BSDCFG_LIBE/$APP_DIR/screenmap ${USE_XDIALOG:+-X} ;;
- "7 $msg_ttys") # Choose console terminal type
- $BSDCFG_LIBE/$APP_DIR/ttys ${USE_XDIALOG:+-X} ;;
+ "X $msg_exit") break ;;
+ "2 $msg_font") command=font ;; # Choose alternate screen font
+ "3 $msg_keymap") command=keymap ;; # Choose alt. keyboard map
+ "4 $msg_repeat") command=repeat ;; # Set key repeat rate
+ "5 $msg_saver") command=saver ;; # Configure the screen saver
+ "6 $msg_screenmap") command=screenmap ;; # Choose alternate screenmap
+ "7 $msg_ttys") command=ttys ;; # Choose console terminal type
esac
+
+ if [ "$command" ]; then
+ $BSDCFG_LIBE/$APP_DIR/$command ${USE_XDIALOG:+-X} ;;
+ else
+ f_die 1 "$msg_unknown_console_menu_selection"
+ fi
done
exit $SUCCESS
Modified: head/usr.sbin/bsdconfig/console/include/messages.subr
==============================================================================
--- head/usr.sbin/bsdconfig/console/include/messages.subr Tue Jun 18 21:41:06 2013 (r251966)
+++ head/usr.sbin/bsdconfig/console/include/messages.subr Tue Jun 18 21:44:35 2013 (r251967)
@@ -241,6 +241,7 @@ msg_ukrainian_koi8_u="Ukranian KOI8-U"
msg_ukrainian_koi8_u_desc="Ukranian KOI8-U keymap"
msg_ukrainian_koi8_u_koi8_r="Ukranian KOI8-U+KOI8-R"
msg_ukrainian_koi8_u_koi8_r_desc="Ukranian KOI8-U+KOI8-R keymap (alter)"
+msg_unknown_console_menu_selection="Unknown console menu selection"
msg_unknown_font_selection="Unknown font selection"
msg_unknown_keymap="Unknown keymap"
msg_unknown_repeat_rate="Unknown repeat rate"
Modified: head/usr.sbin/bsdconfig/startup/include/messages.subr
==============================================================================
--- head/usr.sbin/bsdconfig/startup/include/messages.subr Tue Jun 18 21:41:06 2013 (r251966)
+++ head/usr.sbin/bsdconfig/startup/include/messages.subr Tue Jun 18 21:44:35 2013 (r251967)
@@ -104,6 +104,7 @@ msg_startup_dirs_desc="Set the list of d
msg_svr4="SVR4"
msg_svr4_desc="This host wants to be able to run SVR4 binaries."
msg_toggle_startup_services="Toggle Startup Services"
+msg_unknown_startup_menu_selection="Unknown startup menu selection"
msg_value_required="Value Required"
msg_view_details="View Details"
msg_view_details_desc="Choose view details"
Modified: head/usr.sbin/bsdconfig/startup/startup
==============================================================================
--- head/usr.sbin/bsdconfig/startup/startup Tue Jun 18 21:41:06 2013 (r251966)
+++ head/usr.sbin/bsdconfig/startup/startup Tue Jun 18 21:44:35 2013 (r251967)
@@ -118,16 +118,19 @@ while :; do
dialog_menu_main || f_die
f_dialog_menutag_fetch mtag
+ command=
case "$mtag" in
- X) # Exit
- break ;;
- 1) # Toggle Startup Services
- $BSDCFG_LIBE/$APP_DIR/rcvar ${USE_XDIALOG:+-X} ;;
- 2) # View/Edit Startup Configuration
- $BSDCFG_LIBE/$APP_DIR/rcconf ${USE_XDIALOG:+-X} ;;
- 3) # Miscellaneous Startup Services
- $BSDCFG_LIBE/$APP_DIR/misc ${USE_XDIALOG:+-X} ;;
+ X) break ;;
+ 1) command=rcvar ;; # Toggle Startup Services
+ 2) command=rcconf ;; # View/Edit Startup Configuration
+ 3) command=misc ;; # Miscellaneous Startup Services
esac
+
+ if [ "$command" ]; then
+ $BSDCFG_LIBE/$APP_DIR/$command ${USE_XDIALOG:+-X} ;;
+ else
+ f_die 1 "$msg_unknown_startup_menu_selection"
+ fi
done
exit $SUCCESS
Modified: head/usr.sbin/bsdconfig/usermgmt/include/messages.subr
==============================================================================
--- head/usr.sbin/bsdconfig/usermgmt/include/messages.subr Tue Jun 18 21:41:06 2013 (r251966)
+++ head/usr.sbin/bsdconfig/usermgmt/include/messages.subr Tue Jun 18 21:44:35 2013 (r251967)
@@ -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_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?"
msg_user="User"
msg_user_id="UID"
Modified: head/usr.sbin/bsdconfig/usermgmt/usermgmt
==============================================================================
--- head/usr.sbin/bsdconfig/usermgmt/usermgmt Tue Jun 18 21:41:06 2013 (r251966)
+++ head/usr.sbin/bsdconfig/usermgmt/usermgmt Tue Jun 18 21:44:35 2013 (r251967)
@@ -144,38 +144,26 @@ while :; do
f_die
fi
+ command=
case "$mtag" in
- X) # Exit
- exit 0
- ;;
-
- 1) # Add User
- $BSDCFG_LIBE/$APP_DIR/useradd ${USE_XDIALOG:+-X}
- ;;
-
- 2) # Edit/View User
- $BSDCFG_LIBE/$APP_DIR/useredit ${USE_XDIALOG:+-X}
- ;;
-
- 3) # Delete User
- $BSDCFG_LIBE/$APP_DIR/userdel ${USE_XDIALOG:+-X}
- ;;
-
- 4) # Add Group
- $BSDCFG_LIBE/$APP_DIR/groupadd ${USE_XDIALOG:+-X}
- ;;
-
- 5) # Edit/View Group
- $BSDCFG_LIBE/$APP_DIR/groupedit ${USE_XDIALOG:+-X}
- ;;
-
- 6) # Delete Group
- $BSDCFG_LIBE/$APP_DIR/groupdel ${USE_XDIALOG:+-X}
- ;;
-
+ X) break ;;
+ 1) command=useradd ;; # Add User
+ 2) command=useredit ;; # Edit/View User
+ 3) command=userdel ;; # Delete User
+ 4) command=groupadd ;; # Add Group
+ 5) command=groupedit ;; # Edit/View Group
+ 6) command=groupdel ;; # Delete Group
esac
+
+ if [ "$command" ]; then
+ $BSDCFG_LIBE/$APP_DIR/$command ${USE_XDIALOG:+-X}
+ else
+ f_die 1 "$msg_unknown_user_management_menu_selection"
+ fi
done
+exit $SUCCESS
+
################################################################################
# END
################################################################################
More information about the svn-src-head
mailing list