SHA256
Compare commits
3
Commits
| Author | SHA256 | Date | |
|---|---|---|---|
|
|
eee7fd17d6 | ||
|
|
9d68343219 | ||
|
|
d494dbe3c8 |
No files matched your search
Generated
+279
-428
File diff suppressed because it is too large.
Load diff
@@ -141,7 +141,6 @@ const PKG_LIST_KDE_DESKTOP: [&str; 45] = [
|
|||||||
"strawberry",
|
"strawberry",
|
||||||
"mpv",
|
"mpv",
|
||||||
"ttf-unifont",
|
"ttf-unifont",
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
// const PKG_LIST_AWESOME_DESKTOP: [&str; 5] = [
|
// const PKG_LIST_AWESOME_DESKTOP: [&str; 5] = [
|
||||||
@@ -247,10 +246,44 @@ fn init_disk(part_layout: &PartLayout, mnt_dir: &str) -> Result<(), ExecCommandE
|
|||||||
Ok(())
|
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...");
|
log::info!("Generating fstab...");
|
||||||
kira_system::fstabgen(MNT_DIR)?;
|
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)
|
//kira_system::exec_cmd_chroot(chroot_dir, cmd, args)
|
||||||
|
|
||||||
Ok(())
|
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
|
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;
|
use blocking;
|
||||||
log::info!("Configuring installed system...");
|
log::info!("Configuring installed system...");
|
||||||
blocking::unblock(move || config_stuff()).await
|
blocking::unblock(move || config_stuff(k_config)).await
|
||||||
}
|
}
|
||||||
|
|
||||||
fn do_install(
|
fn do_install(
|
||||||
@@ -366,7 +399,7 @@ fn do_install(
|
|||||||
100,
|
100,
|
||||||
|mut output: Sender<Result<(f32, String), ExecCommandError>>| async move {
|
|mut output: Sender<Result<(f32, String), ExecCommandError>>| async move {
|
||||||
//sleep(Duration::from_millis(10)).await;
|
//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
|
// creating gpt partition table
|
||||||
let res = init_disk_async(disk_layout.clone(), MNT_DIR.into()).await;
|
let res = init_disk_async(disk_layout.clone(), MNT_DIR.into()).await;
|
||||||
@@ -429,7 +462,7 @@ fn do_install(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// configuring system
|
// configuring system
|
||||||
let res = config_stuff_async().await;
|
let res = config_stuff_async(k_config.clone()).await;
|
||||||
let res_err = res.is_err();
|
let res_err = res.is_err();
|
||||||
output
|
output
|
||||||
.send(res.map(|_| (60.0f32, "Next step".into())))
|
.send(res.map(|_| (60.0f32, "Next step".into())))
|
||||||
|
|||||||
+15
-80
@@ -29,17 +29,12 @@ use rust_i18n::t;
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
const LOCALES_GEN_FILE_NAME: &str = "/etc/locale.gen";
|
const LOCALES_GEN_FILE_NAME: &str = "/etc/locale.gen";
|
||||||
const LOCALES_GEN_START_LINE: usize = 17;
|
|
||||||
|
|
||||||
// fn default_locale() -> (String, String) {
|
|
||||||
// ("C.UTF-8".to_string(), "UTF-8".to_string())
|
|
||||||
// }
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct LocaleData {
|
pub struct LocaleData {
|
||||||
code: String,
|
pub code: String,
|
||||||
charset: String,
|
pub charset: String,
|
||||||
description: Option<String>,
|
pub description: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::fmt::Display for LocaleData {
|
impl std::fmt::Display for LocaleData {
|
||||||
@@ -60,6 +55,18 @@ impl LocaleData {
|
|||||||
description: Some("C locale".into()),
|
description: Some("C locale".into()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// creates text to be appended to locale.gen file
|
||||||
|
// in case of C locale outputs empty string
|
||||||
|
pub fn locale_gen_line(&self) -> String {
|
||||||
|
if self.code == "C.UTF-8" {
|
||||||
|
String::new()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
format!("{} {}", &self.code, &self.charset)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// gets locales list from system "/etc/locale.gen" file
|
/// gets locales list from system "/etc/locale.gen" file
|
||||||
@@ -107,27 +114,9 @@ fn get_locales_blocking(filter_charset: Option<&str>) -> Result<Vec<LocaleData>,
|
|||||||
charset: charset,
|
charset: charset,
|
||||||
description: description,
|
description: description,
|
||||||
});
|
});
|
||||||
// let subvol_name = &captured[1];
|
|
||||||
// let date_time = captured[2].to_string();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if let Some(captured) = re.captures(&dir_name)
|
|
||||||
// let mut res: Vec<(String, String)> = file_content
|
|
||||||
// .split('\n')
|
|
||||||
// .skip(LOCALES_GEN_START_LINE)
|
|
||||||
// .filter_map(|l| {
|
|
||||||
// let trimmed = l.trim_start_matches('#').trim();
|
|
||||||
// if trimmed.len() > 0 {
|
|
||||||
// trimmed.split_once(' ')
|
|
||||||
// } else {
|
|
||||||
// None
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// .map(|(loc, charset)| (loc.to_string(), charset.to_string()))
|
|
||||||
// .filter(|(_, chrs)| chrs == "UTF-8") // yeld only UTF-8 locales
|
|
||||||
// .collect();
|
|
||||||
|
|
||||||
res.push(LocaleData::default());
|
res.push(LocaleData::default());
|
||||||
|
|
||||||
Ok(res)
|
Ok(res)
|
||||||
@@ -154,42 +143,6 @@ fn get_loc_descr_blocking() -> Result<HashMap<String, String>, ExecCommandError>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// match Command::new("grep")
|
|
||||||
// .args(["-r", "title ", "/usr/share/i18n/locales/"])
|
|
||||||
// .output()
|
|
||||||
// {
|
|
||||||
// Ok(cmd_output) => {
|
|
||||||
// if cmd_output.status.success() {
|
|
||||||
// match String::from_utf8(cmd_output.stdout) {
|
|
||||||
// Ok(raw_str_list) => Ok(raw_str_list
|
|
||||||
// .split("\n")
|
|
||||||
// .filter_map(|s| s.trim().split_once(":title"))
|
|
||||||
// .filter_map(|(code_part, description_part)| {
|
|
||||||
// code_part.rsplit_once("/").and_then(|(_, loc_code)| {
|
|
||||||
// Some((
|
|
||||||
// loc_code.trim().to_string(),
|
|
||||||
// description_part.trim().trim_matches('\"').to_string(),
|
|
||||||
// ))
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
// .collect()),
|
|
||||||
// Err(ex) => Err(format!(
|
|
||||||
// "Exception while converting locales description to UTF8 {}",
|
|
||||||
// ex
|
|
||||||
// )),
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// Err(format!(
|
|
||||||
// "Error getting locales description list: {}",
|
|
||||||
// String::from_utf8(cmd_output.stderr).unwrap_or("UNKNOWN".into())
|
|
||||||
// ))
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// Err(ex) => Err(format!(
|
|
||||||
// "Exception while trying to get locales description {}",
|
|
||||||
// ex
|
|
||||||
// )),
|
|
||||||
// }
|
|
||||||
Ok(res)
|
Ok(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,25 +178,7 @@ impl LocaleStage {
|
|||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(|rw| Some(rw.loc_code.clone()));
|
.and_then(|rw| Some(rw.loc_code.clone()));
|
||||||
|
|
||||||
// let raw_loc_codes = get_locales_codes_list_blocking().unwrap();
|
|
||||||
// let raw_loc_descr = get_locales_description_blocking().unwrap();
|
|
||||||
|
|
||||||
let locales: Vec<LocaleData> = get_locales_blocking(Some("UTF-8")).unwrap();
|
let locales: Vec<LocaleData> = get_locales_blocking(Some("UTF-8")).unwrap();
|
||||||
// .iter()
|
|
||||||
// .filter_map(|(code, _)| {
|
|
||||||
// code.split_once('.')
|
|
||||||
// .and_then(|(key_code, _)| Some((key_code, code)))
|
|
||||||
// })
|
|
||||||
// .filter_map(|(key_code, code)| {
|
|
||||||
// raw_loc_descr
|
|
||||||
// .get(key_code)
|
|
||||||
// .and_then(|descr| Some((code.clone(), descr.clone())))
|
|
||||||
// })
|
|
||||||
// .map(|(code, descr)| LocaleData {
|
|
||||||
// code: code,
|
|
||||||
// description: descr,
|
|
||||||
// })
|
|
||||||
// .collect();
|
|
||||||
|
|
||||||
// if we get lang code from wellcome stage, try to fing match with system locales
|
// if we get lang code from wellcome stage, try to fing match with system locales
|
||||||
let lang_match = if let Some(lang) = maybe_lang
|
let lang_match = if let Some(lang) = maybe_lang
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
use iced::{Alignment, Task, widget};
|
use iced::{Alignment, Task, widget};
|
||||||
use iced_moving_picture::widget::apng;
|
use iced_moving_picture::widget::moving_picture;
|
||||||
use log;
|
use log;
|
||||||
use rust_i18n::t;
|
use rust_i18n::t;
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ pub struct NetworkStage {
|
|||||||
internet_active: bool,
|
internet_active: bool,
|
||||||
state: State,
|
state: State,
|
||||||
use_net_settings: bool,
|
use_net_settings: bool,
|
||||||
spinner_frames: apng::Frames,
|
spinner_frames: moving_picture::Frames,
|
||||||
logo_handle: widget::image::Handle,
|
logo_handle: widget::image::Handle,
|
||||||
status_message: String,
|
status_message: String,
|
||||||
k_config: KiraConfig,
|
k_config: KiraConfig,
|
||||||
@@ -102,7 +102,7 @@ async fn check_connected() -> CheckResult {
|
|||||||
impl NetworkStage {
|
impl NetworkStage {
|
||||||
pub fn new(k_config: KiraConfig) -> Self {
|
pub fn new(k_config: KiraConfig) -> Self {
|
||||||
let spinner_frames =
|
let spinner_frames =
|
||||||
apng::Frames::from_bytes(crate::kira_theming::get_spiner_bytes()).unwrap();
|
moving_picture::Frames::from_bytes(crate::kira_theming::get_spiner_bytes(), moving_picture::Kind::Apng).unwrap();
|
||||||
|
|
||||||
let logo_handle = widget::image::Handle::from_bytes(crate::kira_theming::get_logo_bytes());
|
let logo_handle = widget::image::Handle::from_bytes(crate::kira_theming::get_logo_bytes());
|
||||||
|
|
||||||
@@ -188,7 +188,7 @@ impl NetworkStage {
|
|||||||
|
|
||||||
let spinner_container = match self.state {
|
let spinner_container = match self.state {
|
||||||
State::Cheking => widget::container(
|
State::Cheking => widget::container(
|
||||||
apng(&self.spinner_frames)
|
moving_picture(&self.spinner_frames)
|
||||||
.width(iced::Pixels(128.0).into())
|
.width(iced::Pixels(128.0).into())
|
||||||
.height(iced::Pixels(128.0).into()),
|
.height(iced::Pixels(128.0).into()),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in new issue
Block a user