systemvm: fix duplicated "en_US.UTF-8 UTF-8" in /etc/locale.gen (#11823)

This commit is contained in:
Wei Zhou 2025-10-15 11:42:24 +02:00 committed by GitHub
parent 4327871036
commit b82369c241
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -22,13 +22,15 @@ set -x
function configure_locale() {
grep LANG=en_US.UTF-8 /etc/default/locale && \
grep LC_ALL=en_US.UTF-8 /etc/default/locale && \
grep "en_US.UTF-8 UTF-8" /etc/locale.gen &&
grep "^en_US.UTF-8 UTF-8" /etc/locale.gen &&
return
cat >> /etc/default/locale << EOF
LANG=en_US.UTF-8
LC_ALL=en_US.UTF-8
EOF
grep "^en_US.UTF-8 UTF-8" /etc/locale.gen || \
cat >> /etc/locale.gen << EOF
en_US.UTF-8 UTF-8
EOF