fix locale selector, clear screen after listing keymaps/locales

fix another var typo and clear the screen after the user searches for locales/keymaps with / (since less floods the screen)
This commit is contained in:
i-c-u-p 2022-04-28 03:10:37 +00:00
parent 0a379f40f1
commit 93f2caeb3b
No known key found for this signature in database
GPG key ID: ABB80C12170FC0D1

View file

@ -185,10 +185,12 @@ hostname_selector () {
# Setting up the locale (function). # Setting up the locale (function).
locale_selector () { locale_selector () {
read -r -p "Please insert the locale you use (format: xx_XX. Enter empty to use en_US, or type a "/" to search avaliable locales): " locale read -r -p "Please insert the locale you use (format: xx_XX. Enter empty to use en_US, or type a "/" to search avaliable locales): " locale
case $kblayout in case $locale in
'') print "en_US will be used as default locale." '') print "en_US will be used as default locale."
locale="en_US.UTF-8";; locale="en_US.UTF-8";;
'/') sed -E '/^# +|^#$/d;s/^#| *$//g;s/ .*/ (Charset:&)/' /etc/locale.gen | less -M;; '/') sed -E '/^# +|^#$/d;s/^#| *$//g;s/ .*/ (Charset:&)/' /etc/locale.gen | less -M
clear
locale_selector;;
*) if ! grep -Fxq $locale /etc/locale.gen; then *) if ! grep -Fxq $locale /etc/locale.gen; then
print "The specified locale doesn't exist or isn't supported." print "The specified locale doesn't exist or isn't supported."
locale_selector locale_selector
@ -204,6 +206,7 @@ keyboard_selector () {
'') print "US keyboard layout will be used by default." '') print "US keyboard layout will be used by default."
kblayout="us";; kblayout="us";;
'/') localectl list-keymaps '/') localectl list-keymaps
clear
keyboard_selector;; keyboard_selector;;
*) if ! $(localectl list-keymaps | grep -Fxq $kblayout); then *) if ! $(localectl list-keymaps | grep -Fxq $kblayout); then
print "The specified keymap doesn't exist." print "The specified keymap doesn't exist."