Move locale generation before user scripts (#59)

So user scripts can change locale if they wish
This commit is contained in:
James McMurray 2020-09-09 16:29:39 +02:00 committed by Philip Mueller
parent 38e2cfbf5b
commit 7bba0c8c5a

View File

@ -257,6 +257,25 @@ fn create(command: args::CreateCommand) -> anyhow::Result<()> {
.run()
.context("Failed to delete the root password")?;
info!("Setting locale");
fs::OpenOptions::new()
.append(true)
.write(true)
.open(mount_point.path().join("etc/locale.gen"))
.and_then(|mut locale_gen| locale_gen.write_all(b"en_US.UTF-8 UTF-8\n"))
.context("Failed to create locale.gen")?;
fs::write(
mount_point.path().join("etc/locale.conf"),
"LANG=en_US.UTF-8",
)
.context("Failed to write to locale.conf")?;
arch_chroot
.execute()
.arg(mount_point.path())
.arg("locale-gen")
.run()
.context("locale-gen failed")?;
if !presets.aur_packages.is_empty() {
arch_chroot
.execute()
@ -406,25 +425,6 @@ fn create(command: args::CreateCommand) -> anyhow::Result<()> {
)
.context("Failed to write to journald.conf")?;
info!("Setting locale");
fs::OpenOptions::new()
.append(true)
.write(true)
.open(mount_point.path().join("etc/locale.gen"))
.and_then(|mut locale_gen| locale_gen.write_all(b"en_US.UTF-8 UTF-8\n"))
.context("Failed to create locale.gen")?;
fs::write(
mount_point.path().join("etc/locale.conf"),
"LANG=en_US.UTF-8",
)
.context("Failed to write to locale.conf")?;
arch_chroot
.execute()
.arg(mount_point.path())
.arg("locale-gen")
.run()
.context("locale-gen failed")?;
info!("Generating initramfs");
fs::write(
mount_point.path().join("etc/mkinitcpio.conf"),