Skip to content

Commit

Permalink
use case to dispatch internationalisation menu functions
Browse files Browse the repository at this point in the history
  • Loading branch information
asb committed May 22, 2013
1 parent 3d725a8 commit c85396d
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions raspi-config
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit c85396d

Please sign in to comment.