SHA256
Compare commits
2
Commits
eee7fd17d6
...
5597b56538
| Author | SHA256 | Date | |
|---|---|---|---|
|
|
5597b56538 | ||
|
|
ecc87066ad |
No files matched your search
@@ -189,6 +189,7 @@ pub fn exec_cmd_chroot(
|
|||||||
args: &Vec<&str>,
|
args: &Vec<&str>,
|
||||||
) -> Result<(), ExecCommandError> {
|
) -> Result<(), ExecCommandError> {
|
||||||
let mut cmd_args: Vec<&str> = Vec::new();
|
let mut cmd_args: Vec<&str> = Vec::new();
|
||||||
|
cmd_args.push(chroot_dir);
|
||||||
cmd_args.push(cmd);
|
cmd_args.push(cmd);
|
||||||
cmd_args.extend(args);
|
cmd_args.extend(args);
|
||||||
exec_command("artix-chroot", &cmd_args)
|
exec_command("artix-chroot", &cmd_args)
|
||||||
|
|||||||
+54
-18
@@ -18,7 +18,7 @@
|
|||||||
Actual installation script.
|
Actual installation script.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use std::path::Path;
|
use std::{fs, path::Path};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
kira_disk_layout::{self, BlkDev, FSType, PartInfo, PartLayout, PartRole},
|
kira_disk_layout::{self, BlkDev, FSType, PartInfo, PartLayout, PartRole},
|
||||||
@@ -43,6 +43,8 @@ const MNT_DIR: &str = "/mnt/inst_root";
|
|||||||
const ROOT_PARTLABEL_DEV: &str = "/dev/disk/by-partlabel/bee-root";
|
const ROOT_PARTLABEL_DEV: &str = "/dev/disk/by-partlabel/bee-root";
|
||||||
const EFI_PARTLABLE_DEV: &str = "/dev/disk/by-partlabel/bee-efi";
|
const EFI_PARTLABLE_DEV: &str = "/dev/disk/by-partlabel/bee-efi";
|
||||||
const SWAP_PARTLABLE_DEV: &str = "/dev/disk/by-partlabel/bee-swap";
|
const SWAP_PARTLABLE_DEV: &str = "/dev/disk/by-partlabel/bee-swap";
|
||||||
|
const CONSOLE_FONT: &str = "ter-v24n";
|
||||||
|
|
||||||
///
|
///
|
||||||
/// List of packages for desktop (elogind-dinit no need for headles system)
|
/// List of packages for desktop (elogind-dinit no need for headles system)
|
||||||
///
|
///
|
||||||
@@ -246,41 +248,75 @@ fn init_disk(part_layout: &PartLayout, mnt_dir: &str) -> Result<(), ExecCommandE
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Writes locales from loc_lines to locale.gen file passed in loc_gen_file_path
|
||||||
|
/// Checks if locales from loc_lines defined in locale.gen
|
||||||
|
///
|
||||||
|
fn locale_gen_write(
|
||||||
|
loc_gen_file_path: &str,
|
||||||
|
loc_lines: &Vec<String>,
|
||||||
|
) -> Result<(), ExecCommandError> {
|
||||||
|
use std::fs::OpenOptions;
|
||||||
|
use std::io::Write;
|
||||||
|
|
||||||
|
// need this to check for locales existance
|
||||||
|
let loc_gen_content = fs::read_to_string(loc_gen_file_path)?;
|
||||||
|
|
||||||
|
// Open locale.gen file in append mode
|
||||||
|
let mut locale_file = OpenOptions::new()
|
||||||
|
.create(false)
|
||||||
|
.append(true)
|
||||||
|
.open(loc_gen_file_path)?;
|
||||||
|
|
||||||
|
writeln!(
|
||||||
|
locale_file,
|
||||||
|
"\n# Next lines is autogenerated by Kira Installer"
|
||||||
|
)?;
|
||||||
|
for loc in loc_lines {
|
||||||
|
// check if locale defined
|
||||||
|
if loc_gen_content.contains(loc) {
|
||||||
|
writeln!(locale_file, "{}", loc)?;
|
||||||
|
log::info!("Added ({}) locale.", loc);
|
||||||
|
} else {
|
||||||
|
// if not defined write comment on this matter
|
||||||
|
log::info!("Locale ({}) is not defined in locale.gen file.", loc);
|
||||||
|
writeln!(locale_file, "# Missing: {}", loc)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
fn config_stuff(k_config: KiraConfig) -> Result<(), ExecCommandError> {
|
fn config_stuff(k_config: KiraConfig) -> Result<(), ExecCommandError> {
|
||||||
use std::fs::OpenOptions;
|
use std::fs::OpenOptions;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
|
|
||||||
const LOCALES_GEN_FILE_NAME: &str = "/etc/locale.gen";
|
let loc_gen_fn = format!("{}/etc/locale.gen", MNT_DIR);
|
||||||
|
|
||||||
log::info!("Generating fstab...");
|
log::info!("Generating fstab...");
|
||||||
kira_system::fstabgen(MNT_DIR)?;
|
kira_system::fstabgen(MNT_DIR)?;
|
||||||
|
|
||||||
|
|
||||||
log::info!("Configuring locales...");
|
log::info!("Configuring locales...");
|
||||||
let loc_data = k_config.res_locale.as_ref().unwrap();
|
|
||||||
{
|
{
|
||||||
|
let loc_data = k_config.res_locale.as_ref().unwrap();
|
||||||
let lang_line = loc_data.lang_locale.locale_gen_line();
|
let lang_line = loc_data.lang_locale.locale_gen_line();
|
||||||
let formats_line = loc_data.formats_locale.locale_gen_line();
|
let formats_line = loc_data.formats_locale.locale_gen_line();
|
||||||
// Open locale.gen file in append mode
|
let mut loc_lines: Vec<String> = Vec::new();
|
||||||
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 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_") {
|
if !lang_line.starts_with("en_") && !formats_line.starts_with("en_") {
|
||||||
writeln!(locale_file, "en_US.UTF-8 UTF-8")?;
|
loc_lines.push("en_US.UTF-8 UTF-8".into());
|
||||||
}
|
}
|
||||||
|
// write formats locale if it is different from lang locale
|
||||||
|
if lang_line != formats_line {
|
||||||
|
loc_lines.push(formats_line);
|
||||||
|
}
|
||||||
|
loc_lines.push(lang_line);
|
||||||
|
|
||||||
|
locale_gen_write(&loc_gen_fn, &loc_lines)?;
|
||||||
}
|
}
|
||||||
kira_system::exec_cmd_chroot(MNT_DIR, "locale-gen", &vec![])?;
|
kira_system::exec_cmd_chroot(MNT_DIR, "locale-gen", &vec![])?;
|
||||||
|
|
||||||
|
log::info!("Kayboard conf: {}", k_config.res_keyboard.as_ref().unwrap());
|
||||||
|
|
||||||
//Simpler said.. it adds missing values for XKBLAYOUT=XX
|
//Simpler said.. it adds missing values for XKBLAYOUT=XX
|
||||||
//and XKBMODEL=XXXX to /etc/vconsole.conf
|
//and XKBMODEL=XXXX to /etc/vconsole.conf
|
||||||
|
|||||||
@@ -130,6 +130,12 @@ pub struct KeyboardStageResult {
|
|||||||
pub keyboard_layout: KeyboarLayout,
|
pub keyboard_layout: KeyboarLayout,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl std::fmt::Display for KeyboardStageResult {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
write!(f, "keyboard_model: {} | keyboard_layout: {}", &self.keyboard_model, &self.keyboard_layout)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum Message {
|
pub enum Message {
|
||||||
SelectKeyboardModel(KeyboarModel),
|
SelectKeyboardModel(KeyboarModel),
|
||||||
|
|||||||
@@ -59,13 +59,7 @@ impl LocaleData {
|
|||||||
// creates text to be appended to locale.gen file
|
// creates text to be appended to locale.gen file
|
||||||
// in case of C locale outputs empty string
|
// in case of C locale outputs empty string
|
||||||
pub fn locale_gen_line(&self) -> String {
|
pub fn locale_gen_line(&self) -> String {
|
||||||
if self.code == "C.UTF-8" {
|
format!("{} {}", &self.code, &self.charset)
|
||||||
String::new()
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
format!("{} {}", &self.code, &self.charset)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user