crypttab support

This commit is contained in:
Ward from fusion-voyager-3 2024-08-22 21:41:37 +03:00
parent c81a3b06bf
commit 10a3497a0c
2 changed files with 91 additions and 60 deletions

View File

@ -112,6 +112,9 @@
"install_confirm_detail_partition_method_automatic_seperation_title": "Seperate /home ?",
"install_confirm_detail_partition_method_automatic_ratio_title": "/ to /home Ratio",
"install_confirm_detail_partition_method_automatic_ratio_subtitle": "(/) Will Have {ROOT_PER}% of Usable Disk Space ({ROOT_SIZE})\n(/home) Will Have {HOME_PER}% of Usable Disk Space ({HOME_SIZE})",
"install_confirm_detail_partition_method_manual_crypttab_entry_title": "Manual Crypttab Entry",
"install_confirm_detail_partition_method_manual_crypttab_entry_subtitle_auto": "{LUKS_NAME} Unlocked Automatically With Root Unlock",
"install_confirm_detail_partition_method_manual_crypttab_entry_subtitle_manual": "{LUKS_NAME} Unlocked Manually Via Password On System Startup",
"mounted_on_detail": " mounted on ",
"install_target_detail": "Install Target:",
"install_confirm_button_label": "Confirm & Install PikaOS"

View File

@ -91,6 +91,8 @@ pub fn installation_summary_page(
partition_method_automatic_seperation_refcell,
#[strong]
partition_method_automatic_ratio_refcell,
#[strong]
partition_method_manual_crypttab_entry_array_refcell,
move|_, action_arg|
{
let action_arg = String::from_utf8_lossy(action_arg.unwrap().data());
@ -147,7 +149,8 @@ pub fn installation_summary_page(
install_confirm_detail_partition_method_type.add_css_class("property");
installation_summary_row_viewport_listbox.append(&install_confirm_detail_partition_method_type);
//
if &*partition_method_type_refcell.borrow().as_str() == "automatic" {
match &*partition_method_type_refcell.borrow().as_str() {
"automatic" => {
let install_confirm_detail_partition_method_automatic_target = adw::ActionRow::builder()
.title(t!("install_confirm_detail_partition_method_automatic_target_title"))
.subtitle(strfmt::strfmt(&t!("install_confirm_detail_partition_method_automatic_target_subtitle"), &std::collections::HashMap::from([("DISK_SIZE".to_string(), partition_method_automatic_target_refcell.borrow().block_size_pretty.as_str()), ("DISK_NAME".to_string(), partition_method_automatic_target_refcell.borrow().block_name.as_str())])).unwrap())
@ -210,6 +213,31 @@ pub fn installation_summary_page(
_ => panic!()
}
}
"manual" => {
if *partition_method_manual_luks_enabled {
for crypttab_entry in partition_method_manual_crypttab_entry_array_refcell.borrow().iter() {
let crypttab_entry_map = &crypttab_entry.map;
let install_confirm_detail_partition_method_manual_crypttab_entry_subtitle = if crypttab_entry.password.is_some() {
t!("install_confirm_detail_partition_method_manual_crypttab_entry_subtitle_auto")
} else {
t!("install_confirm_detail_partition_method_manual_crypttab_entry_subtitle_manual")
};
let install_confirm_detail_partition_method_manual_crypttab_entry = adw::ActionRow::builder()
.title(t!("install_confirm_detail_partition_method_manual_crypttab_entry_title"))
.subtitle(strfmt::strfmt(
&install_confirm_detail_partition_method_manual_crypttab_entry_subtitle,
&std::collections::HashMap::from([
("LUKS_NAME".to_string(), (crypttab_entry_map).to_string().as_str()),
])
).unwrap())
.build();
install_confirm_detail_partition_method_manual_crypttab_entry.add_css_class("property");
installation_summary_row_viewport_listbox.append(&install_confirm_detail_partition_method_manual_crypttab_entry);
}
}
}
_ => panic!()
}
}
}
)