From 7bba0c8c5a0d0e79c95fdab401d3c48c1ffeae67 Mon Sep 17 00:00:00 2001 From: James McMurray Date: Wed, 9 Sep 2020 16:29:39 +0200 Subject: [PATCH] Move locale generation before user scripts (#59) So user scripts can change locale if they wish --- src/main.rs | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/main.rs b/src/main.rs index 18b2c67..4944850 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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"),