From 62c920ea5a00d9c6361fc095a7a8df2689156e6c Mon Sep 17 00:00:00 2001 From: Juan RP Date: Mon, 20 May 2013 11:48:46 +0200 Subject: [PATCH] installer: provide full list of keymaps, locales and timezones; regenerate wanted locale. --- installer.sh.in | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/installer.sh.in b/installer.sh.in index c7809f8..cc22303 100644 --- a/installer.sh.in +++ b/installer.sh.in @@ -262,10 +262,14 @@ ${RESET}\n" 18 80 } menu_keymap() { - local KEYMAPS="de German fr French it Italian en English es Spanish ru Russia us American" + local _keymaps="$(localectl --no-pager list-keymaps)" + local _KEYMAPS= + for f in ${_keymaps}; do + _KEYMAPS="${_KEYMAPS} ${f} -" + done while true; do - DIALOG --title " Select your keymap " --menu "$MENULABEL" 14 70 14 ${KEYMAPS} + DIALOG --title " Select your keymap " --menu "$MENULABEL" 14 70 14 ${_KEYMAPS} if [ $? -eq 0 ]; then set_option KEYMAP "$(cat $ANSWER)" loadkeys "$(cat $ANSWER)" @@ -283,7 +287,7 @@ set_keymap() { } menu_locale() { - local _locales="$(localectl --no-pager list-locales)" + local _locales="$(grep -E '\.UTF-8' /etc/default/libc-locales|awk '{print $1}'|sed -e 's/^#//')" local _LOCALES= for f in ${_locales}; do @@ -292,7 +296,7 @@ menu_locale() { while true; do DIALOG --title " Select your locale " --menu "$MENULABEL" 14 70 14 ${_LOCALES} if [ $? -eq 0 ]; then - set_option LANG "$(cat $ANSWER)" + set_option LOCALE "$(cat $ANSWER)" LOCALE_DONE=1 break else @@ -303,7 +307,11 @@ menu_locale() { set_locale() { local LOCALE=$(get_option LOCALE) - sed -i -e "s|LANG=.*|LANG=$KEYMAP|g" $TARGETDIR/etc/locale.conf + sed -i -e "s|LANG=.*|LANG=$LOCALE|g" $TARGETDIR/etc/locale.conf + # Uncomment locale from /etc/default/libc-locales and regenerate it. + sed -e "/${LOCALE}/s/^\#//" -i $TARGETDIR/etc/default/libc-locales + echo "Running xbps-reconfigure -f glibc-locales ..." >$LOG + chroot $TARGETDIR xbps-reconfigure -f glibc-locales } menu_timezone() { @@ -311,7 +319,7 @@ menu_timezone() { local _TIMEZONES= for f in ${_tzones}; do - _TIMEZONES="${_tzones} ${f} -" + _TIMEZONES="${_TIMEZONES} ${f} -" done while true; do DIALOG --title " Select your timezone " --menu "$MENULABEL" 14 70 14 ${_TIMEZONES}