This commit is contained in:
2026-03-20 10:03:00 +01:00
parent d6ea38db14
commit 998339d2b5
5 changed files with 112 additions and 12 deletions

View File

@@ -30,9 +30,14 @@ configure_locale() {
read -r locale
locale="${locale:-en_US.UTF-8}"
# Generate locale
# Generate locale using localedef (glibc provides this, locale-gen is a wrapper
# that may not exist on from-scratch systems)
echo "${locale} UTF-8" > "${MOUNT_POINT}/etc/locale.gen"
chroot "${MOUNT_POINT}" locale-gen 2>/dev/null || true
locale_name="${locale%%.*}" # e.g., "en_US" from "en_US.UTF-8"
charset="${locale##*.}" # e.g., "UTF-8" from "en_US.UTF-8"
mkdir -p "${MOUNT_POINT}/usr/lib/locale"
chroot "${MOUNT_POINT}" localedef -i "${locale_name}" -f "${charset}" "${locale}" 2>/dev/null || \
warn "localedef failed — locale may not be fully generated"
echo "LANG=${locale}" > "${MOUNT_POINT}/etc/locale.conf"
ok "Locale set to ${locale}"