Set C.UTF-8 locale for apt-based containers
Suppress perl/apt locale warnings by configuring C.UTF-8 for apt-based systems. The script now exports DEBIAN_FRONTEND=noninteractive and LC_ALL/LANG/LANGUAGE=C.UTF-8 when PKG_MANAGER==apt, and appends LC_ALL and LANG to /etc/environment if not present. This addresses cases where a container inherits an ungenerated host locale (e.g. Devuan) and ensures C.UTF-8, which is always available, is used.
This commit is contained in:
@@ -878,6 +878,16 @@ setting_up_container() {
|
||||
# Remove Python EXTERNALLY-MANAGED restriction (Debian 12+, Ubuntu 23.04+)
|
||||
rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED 2>/dev/null || true
|
||||
|
||||
# Fix locale warnings from perl/apt (e.g. Devuan inherits host locale but hasn't generated it)
|
||||
# C.UTF-8 is always available without locale-gen on any Linux system
|
||||
if [[ "$PKG_MANAGER" == "apt" ]]; then
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
export LC_ALL=C.UTF-8
|
||||
export LANG=C.UTF-8
|
||||
export LANGUAGE=C.UTF-8
|
||||
grep -qxF 'LC_ALL=C.UTF-8' /etc/environment 2>/dev/null || echo -e 'LC_ALL=C.UTF-8\nLANG=C.UTF-8' >>/etc/environment
|
||||
fi
|
||||
|
||||
# Disable network wait services for faster boot
|
||||
case "$INIT_SYSTEM" in
|
||||
systemd)
|
||||
|
||||
Reference in New Issue
Block a user