install: write new file instead of modifying locale.sh from alpine-baselayout
First of all, modifying in-place the file owned by alpine-baselayout has the consequence of that file never being updated by APK. This is an issue changes happen upstream. And I just fixed[1] an issue upstream that had to be with that exact file, so make sure that from now on, we're writing to another file that sorts before the one from alpine-baselayout. Additionally, equivalently to the fix in [1] for bug [2], don't set the variable unconditionally, but instead use its current value if it's already set. [1] https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/46718 [2] https://gitlab.alpinelinux.org/alpine/aports/-/issues/14862 Signed-off-by: Pablo Correa Gómez <ablocorrea@hotmail.com> Reviewed-by: Oliver Smith <ollieparanoid@postmarketos.org> Tested-by: Oliver Smith <ollieparanoid@postmarketos.org> Co-developed-by: Oliver Smith <ollieparanoid@postmarketos.org> Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3CDB9P192MB12912380DD72F8A840694B44C7759@DB9P192MB1291.EURP192.PROD.OUTLOOK.COM%3E
This commit is contained in:
parent
d200414d87
commit
acb94beaf9
|
@ -1032,9 +1032,12 @@ def create_device_rootfs(args, step, steps):
|
|||
|
||||
# Set locale
|
||||
if locale_is_set:
|
||||
pmb.chroot.root(args, ["sed", "-i",
|
||||
f"s/LANG=C.UTF-8/LANG={args.locale}/",
|
||||
"/etc/profile.d/locale.sh"], suffix)
|
||||
# 10locale-pmos.sh gets sourced before 20locale.sh from
|
||||
# alpine-baselayout by /etc/profile. Since they don't override the
|
||||
# locale if it exists, it warranties we have preference
|
||||
line = f"export LANG=${{LANG:-{shlex.quote(args.locale)}}}"
|
||||
pmb.chroot.root(args, ["sh", "-c", f"echo {shlex.quote(line)}"
|
||||
" > /etc/profile.d/10locale-pmos.sh"], suffix)
|
||||
|
||||
# Set the hostname as the device name
|
||||
setup_hostname(args)
|
||||
|
|
Loading…
Reference in New Issue