luks support
This commit is contained in:
parent
b4724f7168
commit
8254999555
@ -26,7 +26,7 @@ pub fn create_efi_row(
|
|||||||
partition_array: &Vec<Partition>,
|
partition_array: &Vec<Partition>,
|
||||||
partition_changed_action: &gio::SimpleAction,
|
partition_changed_action: &gio::SimpleAction,
|
||||||
language_changed_action: &gio::SimpleAction,
|
language_changed_action: &gio::SimpleAction,
|
||||||
used_partition_array_refcell: &Rc<RefCell<Vec<String>>>,
|
used_partition_array_refcell: &Rc<RefCell<Vec<FstabEntry>>>,
|
||||||
subvol_partition_array_refcell: &Rc<RefCell<Vec<String>>>,
|
subvol_partition_array_refcell: &Rc<RefCell<Vec<String>>>,
|
||||||
) {
|
) {
|
||||||
let partition_scroll_child = gtk::ListBox::builder()
|
let partition_scroll_child = gtk::ListBox::builder()
|
||||||
@ -83,7 +83,34 @@ pub fn create_efi_row(
|
|||||||
.clone()
|
.clone()
|
||||||
.borrow()
|
.borrow()
|
||||||
.iter()
|
.iter()
|
||||||
.any(|e| part_name == e && part_name != &row.partition())
|
.any(|e| {
|
||||||
|
(part_name == &e.partition.part_name && part_name != &row.partition()) && (e.mountopts.contains("subvol=") || e.mountopts.contains("subvolid"))
|
||||||
|
})
|
||||||
|
{
|
||||||
|
PartitionRow {
|
||||||
|
widget: {
|
||||||
|
let prow = adw::ActionRow::builder()
|
||||||
|
.activatable_widget(&partition_button)
|
||||||
|
.title(part_name)
|
||||||
|
.subtitle(
|
||||||
|
String::from(&partition.part_fs)
|
||||||
|
+ " "
|
||||||
|
+ &pretty_bytes::converter::convert(partition.part_size),
|
||||||
|
)
|
||||||
|
.sensitive(false)
|
||||||
|
.build();
|
||||||
|
prow
|
||||||
|
},
|
||||||
|
swap_fs_error: Rc::new(RefCell::new(false)),
|
||||||
|
hardcode_fs_error: Rc::new(RefCell::new(false)),
|
||||||
|
used: Rc::new(RefCell::new(2)),
|
||||||
|
never: Rc::new(RefCell::new(false)),
|
||||||
|
}
|
||||||
|
} else if used_partition_array_refcell
|
||||||
|
.clone()
|
||||||
|
.borrow()
|
||||||
|
.iter()
|
||||||
|
.any(|e| part_name == &e.partition.part_name && part_name != &row.partition())
|
||||||
{
|
{
|
||||||
PartitionRow {
|
PartitionRow {
|
||||||
widget: {
|
widget: {
|
||||||
@ -202,7 +229,8 @@ pub fn create_efi_row(
|
|||||||
partition_changed_action,
|
partition_changed_action,
|
||||||
move |row: DriveMountRow| {
|
move |row: DriveMountRow| {
|
||||||
listbox.remove(&row);
|
listbox.remove(&row);
|
||||||
(*used_partition_array_refcell.borrow_mut()).retain(|x| x != &row.partition());
|
(*used_partition_array_refcell.borrow_mut())
|
||||||
|
.retain(|x| &x.partition.part_name != &row.partition());
|
||||||
partition_changed_action.activate(None);
|
partition_changed_action.activate(None);
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
@ -215,7 +243,7 @@ pub fn create_boot_row(
|
|||||||
partition_array: &Vec<Partition>,
|
partition_array: &Vec<Partition>,
|
||||||
partition_changed_action: &gio::SimpleAction,
|
partition_changed_action: &gio::SimpleAction,
|
||||||
language_changed_action: &gio::SimpleAction,
|
language_changed_action: &gio::SimpleAction,
|
||||||
used_partition_array_refcell: &Rc<RefCell<Vec<String>>>,
|
used_partition_array_refcell: &Rc<RefCell<Vec<FstabEntry>>>,
|
||||||
subvol_partition_array_refcell: &Rc<RefCell<Vec<String>>>,
|
subvol_partition_array_refcell: &Rc<RefCell<Vec<String>>>,
|
||||||
) {
|
) {
|
||||||
let partition_scroll_child = gtk::ListBox::builder()
|
let partition_scroll_child = gtk::ListBox::builder()
|
||||||
@ -272,7 +300,34 @@ pub fn create_boot_row(
|
|||||||
.clone()
|
.clone()
|
||||||
.borrow()
|
.borrow()
|
||||||
.iter()
|
.iter()
|
||||||
.any(|e| part_name == e && part_name != &row.partition())
|
.any(|e| {
|
||||||
|
(part_name == &e.partition.part_name && part_name != &row.partition()) && (e.mountopts.contains("subvol=") || e.mountopts.contains("subvolid"))
|
||||||
|
})
|
||||||
|
{
|
||||||
|
PartitionRow {
|
||||||
|
widget: {
|
||||||
|
let prow = adw::ActionRow::builder()
|
||||||
|
.activatable_widget(&partition_button)
|
||||||
|
.title(part_name)
|
||||||
|
.subtitle(
|
||||||
|
String::from(&partition.part_fs)
|
||||||
|
+ " "
|
||||||
|
+ &pretty_bytes::converter::convert(partition.part_size),
|
||||||
|
)
|
||||||
|
.sensitive(true)
|
||||||
|
.build();
|
||||||
|
prow
|
||||||
|
},
|
||||||
|
swap_fs_error: Rc::new(RefCell::new(false)),
|
||||||
|
hardcode_fs_error: Rc::new(RefCell::new(false)),
|
||||||
|
used: Rc::new(RefCell::new(2)),
|
||||||
|
never: Rc::new(RefCell::new(false)),
|
||||||
|
}
|
||||||
|
} else if used_partition_array_refcell
|
||||||
|
.clone()
|
||||||
|
.borrow()
|
||||||
|
.iter()
|
||||||
|
.any(|e| part_name == &e.partition.part_name && part_name != &row.partition())
|
||||||
{
|
{
|
||||||
PartitionRow {
|
PartitionRow {
|
||||||
widget: {
|
widget: {
|
||||||
@ -391,7 +446,8 @@ pub fn create_boot_row(
|
|||||||
partition_changed_action,
|
partition_changed_action,
|
||||||
move |row: DriveMountRow| {
|
move |row: DriveMountRow| {
|
||||||
listbox.remove(&row);
|
listbox.remove(&row);
|
||||||
(*used_partition_array_refcell.borrow_mut()).retain(|x| x != &row.partition());
|
(*used_partition_array_refcell.borrow_mut())
|
||||||
|
.retain(|x| &x.partition.part_name != &row.partition());
|
||||||
partition_changed_action.activate(None);
|
partition_changed_action.activate(None);
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
@ -404,7 +460,7 @@ pub fn create_root_row(
|
|||||||
partition_array: &Vec<Partition>,
|
partition_array: &Vec<Partition>,
|
||||||
partition_changed_action: &gio::SimpleAction,
|
partition_changed_action: &gio::SimpleAction,
|
||||||
language_changed_action: &gio::SimpleAction,
|
language_changed_action: &gio::SimpleAction,
|
||||||
used_partition_array_refcell: &Rc<RefCell<Vec<String>>>,
|
used_partition_array_refcell: &Rc<RefCell<Vec<FstabEntry>>>,
|
||||||
subvol_partition_array_refcell: &Rc<RefCell<Vec<String>>>,
|
subvol_partition_array_refcell: &Rc<RefCell<Vec<String>>>,
|
||||||
) {
|
) {
|
||||||
let partition_scroll_child = gtk::ListBox::builder()
|
let partition_scroll_child = gtk::ListBox::builder()
|
||||||
@ -461,7 +517,34 @@ pub fn create_root_row(
|
|||||||
.clone()
|
.clone()
|
||||||
.borrow()
|
.borrow()
|
||||||
.iter()
|
.iter()
|
||||||
.any(|e| part_name == e && part_name != &row.partition())
|
.any(|e| {
|
||||||
|
(part_name == &e.partition.part_name && part_name != &row.partition()) && (e.mountopts.contains("subvol=") || e.mountopts.contains("subvolid"))
|
||||||
|
})
|
||||||
|
{
|
||||||
|
PartitionRow {
|
||||||
|
widget: {
|
||||||
|
let prow = adw::ActionRow::builder()
|
||||||
|
.activatable_widget(&partition_button)
|
||||||
|
.title(part_name)
|
||||||
|
.subtitle(
|
||||||
|
String::from(&partition.part_fs)
|
||||||
|
+ " "
|
||||||
|
+ &pretty_bytes::converter::convert(partition.part_size),
|
||||||
|
)
|
||||||
|
.sensitive(false)
|
||||||
|
.build();
|
||||||
|
prow
|
||||||
|
},
|
||||||
|
swap_fs_error: Rc::new(RefCell::new(false)),
|
||||||
|
hardcode_fs_error: Rc::new(RefCell::new(false)),
|
||||||
|
used: Rc::new(RefCell::new(2)),
|
||||||
|
never: Rc::new(RefCell::new(false)),
|
||||||
|
}
|
||||||
|
} else if used_partition_array_refcell
|
||||||
|
.clone()
|
||||||
|
.borrow()
|
||||||
|
.iter()
|
||||||
|
.any(|e| part_name == &e.partition.part_name && part_name != &row.partition())
|
||||||
{
|
{
|
||||||
PartitionRow {
|
PartitionRow {
|
||||||
widget: {
|
widget: {
|
||||||
@ -585,7 +668,8 @@ pub fn create_root_row(
|
|||||||
partition_changed_action,
|
partition_changed_action,
|
||||||
move |row: DriveMountRow| {
|
move |row: DriveMountRow| {
|
||||||
listbox.remove(&row);
|
listbox.remove(&row);
|
||||||
(*used_partition_array_refcell.borrow_mut()).retain(|x| x != &row.partition());
|
(*used_partition_array_refcell.borrow_mut())
|
||||||
|
.retain(|x| &x.partition.part_name != &row.partition());
|
||||||
partition_changed_action.activate(None);
|
partition_changed_action.activate(None);
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
@ -598,7 +682,7 @@ pub fn create_mount_row(
|
|||||||
partition_array: &Vec<Partition>,
|
partition_array: &Vec<Partition>,
|
||||||
partition_changed_action: &gio::SimpleAction,
|
partition_changed_action: &gio::SimpleAction,
|
||||||
language_changed_action: &gio::SimpleAction,
|
language_changed_action: &gio::SimpleAction,
|
||||||
used_partition_array_refcell: &Rc<RefCell<Vec<String>>>,
|
used_partition_array_refcell: &Rc<RefCell<Vec<FstabEntry>>>,
|
||||||
subvol_partition_array_refcell: &Rc<RefCell<Vec<String>>>,
|
subvol_partition_array_refcell: &Rc<RefCell<Vec<String>>>,
|
||||||
) {
|
) {
|
||||||
let partition_scroll_child = gtk::ListBox::builder()
|
let partition_scroll_child = gtk::ListBox::builder()
|
||||||
@ -653,7 +737,34 @@ pub fn create_mount_row(
|
|||||||
.clone()
|
.clone()
|
||||||
.borrow()
|
.borrow()
|
||||||
.iter()
|
.iter()
|
||||||
.any(|e| part_name == e && part_name != &row.partition())
|
.any(|e| {
|
||||||
|
(part_name == &e.partition.part_name && part_name != &row.partition()) && (e.mountopts.contains("subvol=") || e.mountopts.contains("subvolid"))
|
||||||
|
})
|
||||||
|
{
|
||||||
|
PartitionRow {
|
||||||
|
widget: {
|
||||||
|
let prow = adw::ActionRow::builder()
|
||||||
|
.activatable_widget(&partition_button)
|
||||||
|
.title(part_name)
|
||||||
|
.subtitle(
|
||||||
|
String::from(&partition.part_fs)
|
||||||
|
+ " "
|
||||||
|
+ &pretty_bytes::converter::convert(partition.part_size),
|
||||||
|
)
|
||||||
|
.sensitive(true)
|
||||||
|
.build();
|
||||||
|
prow
|
||||||
|
},
|
||||||
|
swap_fs_error: Rc::new(RefCell::new(false)),
|
||||||
|
hardcode_fs_error: Rc::new(RefCell::new(false)),
|
||||||
|
used: Rc::new(RefCell::new(2)),
|
||||||
|
never: Rc::new(RefCell::new(false)),
|
||||||
|
}
|
||||||
|
} else if used_partition_array_refcell
|
||||||
|
.clone()
|
||||||
|
.borrow()
|
||||||
|
.iter()
|
||||||
|
.any(|e| part_name == &e.partition.part_name && part_name != &row.partition())
|
||||||
{
|
{
|
||||||
PartitionRow {
|
PartitionRow {
|
||||||
widget: {
|
widget: {
|
||||||
@ -669,8 +780,8 @@ pub fn create_mount_row(
|
|||||||
.build();
|
.build();
|
||||||
prow
|
prow
|
||||||
},
|
},
|
||||||
hardcode_fs_error: Rc::new(RefCell::new(false)),
|
|
||||||
swap_fs_error: Rc::new(RefCell::new(false)),
|
swap_fs_error: Rc::new(RefCell::new(false)),
|
||||||
|
hardcode_fs_error: Rc::new(RefCell::new(false)),
|
||||||
used: Rc::new(RefCell::new(1)),
|
used: Rc::new(RefCell::new(1)),
|
||||||
never: Rc::new(RefCell::new(false)),
|
never: Rc::new(RefCell::new(false)),
|
||||||
}
|
}
|
||||||
@ -715,11 +826,6 @@ pub fn create_mount_row(
|
|||||||
#[strong]
|
#[strong]
|
||||||
row,
|
row,
|
||||||
move |_| {
|
move |_| {
|
||||||
if row.mountopts().contains("subvol=") || row.mountopts().contains("subvolid") {
|
|
||||||
(*subvol_partition_array_refcell.borrow_mut()).push(row.partition());
|
|
||||||
} else {
|
|
||||||
(*subvol_partition_array_refcell.borrow_mut()).retain(|x| x != &row.partition());
|
|
||||||
}
|
|
||||||
partition_changed_action.activate(None);
|
partition_changed_action.activate(None);
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
@ -740,7 +846,8 @@ pub fn create_mount_row(
|
|||||||
partition_changed_action,
|
partition_changed_action,
|
||||||
move |row: DriveMountRow| {
|
move |row: DriveMountRow| {
|
||||||
listbox.remove(&row);
|
listbox.remove(&row);
|
||||||
(*used_partition_array_refcell.borrow_mut()).retain(|x| x != &row.partition());
|
(*used_partition_array_refcell.borrow_mut())
|
||||||
|
.retain(|x| &x.partition.part_name != &row.partition());
|
||||||
partition_changed_action.activate(None);
|
partition_changed_action.activate(None);
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
@ -753,7 +860,7 @@ fn post_check_drive_mount(
|
|||||||
partition_button: >k::CheckButton,
|
partition_button: >k::CheckButton,
|
||||||
partition_changed_action: &gio::SimpleAction,
|
partition_changed_action: &gio::SimpleAction,
|
||||||
partition: &Partition,
|
partition: &Partition,
|
||||||
used_partition_array_refcell: &Rc<RefCell<Vec<String>>>,
|
used_partition_array_refcell: &Rc<RefCell<Vec<FstabEntry>>>,
|
||||||
subvol_partition_array_refcell: &Rc<RefCell<Vec<String>>>,
|
subvol_partition_array_refcell: &Rc<RefCell<Vec<String>>>,
|
||||||
) {
|
) {
|
||||||
partition_row_struct.widget.add_prefix(partition_button);
|
partition_row_struct.widget.add_prefix(partition_button);
|
||||||
@ -769,13 +876,6 @@ fn post_check_drive_mount(
|
|||||||
#[strong]
|
#[strong]
|
||||||
partition,
|
partition,
|
||||||
move |_| {
|
move |_| {
|
||||||
if partition_button.is_active() == true {
|
|
||||||
let part_name = &partition.part_name;
|
|
||||||
row.set_partition(part_name.to_string());
|
|
||||||
(*used_partition_array_refcell.borrow_mut()).push(part_name.to_string());
|
|
||||||
} else {
|
|
||||||
(*used_partition_array_refcell.borrow_mut()).retain(|x| x != &partition.part_name);
|
|
||||||
}
|
|
||||||
partition_changed_action.activate(None);
|
partition_changed_action.activate(None);
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
@ -811,6 +911,8 @@ fn post_check_drive_mount(
|
|||||||
));
|
));
|
||||||
|
|
||||||
partition_changed_action.connect_activate(clone!(
|
partition_changed_action.connect_activate(clone!(
|
||||||
|
#[weak]
|
||||||
|
partition_button,
|
||||||
#[strong]
|
#[strong]
|
||||||
partition_row_struct,
|
partition_row_struct,
|
||||||
#[strong]
|
#[strong]
|
||||||
@ -822,28 +924,27 @@ fn post_check_drive_mount(
|
|||||||
#[strong]
|
#[strong]
|
||||||
subvol_partition_array_refcell,
|
subvol_partition_array_refcell,
|
||||||
move |_, _| {
|
move |_, _| {
|
||||||
|
if partition_button.is_active() == true {
|
||||||
|
let part_name = &partition.part_name;
|
||||||
|
row.set_partition(part_name.to_string());
|
||||||
|
(*used_partition_array_refcell.borrow_mut())
|
||||||
|
.push(DriveMountRow::get_fstab_entry(&row));
|
||||||
|
} else {
|
||||||
|
(*used_partition_array_refcell.borrow_mut())
|
||||||
|
.retain(|x| &x.partition.part_name != &partition.part_name);
|
||||||
|
}
|
||||||
|
if row.mountopts().contains("subvol=") || row.mountopts().contains("subvolid") {
|
||||||
|
(*subvol_partition_array_refcell.borrow_mut()).push(row.partition());
|
||||||
|
} else {
|
||||||
|
(*subvol_partition_array_refcell.borrow_mut()).retain(|x| x != &partition.part_name);
|
||||||
|
}
|
||||||
let part_name = &partition.part_name;
|
let part_name = &partition.part_name;
|
||||||
let used_partition_array = used_partition_array_refcell.borrow();
|
let used_partition_array = used_partition_array_refcell.borrow();
|
||||||
let subvol_partition_array = subvol_partition_array_refcell.borrow();
|
let subvol_partition_array = subvol_partition_array_refcell.borrow();
|
||||||
if used_partition_array
|
if used_partition_array
|
||||||
.iter()
|
.iter()
|
||||||
.any(|e| part_name == e && part_name != &row.partition())
|
.any(|e| part_name == &e.partition.part_name && part_name != &row.partition())
|
||||||
{
|
{
|
||||||
if subvol_partition_array
|
|
||||||
.iter()
|
|
||||||
.any(|e| part_name == e && part_name != &row.partition())
|
|
||||||
{
|
|
||||||
if *partition_row_struct.never.borrow() == false
|
|
||||||
&& *partition_row_struct.swap_fs_error.borrow() == false
|
|
||||||
&& *partition_row_struct.hardcode_fs_error.borrow() == false
|
|
||||||
{
|
|
||||||
partition_row_struct.widget.set_sensitive(true);
|
|
||||||
}
|
|
||||||
(*partition_row_struct.used.borrow_mut()) = 2;
|
|
||||||
} else {
|
|
||||||
partition_row_struct.widget.set_sensitive(false);
|
|
||||||
(*partition_row_struct.used.borrow_mut()) = 1;
|
|
||||||
}
|
|
||||||
} else if *partition_row_struct.never.borrow() == false
|
} else if *partition_row_struct.never.borrow() == false
|
||||||
&& *partition_row_struct.swap_fs_error.borrow() == false
|
&& *partition_row_struct.swap_fs_error.borrow() == false
|
||||||
&& *partition_row_struct.hardcode_fs_error.borrow() == false
|
&& *partition_row_struct.hardcode_fs_error.borrow() == false
|
||||||
@ -851,6 +952,24 @@ fn post_check_drive_mount(
|
|||||||
partition_row_struct.widget.set_sensitive(true);
|
partition_row_struct.widget.set_sensitive(true);
|
||||||
(*partition_row_struct.used.borrow_mut()) = 0;
|
(*partition_row_struct.used.borrow_mut()) = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if subvol_partition_array
|
||||||
|
.iter()
|
||||||
|
.any(|e| part_name == e && part_name != &row.partition())
|
||||||
|
{
|
||||||
|
println!("fuvk2");
|
||||||
|
if *partition_row_struct.never.borrow() == false
|
||||||
|
&& *partition_row_struct.swap_fs_error.borrow() == false
|
||||||
|
&& *partition_row_struct.hardcode_fs_error.borrow() == false
|
||||||
|
{
|
||||||
|
partition_row_struct.widget.set_sensitive(true);
|
||||||
|
}
|
||||||
|
(*partition_row_struct.used.borrow_mut()) = 2;
|
||||||
|
} else {
|
||||||
|
println!("fuvk");
|
||||||
|
partition_row_struct.widget.set_sensitive(false);
|
||||||
|
(*partition_row_struct.used.borrow_mut()) = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
use crate::drive_mount_row::DriveMountRow;
|
use crate::drive_mount_row::DriveMountRow;
|
||||||
use crate::installer_stack_page;
|
use crate::installer_stack_page;
|
||||||
use crate::partitioning_page;
|
use crate::partitioning_page;
|
||||||
|
use crate::partitioning_page::get_luks_uuid;
|
||||||
use crate::partitioning_page::{get_partitions, CrypttabEntry, FstabEntry, Partition};
|
use crate::partitioning_page::{get_partitions, CrypttabEntry, FstabEntry, Partition};
|
||||||
use adw::gio;
|
use adw::gio;
|
||||||
use adw::prelude::*;
|
use adw::prelude::*;
|
||||||
use glib::{clone, closure_local, ffi::gboolean};
|
use glib::{clone, closure_local, ffi::gboolean};
|
||||||
use gtk::{glib, prelude::*, Orientation};
|
use gtk::{glib, prelude::*, Orientation};
|
||||||
use std::{cell::RefCell, collections::HashSet, rc::Rc};
|
use std::{cell::RefCell, collections::HashSet, rc::Rc};
|
||||||
use crate::partitioning_page::get_luks_uuid;
|
|
||||||
|
|
||||||
mod func;
|
mod func;
|
||||||
|
|
||||||
@ -25,10 +25,11 @@ pub fn manual_partitioning_page(
|
|||||||
manual_partitioning_page.set_back_visible(true);
|
manual_partitioning_page.set_back_visible(true);
|
||||||
manual_partitioning_page.set_next_visible(true);
|
manual_partitioning_page.set_next_visible(true);
|
||||||
manual_partitioning_page.set_back_sensitive(true);
|
manual_partitioning_page.set_back_sensitive(true);
|
||||||
manual_partitioning_page.set_next_sensitive(false);
|
//manual_partitioning_page.set_next_sensitive(false);
|
||||||
|
manual_partitioning_page.set_next_sensitive(true);
|
||||||
|
|
||||||
let partition_array_refcell = Rc::new(RefCell::new(get_partitions()));
|
let partition_array_refcell = Rc::new(RefCell::new(get_partitions()));
|
||||||
let used_partition_array_refcell: Rc<RefCell<Vec<String>>> = Rc::new(RefCell::default());
|
let used_partition_array_refcell: Rc<RefCell<Vec<FstabEntry>>> = Rc::new(RefCell::default());
|
||||||
let subvol_partition_array_refcell: Rc<RefCell<Vec<String>>> = Rc::new(RefCell::default());
|
let subvol_partition_array_refcell: Rc<RefCell<Vec<String>>> = Rc::new(RefCell::default());
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -176,6 +177,7 @@ pub fn manual_partitioning_page(
|
|||||||
(*partition_method_manual_luks_enabled_refcell.borrow_mut()) = false;
|
(*partition_method_manual_luks_enabled_refcell.borrow_mut()) = false;
|
||||||
(*partition_method_manual_crypttab_entry_array_refcell.borrow_mut()) = Vec::new();
|
(*partition_method_manual_crypttab_entry_array_refcell.borrow_mut()) = Vec::new();
|
||||||
let mut seen_mountpoints = HashSet::new();
|
let mut seen_mountpoints = HashSet::new();
|
||||||
|
let mut seen_crypts = HashSet::new();
|
||||||
|
|
||||||
for fs_entry in generate_filesystem_table_array(&drive_mounts_adw_listbox) {
|
for fs_entry in generate_filesystem_table_array(&drive_mounts_adw_listbox) {
|
||||||
let fs_entry_clone0 = fs_entry.clone();
|
let fs_entry_clone0 = fs_entry.clone();
|
||||||
@ -184,7 +186,10 @@ pub fn manual_partitioning_page(
|
|||||||
println!("mountpoint empty");
|
println!("mountpoint empty");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if fs_entry.mountpoint == "[SWAP]" || fs_entry.mountpoint.starts_with("/") && !fs_entry.mountpoint.starts_with("/dev") {
|
if fs_entry.mountpoint == "[SWAP]"
|
||||||
|
|| fs_entry.mountpoint.starts_with("/")
|
||||||
|
&& !fs_entry.mountpoint.starts_with("/dev")
|
||||||
|
{
|
||||||
} else {
|
} else {
|
||||||
errored = true;
|
errored = true;
|
||||||
println!("mountpoint invalid");
|
println!("mountpoint invalid");
|
||||||
@ -205,10 +210,7 @@ pub fn manual_partitioning_page(
|
|||||||
//
|
//
|
||||||
|
|
||||||
if fs_entry_clone0.partition.has_encryption
|
if fs_entry_clone0.partition.has_encryption
|
||||||
&& !partition_method_manual_crypttab_entry_array_refcell
|
&& seen_crypts.insert(fs_entry_clone0.clone().partition.part_name)
|
||||||
.borrow()
|
|
||||||
.iter()
|
|
||||||
.any(|x| x.partition == fs_entry_clone0.partition.part_name)
|
|
||||||
{
|
{
|
||||||
let fs_entry = fs_entry_clone0.clone();
|
let fs_entry = fs_entry_clone0.clone();
|
||||||
let (luks_manual_password_sender, luks_manual_password_receiver) =
|
let (luks_manual_password_sender, luks_manual_password_receiver) =
|
||||||
@ -276,29 +278,34 @@ pub fn manual_partitioning_page(
|
|||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
let partition_method_manual_crypttab_entry_array_refcell_clone0 = partition_method_manual_crypttab_entry_array_refcell.clone();
|
let partition_method_manual_crypttab_entry_array_refcell_clone0 =
|
||||||
|
partition_method_manual_crypttab_entry_array_refcell.clone();
|
||||||
|
let partition_method_manual_luks_enabled_refcell_clone0 =
|
||||||
|
partition_method_manual_luks_enabled_refcell.clone();
|
||||||
|
|
||||||
crypttab_dialog.choose(None::<&gio::Cancellable>,
|
crypttab_dialog.choose(None::<&gio::Cancellable>, move |choice| {
|
||||||
move |choice|
|
let part_name = fs_entry.partition.part_name;
|
||||||
{
|
if choice == "crypttab_dialog_auto" {
|
||||||
let part_name = fs_entry.partition.part_name;
|
(*partition_method_manual_crypttab_entry_array_refcell_clone0
|
||||||
if choice == "crypttab_dialog_auto" {
|
.borrow_mut())
|
||||||
(*partition_method_manual_crypttab_entry_array_refcell_clone0.borrow_mut()).push(CrypttabEntry{
|
.push(CrypttabEntry {
|
||||||
partition: part_name.clone(),
|
partition: part_name.clone(),
|
||||||
map: part_name.replace("mapper/", ""),
|
map: part_name.replace("mapper/", ""),
|
||||||
uuid: get_luks_uuid(&part_name),
|
uuid: get_luks_uuid(&part_name),
|
||||||
password: None,
|
password: Some(crypttab_password.text().to_string()),
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
(*partition_method_manual_crypttab_entry_array_refcell_clone0.borrow_mut()).push(CrypttabEntry{
|
(*partition_method_manual_crypttab_entry_array_refcell_clone0
|
||||||
partition: part_name.clone(),
|
.borrow_mut())
|
||||||
map: part_name.replace("mapper/", ""),
|
.push(CrypttabEntry {
|
||||||
uuid: get_luks_uuid(&part_name),
|
partition: part_name.clone(),
|
||||||
password: Some(crypttab_password.text().to_string()),
|
map: part_name.replace("mapper/", ""),
|
||||||
});
|
uuid: get_luks_uuid(&part_name),
|
||||||
}
|
password: None,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
);
|
(*partition_method_manual_luks_enabled_refcell_clone0.borrow_mut()) = true;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -338,9 +345,9 @@ pub fn manual_partitioning_page(
|
|||||||
*partition_method_type_refcell.borrow_mut() = String::from("manual");
|
*partition_method_type_refcell.borrow_mut() = String::from("manual");
|
||||||
//partition_carousel.scroll_to(&partition_carousel.nth_page(5), true)
|
//partition_carousel.scroll_to(&partition_carousel.nth_page(5), true)
|
||||||
dbg!(partition_method_type_refcell.borrow());
|
dbg!(partition_method_type_refcell.borrow());
|
||||||
//dbg!(partition_method_manual_fstab_entry_array_refcell.borrow());
|
dbg!(partition_method_manual_fstab_entry_array_refcell.borrow());
|
||||||
dbg!(partition_method_manual_luks_enabled_refcell.borrow());
|
dbg!(partition_method_manual_luks_enabled_refcell.borrow());
|
||||||
//dbg!(partition_method_manual_crypttab_entry_array_refcell.borrow());
|
dbg!(partition_method_manual_crypttab_entry_array_refcell.borrow());
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -372,7 +379,7 @@ fn create_hardcoded_rows(
|
|||||||
partition_array_refcell: &Rc<RefCell<Vec<Partition>>>,
|
partition_array_refcell: &Rc<RefCell<Vec<Partition>>>,
|
||||||
partition_changed_action: &gio::SimpleAction,
|
partition_changed_action: &gio::SimpleAction,
|
||||||
language_changed_action: &gio::SimpleAction,
|
language_changed_action: &gio::SimpleAction,
|
||||||
used_partition_array_refcell: &Rc<RefCell<Vec<String>>>,
|
used_partition_array_refcell: &Rc<RefCell<Vec<FstabEntry>>>,
|
||||||
subvol_partition_array_refcell: &Rc<RefCell<Vec<String>>>,
|
subvol_partition_array_refcell: &Rc<RefCell<Vec<String>>>,
|
||||||
) {
|
) {
|
||||||
let drive_mount_add_button_icon = gtk::Image::builder()
|
let drive_mount_add_button_icon = gtk::Image::builder()
|
||||||
|
@ -175,7 +175,7 @@ pub struct BlockDevice {
|
|||||||
pub block_size_pretty: String,
|
pub block_size_pretty: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Default)]
|
#[derive(Default, Clone, Debug)]
|
||||||
pub struct Partition {
|
pub struct Partition {
|
||||||
pub part_name: String,
|
pub part_name: String,
|
||||||
pub part_fs: String,
|
pub part_fs: String,
|
||||||
@ -186,13 +186,14 @@ pub struct Partition {
|
|||||||
pub part_size_pretty: String,
|
pub part_size_pretty: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Clone)]
|
#[derive(Default, Clone, Debug)]
|
||||||
pub struct FstabEntry {
|
pub struct FstabEntry {
|
||||||
pub partition: Partition,
|
pub partition: Partition,
|
||||||
pub mountpoint: String,
|
pub mountpoint: String,
|
||||||
pub mountopts: String,
|
pub mountopts: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default, Clone, Debug)]
|
||||||
pub struct CrypttabEntry {
|
pub struct CrypttabEntry {
|
||||||
pub partition: String,
|
pub partition: String,
|
||||||
pub map: String,
|
pub map: String,
|
||||||
|
Loading…
Reference in New Issue
Block a user