diff --git a/src/error.rs b/src/error.rs index 517b2e9..ca575be 100644 --- a/src/error.rs +++ b/src/error.rs @@ -67,6 +67,9 @@ pub enum ErrorKind { #[fail(display = "Error closing the encrypted device")] LuksClose, + + #[fail(display = "Error setting the locale")] + Locale, } impl Fail for Error { diff --git a/src/main.rs b/src/main.rs index 1bab420..04373f5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -213,6 +213,24 @@ fn create(command: CreateCommand) -> Result<(), Error> { ) .context(ErrorKind::PostInstallation)?; + 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(ErrorKind::Locale)?; + fs::write( + mount_point.path().join("etc/locale.conf"), + "LANG=en_US.UTF-8", + ) + .context(ErrorKind::Locale)?; + arch_chroot + .execute() + .arg(mount_point.path()) + .arg("locale-gen") + .run(ErrorKind::Locale)?; + info!("Generating initramfs"); fs::write(mount_point.path().join("etc/mkinitcpio.conf"), MKINITCPIO) .context(ErrorKind::Initramfs)?;