locale: Fixed locale

yeah, the timezone link should of never been ran on the host system as
that means your timezone wont work as /mnt/usr/share/zoneinfo won't
exist on the installed system
axtloss/rework-partitioning
Fries 2 years ago committed by fries1234
parent 7914d491a6
commit 95b1bc52c1

@ -3,12 +3,15 @@ use crate::internal::*;
pub fn set_timezone(timezone: &str) { pub fn set_timezone(timezone: &str) {
exec_eval( exec_eval(
exec( // Remember this should run in a chroot
// not on the host, as linking to /mnt/usr/share/zoneinfo
// will mean you're gonna have a bad time
exec_chroot(
"ln", "ln",
vec![ vec![
"-sf".to_string(), "-sf".to_string(),
format!("/mnt/usr/share/zoneinfo/{}", timezone), format!("/usr/share/zoneinfo/{}", timezone),
"/mnt/etc/localtime".to_string(), "/etc/localtime".to_string(),
], ],
), ),
"Set timezone", "Set timezone",
@ -24,17 +27,15 @@ pub fn set_locale(locale: String) {
files::append_file("/mnt/etc/locale.gen", "en_US.UTF-8 UTF-8\n"), files::append_file("/mnt/etc/locale.gen", "en_US.UTF-8 UTF-8\n"),
"add en_US.UTF-8 UTF-8 to locale.gen", "add en_US.UTF-8 UTF-8 to locale.gen",
); );
// TODO: Refactor this
for i in (0..locale.split(' ').count()).step_by(2) { for i in (0..locale.split(' ').count()).step_by(2) {
files_eval( files_eval(
files::append_file( files::append_file(
"/mnt/etc/locale.gen", "/mnt/etc/locale.gen",
format!( &format!(
"{} {}\n", "{} {}\n",
locale.split(' ').collect::<Vec<&str>>()[i], locale.split(' ').collect::<Vec<&str>>()[i],
locale.split(' ').collect::<Vec<&str>>()[i + 1] locale.split(' ').collect::<Vec<&str>>()[i + 1]
) ),
.as_str(),
), ),
"add locales to locale.gen", "add locales to locale.gen",
); );

Loading…
Cancel
Save