mirror of
https://github.com/brain-hackers/brain-config.git
synced 2024-12-22 20:20:06 +09:00
Fix nonint locale handling
This commit is contained in:
parent
26e568102f
commit
618a3fedce
14
raspi-config
14
raspi-config
@ -491,13 +491,17 @@ do_change_locale() {
|
|||||||
if [ "$INTERACTIVE" = True ]; then
|
if [ "$INTERACTIVE" = True ]; then
|
||||||
dpkg-reconfigure locales
|
dpkg-reconfigure locales
|
||||||
else
|
else
|
||||||
local LOCALE="$1"
|
if ! LOCALE_LINE="$(grep -E "^$1( |$)" /usr/share/i18n/SUPPORTED)"; then
|
||||||
if ! LOCALE_LINE="$(grep -E "^$LOCALE( |$)" /usr/share/i18n/SUPPORTED)"; then
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
local ENCODING="$(echo $LOCALE_LINE | cut -f2 -d " ")"
|
export LC_ALL=C
|
||||||
echo "$LOCALE $ENCODING" > /etc/locale.gen
|
export LANG=C
|
||||||
sed -i "s/^\s*LANG=\S*/LANG=$LOCALE/" /etc/default/locale
|
local LG="/etc/locale.gen"
|
||||||
|
local NEW_LANG="$(echo $LOCALE_LINE | cut -f1 -d " ")"
|
||||||
|
[ -L "$LG" ] && [ "$(readlink $LG)" = "/usr/share/i18n/SUPPORTED" ] && rm -f "$LG"
|
||||||
|
echo "$LOCALE_LINE" > /etc/locale.gen
|
||||||
|
update-locale --no-checks LANG
|
||||||
|
update-locale --no-checks "LANG=$NEW_LANG"
|
||||||
dpkg-reconfigure -f noninteractive locales
|
dpkg-reconfigure -f noninteractive locales
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user