fix locale existence check

shouldn't be using the -x option since locales always appear with the charset on the same line, making matches impossible. Also removed -F since some regex is needed to ensure only locales are matched, and added a sed to escape regex characters in $locale before its sent to grep so the user can't type something like "e." and match the "eo" locale accidentally.
This commit is contained in:
i-c-u-p 2022-04-29 06:21:43 +00:00
parent 31acfd3b0c
commit fd49d164de
No known key found for this signature in database
GPG key ID: ABB80C12170FC0D1

View file

@ -203,7 +203,7 @@ locale_selector () {
'/') sed -E '/^# +|^#$/d;s/^#| *$//g;s/ .*/ (Charset:&)/' /etc/locale.gen | less -M
clear
return 1;;
*) if ! grep -Fxq $locale /etc/locale.gen; then
*) if ! grep -q "^#\?$(sed 's/[].*[]/\\&/g' <<< $locale) " /etc/locale.gen; then
incEcho "The specified locale doesn't exist or isn't supported."
return 1
fi