|
7 | 7 |
|
8 | 8 | import commons |
9 | 9 |
|
10 | | -install_phase = commons.POST_INSTALL |
| 10 | +# PRE_PKGS_INSTALL, not POST_INSTALL: dracut's 20i18n module reads |
| 11 | +# /etc/locale.conf when it builds an initrd, and the initramfs rpm installs a |
| 12 | +# file trigger that runs mkinitrd at the END of the package transaction started |
| 13 | +# by _install_packages(). A file written after that transaction is written too |
| 14 | +# late. Without it dracut aborts i18n setup with |
| 15 | +# "i18n_vars not set! Please set up i18n_vars in configuration file." |
| 16 | +# and falls back to embedding every keymap. |
| 17 | +# |
| 18 | +# _initialize_system() runs immediately before this phase, so the file lands at |
| 19 | +# very nearly the same point in the sequence as it would have from there, but |
| 20 | +# in the module that owns locale rather than in the installer body. |
| 21 | +install_phase = commons.PRE_PKGS_INSTALL |
11 | 22 | enabled = True |
12 | 23 |
|
13 | 24 |
|
14 | 25 | def execute(installer): |
15 | 26 | # Set locale |
16 | | - with open( |
17 | | - os.path.join(installer.photon_root, "etc/locale.conf"), "w" |
18 | | - ) as locale_conf: |
| 27 | + locale_conf_path = os.path.join(installer.photon_root, "etc/locale.conf") |
| 28 | + os.makedirs(os.path.dirname(locale_conf_path), exist_ok=True) |
| 29 | + with open(locale_conf_path, "w") as locale_conf: |
19 | 30 | locale_conf.write("LANG=en_US.UTF-8\n") |
20 | | - |
21 | | - """ |
22 | | - locale-gen.sh needs /usr/share/locale/locale.alias which is shipped |
23 | | - with glibc-lang rpm, in some photon installations glibc-lang rpm is |
24 | | - not installed by default. Call localedef directly here to define |
25 | | - locale environment. |
26 | | - """ |
27 | | - installer.cmd.run_in_chroot( |
28 | | - installer.photon_root, |
29 | | - "/usr/bin/localedef -c -i en_US -f UTF-8 en_US.UTF-8", |
30 | | - ) |
0 commit comments