Continue working on installation stage

This commit is contained in:
kira committed 2026-11-01 16:25:05 +01:00
1 parent b5b5bd764a
commit 6f921f3ff0
4 files changed
+206 -84

No files matched your search

Generated
+121 -61
View File
@@ -69,6 +69,23 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04"
[[package]]
name = "annotate-snippets"
version = "0.12.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f211a51805bc641f3ad5b7664c77d2547af685cc33b4cd8d31964027a46f13f1"
dependencies = [
"anstyle",
"memchr",
"unicode-width",
]
[[package]]
name = "anstyle"
version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000"
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.104" version = "1.0.104"
@@ -101,6 +118,12 @@ dependencies = [
"syn 2.0.119", "syn 2.0.119",
] ]
[[package]]
name = "arraydeque"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d902e3d592a523def97af8f317b08ce16b7ab854c1985a0c671e6f15cebc236"
[[package]] [[package]]
name = "arrayref" name = "arrayref"
version = "0.3.9" version = "0.3.9"
@@ -258,13 +281,13 @@ dependencies = [
[[package]] [[package]]
name = "async-recursion" name = "async-recursion"
version = "1.1.1" version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" checksum = "4f8abc12baad266b1c8cec146854c195b5864b4221d4b2ca7296a7ae82d9e451"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.119", "syn 3.0.6",
] ]
[[package]] [[package]]
@@ -363,6 +386,12 @@ version = "2.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3a647dce9631f152a99ec16cfc09267ae55fe280d5dc288964027d458076323" checksum = "a3a647dce9631f152a99ec16cfc09267ae55fe280d5dc288964027d458076323"
[[package]]
name = "base64"
version = "0.23.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5"
[[package]] [[package]]
name = "bit-set" name = "bit-set"
version = "0.8.0" version = "0.8.0"
@@ -512,9 +541,9 @@ dependencies = [
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.5.1" version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f360145194ee8e21db5ee7f3fcd4fe52210864c75c985dae33218202c8bbe040" checksum = "f74872d07caf508b30a21f6836e7d7016a2eaf7d9ff4f48deaa58cd8a0407630"
dependencies = [ dependencies = [
"find-msvc-tools", "find-msvc-tools",
"jobserver", "jobserver",
@@ -649,6 +678,12 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "core_detect"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48"
[[package]] [[package]]
name = "core_maths" name = "core_maths"
version = "0.1.1" version = "0.1.1"
@@ -811,6 +846,29 @@ version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "252afb9ae5eaa683babdc6a068b3f5726eb19e05070c731f9b2a23a7c3e8ed34" checksum = "252afb9ae5eaa683babdc6a068b3f5726eb19e05070c731f9b2a23a7c3e8ed34"
[[package]]
name = "encoding_rs"
version = "0.8.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e985e0451871ad22fb8d2b6b076e2028a502a0d3950998c2c5c0a4f9b5d9679"
dependencies = [
"cfg-if",
"core_detect",
"multiversion_no_op",
"rustversion",
"scopeguard",
"simdutf8",
]
[[package]]
name = "encoding_rs_io"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fba3fe847045ecff794b9c138293a80db914678c453ad63fbf0c6a9eb6e00b22"
dependencies = [
"encoding_rs",
]
[[package]] [[package]]
name = "endi" name = "endi"
version = "1.1.1" version = "1.1.1"
@@ -1006,9 +1064,9 @@ dependencies = [
[[package]] [[package]]
name = "font-types" name = "font-types"
version = "0.12.5" version = "0.12.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8eb065f3251655b3c90e22e5e363f310fc5332fb3402e37bbc94752283248f6" checksum = "6c92d9081c7ab3bd83ef1eecdfad090f3d966e3ce74106779664114cfe1a6274"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
] ]
@@ -1269,6 +1327,16 @@ dependencies = [
"walkdir", "walkdir",
] ]
[[package]]
name = "granit-parser"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e20f99e46474f56bd905c56e817ebddcf377a611f94c53ac4649e4d3fa3c0cd0"
dependencies = [
"arraydeque",
"smallvec",
]
[[package]] [[package]]
name = "guillotiere" name = "guillotiere"
version = "0.6.2" version = "0.6.2"
@@ -1789,12 +1857,6 @@ dependencies = [
"smallvec", "smallvec",
] ]
[[package]]
name = "lazy_static"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]] [[package]]
name = "lebe" name = "lebe"
version = "0.5.3" version = "0.5.3"
@@ -1803,9 +1865,9 @@ checksum = "7a79a3332a6609480d7d0c9eab957bca6b455b91bb84e66d19f5ff66294b85b8"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.189" version = "0.2.190"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2" checksum = "ce5d3ddc6d3fa000eb1536d85e147bfe31aacaba692ed6a876f95cb7c855be78"
[[package]] [[package]]
name = "libfuzzer-sys" name = "libfuzzer-sys"
@@ -1972,6 +2034,12 @@ dependencies = [
"pxfm", "pxfm",
] ]
[[package]]
name = "multiversion_no_op"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "743fb55ba31b18fb1ecef6bdc9aa2743314978ac084044301a7eee33fb99a20d"
[[package]] [[package]]
name = "mundy" name = "mundy"
version = "0.2.3" version = "0.2.3"
@@ -2073,6 +2141,12 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "nohash-hasher"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451"
[[package]] [[package]]
name = "nom" name = "nom"
version = "8.0.0" version = "8.0.0"
@@ -2631,9 +2705,9 @@ checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
[[package]] [[package]]
name = "pin-utils" name = "pin-utils"
version = "0.1.0" version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" checksum = "13bee6c73da26345c729282832b60b0363cf3dd9f4bfd81d8551b7a1c889a113"
[[package]] [[package]]
name = "piper" name = "piper"
@@ -2979,7 +3053,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "046a7d674daf459825b32f5062056d6882db0d2f5a479fbd76ccfc870ac18709" checksum = "046a7d674daf459825b32f5062056d6882db0d2f5a479fbd76ccfc870ac18709"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"font-types 0.12.5", "font-types 0.12.6",
"once_cell", "once_cell",
] ]
@@ -3065,12 +3139,11 @@ checksum = "6c20b6793b5c2fa6553b250154b78d6d0db37e72700ae35fad9387a46f487c97"
[[package]] [[package]]
name = "rust-i18n" name = "rust-i18n"
version = "3.1.5" version = "4.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fda2551fdfaf6cc5ee283adc15e157047b92ae6535cf80f6d4962d05717dc332" checksum = "8502e73e6461c738659455c5d2cf95bc132760a6f203c717e66ee72b78906d7f"
dependencies = [ dependencies = [
"globwalk", "globwalk",
"once_cell",
"regex", "regex",
"rust-i18n-macro", "rust-i18n-macro",
"rust-i18n-support", "rust-i18n-support",
@@ -3079,39 +3152,34 @@ dependencies = [
[[package]] [[package]]
name = "rust-i18n-macro" name = "rust-i18n-macro"
version = "3.1.5" version = "4.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22baf7d7f56656d23ebe24f6bb57a5d40d2bce2a5f1c503e692b5b2fa450f965" checksum = "d54a28dd9d46108d56b9f0c85b220908844233e561c03087890325104f90f2c6"
dependencies = [ dependencies = [
"glob", "glob",
"once_cell",
"proc-macro2", "proc-macro2",
"quote", "quote",
"rust-i18n-support", "rust-i18n-support",
"serde", "serde",
"serde_json", "serde_json",
"serde_yaml",
"syn 2.0.119", "syn 2.0.119",
] ]
[[package]] [[package]]
name = "rust-i18n-support" name = "rust-i18n-support"
version = "3.1.5" version = "4.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "940ed4f52bba4c0152056d771e563b7133ad9607d4384af016a134b58d758f19" checksum = "e806c2a9701cbd6043992cd935c30cb1fdb128fa15e7b506f3b46f97045737c0"
dependencies = [ dependencies = [
"arc-swap", "arc-swap",
"base62", "base62",
"foldhash",
"globwalk", "globwalk",
"itertools 0.11.0", "itertools 0.11.0",
"lazy_static",
"normpath", "normpath",
"once_cell",
"proc-macro2",
"regex",
"serde", "serde",
"serde-saphyr",
"serde_json", "serde_json",
"serde_yaml",
"siphasher", "siphasher",
"toml", "toml",
"triomphe", "triomphe",
@@ -3170,12 +3238,6 @@ version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"
[[package]]
name = "ryu"
version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f"
[[package]] [[package]]
name = "same-file" name = "same-file"
version = "1.0.6" version = "1.0.6"
@@ -3213,6 +3275,23 @@ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]]
name = "serde-saphyr"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8050abb251097357e24aff63ba2c52a6309ecb7d23a5474023df960a02694d8"
dependencies = [
"annotate-snippets",
"base64",
"encoding_rs_io",
"granit-parser",
"nohash-hasher",
"num-traits",
"serde_core",
"smallvec",
"zmij",
]
[[package]] [[package]]
name = "serde_core" name = "serde_core"
version = "1.0.229" version = "1.0.229"
@@ -3266,19 +3345,6 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "serde_yaml"
version = "0.9.34+deprecated"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47"
dependencies = [
"indexmap",
"itoa",
"ryu",
"serde",
"unsafe-libyaml",
]
[[package]] [[package]]
name = "shlex" name = "shlex"
version = "2.0.1" version = "2.0.1"
@@ -3622,9 +3688,9 @@ checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee"
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "1.53.1" version = "1.53.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed" checksum = "e95f91fcc7a621e8b030f6aa23c71fe9838ae2fb4d8118b75602a328f5144044"
dependencies = [ dependencies = [
"pin-project-lite", "pin-project-lite",
] ]
@@ -3798,17 +3864,11 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254"
[[package]]
name = "unsafe-libyaml"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861"
[[package]] [[package]]
name = "uuid" name = "uuid"
version = "1.26.1" version = "1.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ef6dac1e96601b4fb3acccccff2139741fcb757cb9a36089bf5be91cfb285ce" checksum = "97277d36b9c3ace13e58fa6e753f8b0bbbf302a18dd193240d70f9e29681059a"
dependencies = [ dependencies = [
"js-sys", "js-sys",
"serde_core", "serde_core",
+1 -1
View File
@@ -12,7 +12,7 @@ iced = { version = "0.14", default-features = false, features = ["crisp", "linux
#iced = { git = "https://github.com/iced-rs/iced", branch = "vello_cpu", default-features = false, features = ["crisp", "linux-theme-detection", "vello-cpu", "x11", "smol", "image"]} #iced = { git = "https://github.com/iced-rs/iced", branch = "vello_cpu", default-features = false, features = ["crisp", "linux-theme-detection", "vello-cpu", "x11", "smol", "image"]}
iced_moving_picture = "0" iced_moving_picture = "0"
log = "0.4" log = "0.4"
rust-i18n = "3" rust-i18n = "4"
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }
serde_json = "1" serde_json = "1"
time-format = "1.2" time-format = "1.2"
+13
View File
@@ -270,6 +270,10 @@ impl PartInfo {
}) })
} }
///
/// Returns partition full path by partlabel "/dev/disk/by-partlabel/{partlabel}"
/// Returns None if partition do not have partlabel
///
pub fn partlabel_dev(&self) -> Option<String> { pub fn partlabel_dev(&self) -> Option<String> {
self.gpt_label self.gpt_label
.as_ref() .as_ref()
@@ -400,6 +404,15 @@ impl PartLayout {
} }
} }
pub fn get_part(&self, part_role: PartRole) -> Option<PartInfo> {
for part in &self.part_list {
if let Some(role) = &part.role && role.eq(&part_role) {
return Some(part.clone());
}
}
None
}
pub fn read_from_disk(dev: &BlkDev) -> Result<Self, String> { pub fn read_from_disk(dev: &BlkDev) -> Result<Self, String> {
let part_list = get_dev_part_blocking(&dev.name)?; let part_list = get_dev_part_blocking(&dev.name)?;
let parts_size = part_list let parts_size = part_list
+71 -22
View File
@@ -21,7 +21,7 @@
use std::path::Path; use std::path::Path;
use crate::{ use crate::{
kira_disk_layout::{self, BlkDev, FSType, PartLayout, PartRole}, kira_disk_layout::{self, BlkDev, FSType, PartInfo, PartLayout, PartRole},
kira_size::KiraSize, kira_size::KiraSize,
kira_system::{self, ExecCommandError}, kira_system::{self, ExecCommandError},
kira_theming, kira_theming,
@@ -87,9 +87,8 @@ pub fn bcachefs_init(
Ok(()) Ok(())
} }
pub fn init_disk(part_layout: &PartLayout, mnt_dir: &str) -> Result<(), ExecCommandError> { pub fn init_disk(part_layout: &PartLayout, mnt_dir: &str) -> Result<(), ExecCommandError> {
let mnt_path = Path::new(mnt_dir); let mnt_path = Path::new(mnt_dir);
log::info!("Cheking is MNT path exists: {}", mnt_dir); log::info!("Cheking is MNT path exists: {}", mnt_dir);
if !mnt_path.exists() { if !mnt_path.exists() {
@@ -105,6 +104,7 @@ pub fn init_disk(part_layout: &PartLayout, mnt_dir: &str) -> Result<(), ExecComm
match part.role { match part.role {
Some(PartRole::EFI) => { Some(PartRole::EFI) => {
if let Some(part_l) = part.partlabel_dev() { if let Some(part_l) = part.partlabel_dev() {
log::info!("Formating EFI partition.");
kira_system::mkfs_esp(&part_l)?; kira_system::mkfs_esp(&part_l)?;
} }
} }
@@ -112,10 +112,11 @@ pub fn init_disk(part_layout: &PartLayout, mnt_dir: &str) -> Result<(), ExecComm
if let Some(part_l) = part.partlabel_dev() { if let Some(part_l) = part.partlabel_dev() {
if let FSType::BCACHEFS(bc_par) = &part.fs_type { if let FSType::BCACHEFS(bc_par) = &part.fs_type {
log::info!("Formating root pertition."); log::info!("Formating root pertition.");
kira_system::bcachefs_format(&part_l, bc_par.password.clone(), bc_par.password.clone())?; kira_system::bcachefs_format(
// init root &part_l,
log::info!("Mount and init root partition."); bc_par.comp_alg.clone(),
bcachefs_init(ROOT_PARTLABEL_DEV, mnt_dir, bc_par.password.clone())?; bc_par.password.clone(),
)?;
} else { } else {
return Err(ExecCommandError::Other( return Err(ExecCommandError::Other(
"ROOT partition is not BCACHEFS type!".into(), "ROOT partition is not BCACHEFS type!".into(),
@@ -125,6 +126,7 @@ pub fn init_disk(part_layout: &PartLayout, mnt_dir: &str) -> Result<(), ExecComm
} }
Some(PartRole::SWAP) => { Some(PartRole::SWAP) => {
if let Some(part_l) = part.partlabel_dev() { if let Some(part_l) = part.partlabel_dev() {
log::info!("Formating SWAP partition.");
kira_system::mkswap(&part_l)?; kira_system::mkswap(&part_l)?;
} }
} }
@@ -161,7 +163,7 @@ pub struct InstallStage {
pub enum Message { pub enum Message {
UserConfirms, UserConfirms,
UserDenies, UserDenies,
Sucess, Success,
Cancel, Cancel,
Finish, Finish,
UpdateProgress(Result<(f32, String), String>), UpdateProgress(Result<(f32, String), String>),
@@ -174,11 +176,40 @@ pub enum Update {
Task(Task<Message>), Task(Task<Message>),
} }
pub fn mount_and_init_root(
part_layout: &PartLayout,
mnt_dir: &str,
) -> Result<(), ExecCommandError> {
// init root
let root_part = part_layout.get_part(PartRole::ROOT).expect("Root partition must be present!");
log::info!("Mount and init root partition.");
if let FSType::BCACHEFS(bcache_prop) = root_part.fs_type {
bcachefs_init(ROOT_PARTLABEL_DEV, mnt_dir, bcache_prop.password.clone())?;
}
else {
return Err(ExecCommandError::Other(format!("Unexpected root partition type: {}", root_part.fs_type)));
}
Ok(())
}
async fn init_disk_async(part_layout: PartLayout, mnt_dir: String) -> Result<(), ExecCommandError> { async fn init_disk_async(part_layout: PartLayout, mnt_dir: String) -> Result<(), ExecCommandError> {
use blocking; use blocking;
blocking::unblock(move || init_disk(&part_layout, &mnt_dir)).await blocking::unblock(move || init_disk(&part_layout, &mnt_dir)).await
} }
async fn mount_and_init_root_async(part_layout: PartLayout, mnt_dir: String) -> Result<(), ExecCommandError> {
use blocking;
blocking::unblock(move || mount_and_init_root(&part_layout, &mnt_dir)).await
}
// async fn install_base(mnt_dir: String) -> Result<(), ExecCommandError> {
// use blocking;
// blocking::unblock(move || init_disk(&part_layout, &mnt_dir)).await
// }
fn do_install( fn do_install(
k_config: KiraConfig, k_config: KiraConfig,
) -> impl futures::Stream<Item = Result<(f32, String), ExecCommandError>> { ) -> impl futures::Stream<Item = Result<(f32, String), ExecCommandError>> {
@@ -189,7 +220,7 @@ fn do_install(
let disk_layout = k_config.res_partition.unwrap().part_layout.clone(); let disk_layout = k_config.res_partition.unwrap().part_layout.clone();
// creating gpt partition table // creating gpt partition table
let res = init_disk_async(disk_layout, MNT_DIR.into()).await; let res = init_disk_async(disk_layout.clone(), MNT_DIR.into()).await;
let res_err = res.is_err(); let res_err = res.is_err();
output output
.send(res.map(|_| (1.1f32, "Formatting bcachefs".into()))) .send(res.map(|_| (1.1f32, "Formatting bcachefs".into())))
@@ -200,6 +231,18 @@ fn do_install(
return; return;
} }
// Mount and init root
let res = mount_and_init_root_async(disk_layout, MNT_DIR.into()).await;
let res_err = res.is_err();
output
.send(res.map(|_| (5.1f32, "Installing base".into())))
.await
.unwrap();
if res_err {
return;
}
// Check if send fails (receiver dropped/cancelled) // Check if send fails (receiver dropped/cancelled)
// if output.send(res).await.is_err() { // if output.send(res).await.is_err() {
// return; // Exit early if UI is gone // return; // Exit early if UI is gone
@@ -211,16 +254,24 @@ fn do_install(
) )
} }
fn check_kconfig(k_config: &KiraConfig) -> Result<(), String> { fn check_kconfig(k_config: &KiraConfig) -> Result<(), String> {
if k_config.res_welcome.is_none(){ Err("Missing wellcome stage result!".into())} if k_config.res_welcome.is_none() {
else if k_config.res_license == false { Err("License is NOT accepted!".into())} Err("Missing wellcome stage result!".into())
else if k_config.res_locale.is_none(){ Err("Missing locale stage result!".into())} } else if k_config.res_license == false {
else if k_config.res_network.is_none(){ Err("Missing network stage result!".into())} Err("License is NOT accepted!".into())
else if k_config.res_keyboard.is_none(){ Err("Missing keyboard stage result!".into())} } else if k_config.res_locale.is_none() {
else if k_config.res_timezone.is_none(){ Err("Missing timezone stage result!".into())} Err("Missing locale stage result!".into())
else if k_config.res_partition.is_none(){ Err("Missing partition stage result!".into())} } else if k_config.res_network.is_none() {
else if k_config.res_security.is_none(){ Err("Missing security stage result!".into())} Err("Missing network stage result!".into())
else { } else if k_config.res_keyboard.is_none() {
Err("Missing keyboard stage result!".into())
} else if k_config.res_timezone.is_none() {
Err("Missing timezone stage result!".into())
} else if k_config.res_partition.is_none() {
Err("Missing partition stage result!".into())
} else if k_config.res_security.is_none() {
Err("Missing security stage result!".into())
} else {
Ok(()) Ok(())
} }
} }
@@ -247,7 +298,6 @@ impl InstallStage {
match message { match message {
Message::UserDenies => Update::StgAct(StageAction::Back), Message::UserDenies => Update::StgAct(StageAction::Back),
Message::UserConfirms => { Message::UserConfirms => {
log::info!("Cheking config..."); log::info!("Cheking config...");
match check_kconfig(&self.k_config) { match check_kconfig(&self.k_config) {
Ok(()) => log::info!("Config looks good."), Ok(()) => log::info!("Config looks good."),
@@ -258,7 +308,6 @@ impl InstallStage {
} }
} }
// starting installation process here // starting installation process here
log::info!("Starting disk partitioning."); log::info!("Starting disk partitioning.");
@@ -289,7 +338,7 @@ impl InstallStage {
Update::StgAct(StageAction::Abort) Update::StgAct(StageAction::Abort)
} }
Message::Cancel => Update::StgAct(StageAction::Abort), Message::Cancel => Update::StgAct(StageAction::Abort),
Message::Sucess => Update::StgAct(StageAction::None), Message::Success => Update::StgAct(StageAction::None),
Message::Finish => Update::StgAct(StageAction::None), Message::Finish => Update::StgAct(StageAction::None),
} }
} }