From 8b17fdd91d693b5760e05dae127c67ba55b75c40 Mon Sep 17 00:00:00 2001 From: Ward from fusion-voyager-3 Date: Fri, 23 Aug 2024 23:02:31 +0300 Subject: [PATCH] calculate Mib in code --- src/installation_progress_page/mod.rs | 56 ++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/src/installation_progress_page/mod.rs b/src/installation_progress_page/mod.rs index fa2266e..60d22f4 100644 --- a/src/installation_progress_page/mod.rs +++ b/src/installation_progress_page/mod.rs @@ -113,8 +113,60 @@ pub fn create_installation_script( .unwrap()); } } - "partition" => {} - "none" => {} + "partition" => { + if is_encrypted { + final_script.push_str(&strfmt::strfmt( + auto_btrfs::automatic_home_part_btrfs_locked_installation_prog, + &std::collections::HashMap::from([ + ("CHROOT_PATH".to_string(), "/media/pikaos/installation"), + ( + "AUTO_LUKS_PASSWORD".to_string(), + partition_method_automatic_luks_refcell.borrow().as_str(), + ), + ( + "ROOT_PART_SIZE_AS_I64_MIB".to_string(), + (partition_method_automatic_ratio_refcell.borrow().round() as i64 / 1048576).to_string().as_str(), + ) + ]), + ) + .unwrap()); + } else { + final_script.push_str(&strfmt::strfmt( + auto_btrfs::automatic_home_part_btrfs_open_installation_prog, + &std::collections::HashMap::from([ + ("CHROOT_PATH".to_string(), "/media/pikaos/installation"), + ( + "ROOT_PART_SIZE_AS_I64_MIB".to_string(), + (partition_method_automatic_ratio_refcell.borrow().round() as i64 / 1048576).to_string().as_str(), + ) + ]), + ) + .unwrap()); + } + } + "none" => { + if is_encrypted { + final_script.push_str(&strfmt::strfmt( + auto_btrfs::automatic_home_none_btrfs_locked_installation_prog, + &std::collections::HashMap::from([ + ("CHROOT_PATH".to_string(), "/media/pikaos/installation"), + ( + "AUTO_LUKS_PASSWORD".to_string(), + partition_method_automatic_luks_refcell.borrow().as_str(), + ) + ]), + ) + .unwrap()); + } else { + final_script.push_str(&strfmt::strfmt( + auto_btrfs::automatic_home_none_btrfs_open_installation_prog, + &std::collections::HashMap::from([ + ("CHROOT_PATH".to_string(), "/media/pikaos/installation"), + ]), + ) + .unwrap()); + } + } _ => panic!() } }