SHA256
More work on install stage, testing locales stuff
This commit is contained in:
1 parent
9d68343219
commit
eee7fd17d6
1 file changed
+39
-6
@@ -141,7 +141,6 @@ const PKG_LIST_KDE_DESKTOP: [&str; 45] = [
|
||||
"strawberry",
|
||||
"mpv",
|
||||
"ttf-unifont",
|
||||
|
||||
];
|
||||
|
||||
// const PKG_LIST_AWESOME_DESKTOP: [&str; 5] = [
|
||||
@@ -247,10 +246,44 @@ fn init_disk(part_layout: &PartLayout, mnt_dir: &str) -> Result<(), ExecCommandE
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn config_stuff() -> Result<(), ExecCommandError> {
|
||||
fn config_stuff(k_config: KiraConfig) -> Result<(), ExecCommandError> {
|
||||
use std::fs::OpenOptions;
|
||||
use std::io::Write;
|
||||
|
||||
const LOCALES_GEN_FILE_NAME: &str = "/etc/locale.gen";
|
||||
|
||||
log::info!("Generating fstab...");
|
||||
kira_system::fstabgen(MNT_DIR)?;
|
||||
|
||||
|
||||
log::info!("Configuring locales...");
|
||||
let loc_data = k_config.res_locale.as_ref().unwrap();
|
||||
{
|
||||
let lang_line = loc_data.lang_locale.locale_gen_line();
|
||||
let formats_line = loc_data.formats_locale.locale_gen_line();
|
||||
// Open locale.gen file in append mode
|
||||
let mut locale_file = OpenOptions::new()
|
||||
.create(false)
|
||||
.append(true)
|
||||
.open(LOCALES_GEN_FILE_NAME)?;
|
||||
|
||||
writeln!(locale_file, "\n# Next lines is autogenerated by kira-installer")?;
|
||||
// write lang
|
||||
writeln!(locale_file, "{}", &lang_line)?;
|
||||
// write formats
|
||||
if lang_line != formats_line {
|
||||
writeln!(locale_file, "{}", &formats_line)?;
|
||||
}
|
||||
// if selected locale is not en, we will add en_US.UTF-8 UTF-8 to locales.gen
|
||||
if !lang_line.starts_with("en_") && !formats_line.starts_with("en_") {
|
||||
writeln!(locale_file, "en_US.UTF-8 UTF-8")?;
|
||||
}
|
||||
}
|
||||
kira_system::exec_cmd_chroot(MNT_DIR, "locale-gen", &vec![])?;
|
||||
|
||||
|
||||
//Simpler said.. it adds missing values for XKBLAYOUT=XX
|
||||
//and XKBMODEL=XXXX to /etc/vconsole.conf
|
||||
//kira_system::exec_cmd_chroot(chroot_dir, cmd, args)
|
||||
|
||||
Ok(())
|
||||
@@ -353,10 +386,10 @@ async fn install_kde_desk_async(mnt_dir: String) -> Result<(), ExecCommandError>
|
||||
blocking::unblock(move || kira_system::basestrap(&mnt_dir, &PKG_LIST_KDE_DESKTOP)).await
|
||||
}
|
||||
|
||||
async fn config_stuff_async() -> Result<(), ExecCommandError> {
|
||||
async fn config_stuff_async(k_config: KiraConfig) -> Result<(), ExecCommandError> {
|
||||
use blocking;
|
||||
log::info!("Configuring installed system...");
|
||||
blocking::unblock(move || config_stuff()).await
|
||||
blocking::unblock(move || config_stuff(k_config)).await
|
||||
}
|
||||
|
||||
fn do_install(
|
||||
@@ -366,7 +399,7 @@ fn do_install(
|
||||
100,
|
||||
|mut output: Sender<Result<(f32, String), ExecCommandError>>| async move {
|
||||
//sleep(Duration::from_millis(10)).await;
|
||||
let disk_layout = k_config.res_partition.unwrap().part_layout.clone();
|
||||
let disk_layout = k_config.res_partition.as_ref().unwrap().part_layout.clone();
|
||||
|
||||
// creating gpt partition table
|
||||
let res = init_disk_async(disk_layout.clone(), MNT_DIR.into()).await;
|
||||
@@ -429,7 +462,7 @@ fn do_install(
|
||||
}
|
||||
|
||||
// configuring system
|
||||
let res = config_stuff_async().await;
|
||||
let res = config_stuff_async(k_config.clone()).await;
|
||||
let res_err = res.is_err();
|
||||
output
|
||||
.send(res.map(|_| (60.0f32, "Next step".into())))
|
||||
|
||||
Reference in new issue
Block a user