forked from Mirror/pmbootstrap
pmb.install._install: write lang configuration to /etc/locale.conf
Previous reasons to write the locales to /etc/profile.d/.. was because musl-locales do only support reading from environment variables and not /etc/locale.conf. However systemd-localed (and glibc) uses /etc/locale.conf to read and write locale configurations. gnome-control-center, for example, uses localed to change locales. In the sake of a single source of truth, allow pmb to write to /etc/locale.conf and allow its consumers (e.g. g-c-c via systemd) to read/change these variables. Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2547
This commit is contained in:
parent
9656c53a6a
commit
50d2bb45f4
1 changed files with 4 additions and 2 deletions
|
@ -399,9 +399,11 @@ def setup_locale(chroot: Chroot, locale: str) -> None:
|
||||||
# 10locale-pmos.sh gets sourced before 20locale.sh from
|
# 10locale-pmos.sh gets sourced before 20locale.sh from
|
||||||
# alpine-baselayout by /etc/profile. Since they don't override the
|
# alpine-baselayout by /etc/profile. Since they don't override the
|
||||||
# locale if it exists, it warranties we have preference
|
# locale if it exists, it warranties we have preference
|
||||||
line = f"export LANG=${{LANG:-{shlex.quote(locale)}}}"
|
pmb.chroot.root(["sh", "-c", f"echo LANG={shlex.quote(locale)} > /etc/locale.conf"], chroot)
|
||||||
|
# musl-locales doesn't read from /etc/locale.conf, only from environment variables
|
||||||
|
# TODO: once musl implements locales (hopefully with /etc/locale.conf support) the following should be removed
|
||||||
pmb.chroot.root(
|
pmb.chroot.root(
|
||||||
["sh", "-c", f"echo {shlex.quote(line)} > /etc/profile.d/10locale-pmos.sh"], chroot
|
["sh", "-c", "echo source /etc/locale.conf > /etc/profile.d/10locale-pmos.sh"], chroot
|
||||||
)
|
)
|
||||||
# add keyboard layout related to locale and layout switcher
|
# add keyboard layout related to locale and layout switcher
|
||||||
xkb_layout = get_xkb_layout(locale)
|
xkb_layout = get_xkb_layout(locale)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue