Use local variables and don't rely on dbus

This commit is contained in:
Anthony Rose 2021-02-22 12:38:33 +00:00
parent 08c26311b2
commit 58fe832ee8

View file

@ -41,7 +41,8 @@ set -o noclobber
export TIME_STYLE=long-iso # Used by GNU 'ls'. export TIME_STYLE=long-iso # Used by GNU 'ls'.
_acp_set_locale () { _acp_set_locale () {
_acp_locale_selected=0 local _acp_locale_selected=0
local _acp_entered_locale=
while [ $_acp_locale_selected -eq 0 ] while [ $_acp_locale_selected -eq 0 ]
do do
echo "Enter a locale, 'list', or leave blank to skip." echo "Enter a locale, 'list', or leave blank to skip."
@ -49,7 +50,7 @@ _acp_set_locale () {
read _acp_entered_locale read _acp_entered_locale
case "$_acp_entered_locale" in case "$_acp_entered_locale" in
list) list)
localectl list-locales locale -a
;; ;;
*) *)
if [ $(localectl list-locales | grep "${_acp_entered_locale}" | wc -l) -eq 0 ] if [ $(localectl list-locales | grep "${_acp_entered_locale}" | wc -l) -eq 0 ]
@ -84,8 +85,6 @@ _acp_set_locale () {
locale > "$HOME/.config/locale.conf" locale > "$HOME/.config/locale.conf"
fi fi
done done
unset _acp_locale_selected
unset _acp_entered_locale
} }
if [ -r "$HOME/.config/locale.conf" ] if [ -r "$HOME/.config/locale.conf" ]