From c85396d75439a2c5c74120dd7a8051a54de66260 Mon Sep 17 00:00:00 2001 From: Alex Bradbury Date: Wed, 22 May 2013 20:17:32 +0100 Subject: [PATCH] use case to dispatch internationalisation menu functions --- raspi-config | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/raspi-config b/raspi-config index 38b3aa8..88c3919 100755 --- a/raspi-config +++ b/raspi-config @@ -178,17 +178,17 @@ do_change_pass() { whiptail --msgbox "Password changed successfully" 20 60 1 } -do_I3() { # Keyboard +do_configure_keyboard() { dpkg-reconfigure keyboard-configuration && printf "Reloading keymap. This may take a short while\n" && invoke-rc.d keyboard-setup start } -do_I1() { # Locale +do_change_locale() { dpkg-reconfigure locales } -do_I2() { # Timezone +do_change_timezone() { dpkg-reconfigure tzdata } @@ -526,15 +526,20 @@ fi do_internationalisation_menu() { FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Internationalisation Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ - "I1 Change Locale" "Set up language and regional settings to match your location" \ - "I2 Change Timezone" "Set up timezone to match your location" \ - "I3 Change Keyboard Layout" "Set the keyboard layout to match your keyboard" \ - 3>&1 1>&2 2>&3) + "I1 Change Locale" "Set up language and regional settings to match your location" \ + "I2 Change Timezone" "Set up timezone to match your location" \ + "I3 Change Keyboard Layout" "Set the keyboard layout to match your keyboard" \ + 3>&1 1>&2 2>&3) RET=$? if [ $RET -eq 1 ]; then return 0 elif [ $RET -eq 0 ]; then - "do_$(echo $FUN | head -c 2)" || whiptail --msgbox "There was an error running option $FUN" 20 60 1 + case "$FUN" in + I1\ *) do_change_locale ;; + I2\ *) do_change_timezone ;; + I3\ *) do_configure_keyboard ;; + *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; + esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 fi }