RR: Begin new manual installer
This commit is contained in:
parent
fea499f938
commit
e2111fc77b
@ -116,8 +116,7 @@ impl ObjectImpl for DriveMountRow {
|
|||||||
.margin_start(5)
|
.margin_start(5)
|
||||||
.margin_top(5)
|
.margin_top(5)
|
||||||
.margin_bottom(5)
|
.margin_bottom(5)
|
||||||
.height_request(60)
|
.width_request(40)
|
||||||
.width_request(60)
|
|
||||||
.icon_name("edit-delete")
|
.icon_name("edit-delete")
|
||||||
.halign(gtk::Align::End)
|
.halign(gtk::Align::End)
|
||||||
.build();
|
.build();
|
||||||
|
@ -24,25 +24,26 @@ use std::fs;
|
|||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use crate::drive_mount_row::DriveMountRow;
|
use crate::drive_mount_row::DriveMountRow;
|
||||||
|
|
||||||
fn create_mount_row_list_box(device: &str) -> ActionRow {
|
fn create_mount_row(listbox: >k::ListBox) -> DriveMountRow {
|
||||||
// Create check button
|
|
||||||
let check_button = CheckButton::builder()
|
|
||||||
.valign(Align::Center)
|
|
||||||
.can_focus(false)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
// Create row
|
// Create row
|
||||||
let row = ActionRow::builder()
|
let row = DriveMountRow::new();
|
||||||
.activatable_widget(&check_button)
|
|
||||||
.title(device)
|
let listbox_clone = listbox.clone();
|
||||||
.build();
|
|
||||||
row.add_prefix(&check_button);
|
row.connect_closure(
|
||||||
|
"row-deleted",
|
||||||
|
false,
|
||||||
|
closure_local!(move |_row: DriveMountRow| {
|
||||||
|
listbox_clone.remove(&_row)
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
// Return row
|
// Return row
|
||||||
row
|
row
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn manual_partitioning(window: &adw::ApplicationWindow, partitioning_stack: >k::Stack, bottom_next_button: >k::Button) -> (gtk::TextBuffer, gtk::TextBuffer, adw::PasswordEntryRow) {
|
//pub fn manual_partitioning(window: &adw::ApplicationWindow, partitioning_stack: >k::Stack, bottom_next_button: >k::Button) -> (gtk::TextBuffer, gtk::TextBuffer, adw::PasswordEntryRow) {
|
||||||
|
pub fn manual_partitioning(window: &adw::ApplicationWindow, partitioning_stack: >k::Stack, bottom_next_button: >k::Button) {
|
||||||
let partition_method_manual_main_box = gtk::Box::builder()
|
let partition_method_manual_main_box = gtk::Box::builder()
|
||||||
.orientation(Orientation::Vertical)
|
.orientation(Orientation::Vertical)
|
||||||
.margin_bottom(15)
|
.margin_bottom(15)
|
||||||
@ -83,107 +84,6 @@ pub fn manual_partitioning(window: &adw::ApplicationWindow, partitioning_stack:
|
|||||||
.orientation(Orientation::Vertical)
|
.orientation(Orientation::Vertical)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let partition_method_manual_selection_text = gtk::Label::builder()
|
|
||||||
.label(" - Mount your custom root drive somewhere.\n - Mount all your additional mountpoints relative to it.\n - Make sure to have the the following mountpoints:\n (CUSTOM_ROOT)/boot ~ 1000mb ext4\n (CUSTOM_ROOT)/boot/efi ~ 512mb vfat/fat32\n- If (CUSTOM_ROOT)/home has LUKS encryption, make sure to enable it here.\n - Note: This doesn't erase any data automatically, format your drives manually.")
|
|
||||||
.halign(gtk::Align::Center)
|
|
||||||
.hexpand(true)
|
|
||||||
.margin_top(15)
|
|
||||||
.margin_bottom(15)
|
|
||||||
.margin_start(15)
|
|
||||||
.margin_end(15)
|
|
||||||
.build();
|
|
||||||
partition_method_manual_selection_text.add_css_class("medium_sized_text");
|
|
||||||
|
|
||||||
let partition_method_manual_chroot_box = gtk::Box::builder()
|
|
||||||
.orientation(Orientation::Horizontal)
|
|
||||||
.margin_top(15)
|
|
||||||
.margin_bottom(15)
|
|
||||||
.margin_start(15)
|
|
||||||
.margin_end(15)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
let partition_method_manual_chroot_listbox = gtk::ListBox::builder()
|
|
||||||
.build();
|
|
||||||
partition_method_manual_chroot_listbox.add_css_class("boxed-list");
|
|
||||||
|
|
||||||
let partition_method_manual_chroot_dir_file_dialog = gtk::FileChooserNative::new(
|
|
||||||
Some("Open File"),
|
|
||||||
gtk::Window::NONE,
|
|
||||||
gtk::FileChooserAction::SelectFolder,
|
|
||||||
Some("Open"),
|
|
||||||
Some("Cancel"),
|
|
||||||
);
|
|
||||||
|
|
||||||
partition_method_manual_chroot_dir_file_dialog.set_transient_for(Some(window));
|
|
||||||
|
|
||||||
let partition_method_manual_chroot_dir_entry = adw::EntryRow::builder()
|
|
||||||
.title("Custom Root Mountpoint")
|
|
||||||
.hexpand(true)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
let partition_method_manual_chroot_dir_button_content = adw::ButtonContent::builder()
|
|
||||||
.label("Open")
|
|
||||||
.icon_name("folder-open")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
let partition_method_manual_chroot_dir_button = gtk::Button::builder()
|
|
||||||
.child(&partition_method_manual_chroot_dir_button_content)
|
|
||||||
.margin_start(10)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
let partition_method_manual_luks_box = gtk::Box::builder()
|
|
||||||
.orientation(Orientation::Horizontal)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
let partition_method_manual_luks_listbox = gtk::ListBox::builder()
|
|
||||||
.margin_top(15)
|
|
||||||
.margin_bottom(15)
|
|
||||||
.margin_start(0)
|
|
||||||
.margin_end(15)
|
|
||||||
.build();
|
|
||||||
partition_method_manual_luks_listbox.add_css_class("boxed-list");
|
|
||||||
|
|
||||||
let partition_method_manual_luks_password_entry = adw::PasswordEntryRow::builder()
|
|
||||||
.title("LUKS Password")
|
|
||||||
.hexpand(true)
|
|
||||||
.sensitive(false)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
let partition_method_manual_chroot_error_label = gtk::Label::builder()
|
|
||||||
.label("No mountpoint specified.")
|
|
||||||
.halign(Align::Start)
|
|
||||||
.valign(Align::End)
|
|
||||||
.vexpand(true)
|
|
||||||
.build();
|
|
||||||
partition_method_manual_chroot_error_label.add_css_class("small_error_text");
|
|
||||||
|
|
||||||
let partition_method_manual_boot_error_label = gtk::Label::builder()
|
|
||||||
.label("No boot partition found in chroot, mount (CUSTOM_ROOT)/boot.")
|
|
||||||
.halign(Align::Start)
|
|
||||||
.valign(Align::End)
|
|
||||||
.vexpand(true)
|
|
||||||
.visible(false)
|
|
||||||
.build();
|
|
||||||
partition_method_manual_boot_error_label.add_css_class("small_error_text");
|
|
||||||
|
|
||||||
let partition_method_manual_efi_error_label = gtk::Label::builder()
|
|
||||||
.label("No EFI partition found in chroot, mount (CUSTOM_ROOT)/boot/efi.")
|
|
||||||
.halign(Align::Start)
|
|
||||||
.valign(Align::End)
|
|
||||||
.vexpand(true)
|
|
||||||
.visible(false)
|
|
||||||
.build();
|
|
||||||
partition_method_manual_efi_error_label.add_css_class("small_error_text");
|
|
||||||
|
|
||||||
let partition_method_manual_luks_error_label = gtk::Label::builder()
|
|
||||||
.label("Home partition encrypted, but no LUKS password provided.")
|
|
||||||
.halign(Align::Start)
|
|
||||||
.valign(Align::End)
|
|
||||||
.vexpand(true)
|
|
||||||
.visible(false)
|
|
||||||
.build();
|
|
||||||
partition_method_manual_luks_error_label.add_css_class("small_error_text");
|
|
||||||
|
|
||||||
let partition_method_manual_gparted_button_content_box = gtk::Box::builder()
|
let partition_method_manual_gparted_button_content_box = gtk::Box::builder()
|
||||||
.orientation(Orientation::Vertical)
|
.orientation(Orientation::Vertical)
|
||||||
.build();
|
.build();
|
||||||
@ -200,361 +100,42 @@ pub fn manual_partitioning(window: &adw::ApplicationWindow, partitioning_stack:
|
|||||||
let partition_method_manual_gparted_button = gtk::Button::builder()
|
let partition_method_manual_gparted_button = gtk::Button::builder()
|
||||||
.child(&partition_method_manual_gparted_button_content_box)
|
.child(&partition_method_manual_gparted_button_content_box)
|
||||||
.halign(Align::Center)
|
.halign(Align::Center)
|
||||||
.valign(Align::End)
|
.valign(Align::Start)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let drive_mounts_adw_listbox = gtk::ListBox::builder()
|
||||||
|
.hexpand(true)
|
||||||
|
.vexpand(true)
|
||||||
|
.build();
|
||||||
|
drive_mounts_adw_listbox.add_css_class("boxed-list");
|
||||||
|
|
||||||
|
let drive_mounts_viewport = gtk::ScrolledWindow::builder()
|
||||||
|
.halign(Align::Center)
|
||||||
|
.valign(Align::Center)
|
||||||
|
.margin_top(30)
|
||||||
|
.margin_bottom(30)
|
||||||
|
.margin_start(30)
|
||||||
|
.margin_end(30)
|
||||||
|
.propagate_natural_height(true)
|
||||||
|
.propagate_natural_width(true)
|
||||||
|
.hexpand(true)
|
||||||
|
.vexpand(true)
|
||||||
|
.child(&drive_mounts_adw_listbox)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let drive_mount_add_button = gtk::Button::builder()
|
||||||
|
.icon_name("list-add")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
partition_method_manual_luks_listbox.append(&partition_method_manual_luks_password_entry);
|
|
||||||
partition_method_manual_luks_box.append(&partition_method_manual_luks_listbox);
|
|
||||||
partition_method_manual_header_box.append(&partition_method_manual_header_text);
|
partition_method_manual_header_box.append(&partition_method_manual_header_text);
|
||||||
partition_method_manual_header_box.append(&partition_method_manual_header_icon);
|
partition_method_manual_header_box.append(&partition_method_manual_header_icon);
|
||||||
partition_method_manual_selection_box.append(&partition_method_manual_selection_text);
|
|
||||||
partition_method_manual_main_box.append(&partition_method_manual_header_box);
|
partition_method_manual_main_box.append(&partition_method_manual_header_box);
|
||||||
partition_method_manual_main_box.append(&partition_method_manual_selection_box);
|
partition_method_manual_main_box.append(&partition_method_manual_selection_box);
|
||||||
partition_method_manual_chroot_listbox.append(&partition_method_manual_chroot_dir_entry);
|
|
||||||
partition_method_manual_chroot_box.append(&partition_method_manual_chroot_listbox);
|
|
||||||
partition_method_manual_chroot_box.append(&partition_method_manual_chroot_dir_button);
|
|
||||||
partition_method_manual_gparted_button_content_box.append(&partition_method_manual_gparted_button_content);
|
partition_method_manual_gparted_button_content_box.append(&partition_method_manual_gparted_button_content);
|
||||||
partition_method_manual_gparted_button_content_box.append(&partition_method_manual_gparted_button_content_text);
|
partition_method_manual_gparted_button_content_box.append(&partition_method_manual_gparted_button_content_text);
|
||||||
partition_method_manual_main_box.append(&partition_method_manual_chroot_box);
|
|
||||||
partition_method_manual_main_box.append(&partition_method_manual_luks_box);
|
|
||||||
partition_method_manual_main_box.append(&partition_method_manual_luks_error_label);
|
|
||||||
partition_method_manual_main_box.append(&partition_method_manual_chroot_error_label);
|
|
||||||
partition_method_manual_main_box.append(&partition_method_manual_boot_error_label);
|
|
||||||
partition_method_manual_main_box.append(&partition_method_manual_efi_error_label);
|
|
||||||
partition_method_manual_main_box.append(&partition_method_manual_gparted_button);
|
partition_method_manual_main_box.append(&partition_method_manual_gparted_button);
|
||||||
|
drive_mounts_adw_listbox.append(&drive_mount_add_button);
|
||||||
let shit_button = DriveMountRow::new();
|
partition_method_manual_main_box.append(&drive_mounts_viewport);
|
||||||
|
|
||||||
shit_button.set_property("partition", "KAM");
|
|
||||||
shit_button.set_property("mountpoint", "KAM");
|
|
||||||
shit_button.set_property("mountopt", "KAM");
|
|
||||||
shit_button.set_property("partition_scroll", >k::ScrolledWindow::new());
|
|
||||||
|
|
||||||
let create_mount_row_list_box = gtk::ListBox::builder()
|
|
||||||
.build();
|
|
||||||
|
|
||||||
let partition_method_manual_main_box_clone = partition_method_manual_main_box.clone();
|
|
||||||
|
|
||||||
shit_button.connect_closure(
|
|
||||||
"row-deleted",
|
|
||||||
false,
|
|
||||||
closure_local!(move |_shit_button: DriveMountRow| {
|
|
||||||
partition_method_manual_main_box_clone.remove(&_shit_button)
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
//shit_button.connect_clicked(clone!(@weak create_mount_row_list_box => move |_|{
|
|
||||||
// create_mount_row_list_box.append(&create_mount_row("col"))
|
|
||||||
//}));
|
|
||||||
|
|
||||||
partition_method_manual_main_box.append(&shit_button);
|
|
||||||
partition_method_manual_main_box.append(&create_mount_row_list_box);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// clone partition_method_manual_chroot_dir_file_dialog as rust becuase glib breaks it show function for some reason
|
|
||||||
let partition_method_manual_chroot_dir_file_dialog_clone = partition_method_manual_chroot_dir_file_dialog.clone();
|
|
||||||
partition_method_manual_chroot_dir_button.connect_clicked(move |_| {
|
|
||||||
partition_method_manual_chroot_dir_file_dialog_clone.set_visible(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
partition_method_manual_chroot_dir_file_dialog.connect_response(clone!(@weak partition_method_manual_chroot_dir_file_dialog, @weak partition_method_manual_chroot_dir_entry => move |_, response| {
|
|
||||||
if response == gtk::ResponseType::Accept {
|
|
||||||
if partition_method_manual_chroot_dir_file_dialog.file().is_some() {
|
|
||||||
partition_method_manual_chroot_dir_entry.set_text(&partition_method_manual_chroot_dir_file_dialog.file().expect("FILE PATHING FAIL").path().expect("PATH STRINGING FAIL").into_os_string().into_string().unwrap());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
let partition_method_manual_target_buffer = gtk::TextBuffer::builder()
|
|
||||||
.build();
|
|
||||||
|
|
||||||
let partition_method_manual_luks_buffer = gtk::TextBuffer::builder()
|
|
||||||
.build();
|
|
||||||
|
|
||||||
partition_method_manual_chroot_dir_entry.connect_changed(clone!(@weak bottom_next_button, @weak partition_method_manual_luks_password_entry, @weak partition_method_manual_luks_error_label, @weak partition_method_manual_chroot_dir_entry, @weak partition_method_manual_chroot_error_label, @weak partition_method_manual_boot_error_label, @weak partition_method_manual_efi_error_label, @weak partition_method_manual_target_buffer, @weak partition_method_manual_luks_buffer => move |_| {
|
|
||||||
bottom_next_button.set_sensitive(false);
|
|
||||||
let custom_root_mountpoint = partition_method_manual_chroot_dir_entry.text().to_string();
|
|
||||||
// Mountpoint Check
|
|
||||||
if custom_root_mountpoint.is_empty() {
|
|
||||||
partition_method_manual_chroot_error_label.set_label("No mountpoint specified.");
|
|
||||||
partition_method_manual_chroot_error_label.set_visible(true);
|
|
||||||
} else if custom_root_mountpoint.contains("/dev") {
|
|
||||||
partition_method_manual_chroot_error_label.set_label("This Installer Takes mountpoints not devices.");
|
|
||||||
partition_method_manual_chroot_error_label.set_visible(true);
|
|
||||||
} else {
|
|
||||||
partition_method_manual_chroot_error_label.set_visible(false);
|
|
||||||
}
|
|
||||||
// Home partition Check
|
|
||||||
let home_not_root_cli = Command::new("sudo")
|
|
||||||
.arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
|
|
||||||
.arg("home_not_root")
|
|
||||||
.arg(custom_root_mountpoint.clone())
|
|
||||||
.output()
|
|
||||||
.expect("failed to execute process");
|
|
||||||
if home_not_root_cli.status.success() {
|
|
||||||
// Home encryption Checking
|
|
||||||
let (luks_manual_is_encrypt_sender, luks_manual_is_encrypt_receiver) = async_channel::unbounded();
|
|
||||||
let luks_manual_is_encrypt_sender = luks_manual_is_encrypt_sender.clone();
|
|
||||||
// The long running operation runs now in a separate thread
|
|
||||||
gio::spawn_blocking(clone!(@strong custom_root_mountpoint => move || {
|
|
||||||
let check_home_encryption_cli = Command::new("sudo")
|
|
||||||
.arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
|
|
||||||
.arg("check_home_encryption")
|
|
||||||
.arg(custom_root_mountpoint)
|
|
||||||
.output()
|
|
||||||
.expect("failed to execute process");
|
|
||||||
if check_home_encryption_cli.status.success() {
|
|
||||||
luks_manual_is_encrypt_sender
|
|
||||||
.send_blocking(true)
|
|
||||||
.expect("The channel needs to be open.");
|
|
||||||
} else {
|
|
||||||
luks_manual_is_encrypt_sender
|
|
||||||
.send_blocking(false)
|
|
||||||
.expect("The channel needs to be open.");
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
let luks_manual_is_encrypt_main_context = MainContext::default();
|
|
||||||
// The main loop executes the asynchronous block
|
|
||||||
luks_manual_is_encrypt_main_context.spawn_local(clone!(@weak partition_method_manual_luks_password_entry => async move {
|
|
||||||
while let Ok(state) = luks_manual_is_encrypt_receiver.recv().await {
|
|
||||||
partition_method_manual_luks_password_entry.set_sensitive(state);
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
// Luks Password Checking
|
|
||||||
let luks_passwd = partition_method_manual_luks_password_entry.text().to_string();
|
|
||||||
let (luks_manual_password_sender, luks_manual_password_receiver) = async_channel::unbounded();
|
|
||||||
let luks_manual_password_sender = luks_manual_password_sender.clone();
|
|
||||||
// The long running operation runs now in a separate thread
|
|
||||||
gio::spawn_blocking(clone!(@strong custom_root_mountpoint, @strong luks_passwd, @strong custom_root_mountpoint => move || {
|
|
||||||
let luks_check_cli = Command::new("sudo")
|
|
||||||
.arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
|
|
||||||
.arg("check_home_luks_passwd")
|
|
||||||
.arg(custom_root_mountpoint)
|
|
||||||
.arg(luks_passwd)
|
|
||||||
.output()
|
|
||||||
.expect("failed to execute process");
|
|
||||||
if luks_check_cli.status.success() {
|
|
||||||
luks_manual_password_sender
|
|
||||||
.send_blocking(false)
|
|
||||||
.expect("The channel needs to be open.");
|
|
||||||
} else {
|
|
||||||
luks_manual_password_sender
|
|
||||||
.send_blocking(true)
|
|
||||||
.expect("The channel needs to be open.");
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
let luks_manual_password_main_context = MainContext::default();
|
|
||||||
// The main loop executes the asynchronous block
|
|
||||||
luks_manual_password_main_context.spawn_local(clone!(@weak partition_method_manual_luks_error_label, @weak bottom_next_button => async move {
|
|
||||||
while let Ok(state) = luks_manual_password_receiver.recv().await {
|
|
||||||
partition_method_manual_luks_error_label.set_visible(state);
|
|
||||||
bottom_next_button.set_sensitive(!state);
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
// Boot partition Checks
|
|
||||||
let home_not_boot_cli = Command::new("sudo")
|
|
||||||
.arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
|
|
||||||
.arg("home_not_boot")
|
|
||||||
.arg(custom_root_mountpoint.clone())
|
|
||||||
.output()
|
|
||||||
.expect("failed to execute process");
|
|
||||||
let root_not_boot_cli = Command::new("sudo")
|
|
||||||
.arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
|
|
||||||
.arg("root_not_boot")
|
|
||||||
.arg(custom_root_mountpoint.clone())
|
|
||||||
.output()
|
|
||||||
.expect("failed to execute process");
|
|
||||||
let boot_not_efi_cli = Command::new("sudo")
|
|
||||||
.arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
|
|
||||||
.arg("boot_not_efi")
|
|
||||||
.arg(custom_root_mountpoint.clone())
|
|
||||||
.output()
|
|
||||||
.expect("failed to execute process");
|
|
||||||
|
|
||||||
if home_not_boot_cli.status.success() && root_not_boot_cli.status.success() && boot_not_efi_cli.status.success() {
|
|
||||||
partition_method_manual_boot_error_label.set_visible(false)
|
|
||||||
} else {
|
|
||||||
if home_not_boot_cli.status.success() {
|
|
||||||
partition_method_manual_boot_error_label.set_visible(false);
|
|
||||||
} else {
|
|
||||||
partition_method_manual_boot_error_label.set_label("the /home and /boot partitions are the same.");
|
|
||||||
partition_method_manual_boot_error_label.set_visible(true);
|
|
||||||
}
|
|
||||||
if boot_not_efi_cli.status.success() {
|
|
||||||
partition_method_manual_boot_error_label.set_visible(false);
|
|
||||||
} else {
|
|
||||||
partition_method_manual_boot_error_label.set_label("the /boot/efi and /boot partitions are the same.");
|
|
||||||
partition_method_manual_boot_error_label.set_visible(true);
|
|
||||||
}
|
|
||||||
if root_not_boot_cli.status.success() {
|
|
||||||
partition_method_manual_boot_error_label.set_visible(false);
|
|
||||||
} else {
|
|
||||||
partition_method_manual_boot_error_label.set_label("No boot partition found in chroot, mount (CUSTOM_ROOT)/boot.");
|
|
||||||
partition_method_manual_boot_error_label.set_visible(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// EFI partition Checks
|
|
||||||
let root_not_efi_cli = Command::new("sudo")
|
|
||||||
.arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
|
|
||||||
.arg("root_not_efi")
|
|
||||||
.arg(custom_root_mountpoint.clone())
|
|
||||||
.output()
|
|
||||||
.expect("failed to execute process");
|
|
||||||
if root_not_efi_cli.status.success() {
|
|
||||||
partition_method_manual_efi_error_label.set_visible(false);
|
|
||||||
} else {
|
|
||||||
partition_method_manual_efi_error_label.set_label("No EFI partition found in chroot, mount (CUSTOM_ROOT)/boot/efi.");
|
|
||||||
partition_method_manual_efi_error_label.set_visible(true);
|
|
||||||
}
|
|
||||||
if partition_method_manual_chroot_error_label.get_visible() == false && partition_method_manual_luks_error_label.get_visible() == false && partition_method_manual_boot_error_label.get_visible() == false && partition_method_manual_efi_error_label.get_visible() == false {
|
|
||||||
partition_method_manual_target_buffer.set_text(&custom_root_mountpoint);
|
|
||||||
bottom_next_button.set_sensitive(true);
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
partition_method_manual_luks_password_entry.connect_changed(clone!(@weak bottom_next_button, @weak partition_method_manual_chroot_dir_entry, @weak partition_method_manual_luks_password_entry, @weak partition_method_manual_luks_error_label, @weak partition_method_manual_chroot_error_label, @weak partition_method_manual_boot_error_label, @weak partition_method_manual_efi_error_label, @weak partition_method_manual_target_buffer, @weak partition_method_manual_luks_buffer => move |_| {
|
|
||||||
bottom_next_button.set_sensitive(false);
|
|
||||||
let custom_root_mountpoint = partition_method_manual_chroot_dir_entry.text().to_string();
|
|
||||||
// Mountpoint Check
|
|
||||||
if custom_root_mountpoint.is_empty() {
|
|
||||||
partition_method_manual_chroot_error_label.set_label("No mountpoint specified.");
|
|
||||||
partition_method_manual_chroot_error_label.set_visible(true);
|
|
||||||
} else if custom_root_mountpoint.contains("/dev") {
|
|
||||||
partition_method_manual_chroot_error_label.set_label("This Installer Takes mountpoints not devices.");
|
|
||||||
partition_method_manual_chroot_error_label.set_visible(true);
|
|
||||||
} else {
|
|
||||||
partition_method_manual_chroot_error_label.set_visible(false);
|
|
||||||
}
|
|
||||||
// Home partition Check
|
|
||||||
let home_not_root_cli = Command::new("sudo")
|
|
||||||
.arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
|
|
||||||
.arg("home_not_root")
|
|
||||||
.arg(custom_root_mountpoint.clone())
|
|
||||||
.output()
|
|
||||||
.expect("failed to execute process");
|
|
||||||
if home_not_root_cli.status.success() {
|
|
||||||
// Home encryption Checking
|
|
||||||
let (luks_manual_is_encrypt_sender, luks_manual_is_encrypt_receiver) = async_channel::unbounded();
|
|
||||||
let luks_manual_is_encrypt_sender = luks_manual_is_encrypt_sender.clone();
|
|
||||||
// The long running operation runs now in a separate thread
|
|
||||||
gio::spawn_blocking(clone!(@strong custom_root_mountpoint => move || {
|
|
||||||
let check_home_encryption_cli = Command::new("sudo")
|
|
||||||
.arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
|
|
||||||
.arg("check_home_encryption")
|
|
||||||
.arg(custom_root_mountpoint)
|
|
||||||
.output()
|
|
||||||
.expect("failed to execute process");
|
|
||||||
if check_home_encryption_cli.status.success() {
|
|
||||||
luks_manual_is_encrypt_sender
|
|
||||||
.send_blocking(true)
|
|
||||||
.expect("The channel needs to be open.");
|
|
||||||
} else {
|
|
||||||
luks_manual_is_encrypt_sender
|
|
||||||
.send_blocking(false)
|
|
||||||
.expect("The channel needs to be open.");
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
let luks_manual_is_encrypt_main_context = MainContext::default();
|
|
||||||
// The main loop executes the asynchronous block
|
|
||||||
luks_manual_is_encrypt_main_context.spawn_local(clone!(@weak partition_method_manual_luks_password_entry => async move {
|
|
||||||
while let Ok(state) = luks_manual_is_encrypt_receiver.recv().await {
|
|
||||||
partition_method_manual_luks_password_entry.set_sensitive(state);
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
// Luks Password Checking
|
|
||||||
let luks_passwd = partition_method_manual_luks_password_entry.text().to_string();
|
|
||||||
let (luks_manual_password_sender, luks_manual_password_receiver) = async_channel::unbounded();
|
|
||||||
let luks_manual_password_sender = luks_manual_password_sender.clone();
|
|
||||||
// The long running operation runs now in a separate thread
|
|
||||||
gio::spawn_blocking(clone!(@strong custom_root_mountpoint, @strong luks_passwd => move || {
|
|
||||||
let luks_check_cli = Command::new("sudo")
|
|
||||||
.arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
|
|
||||||
.arg("check_home_luks_passwd")
|
|
||||||
.arg(custom_root_mountpoint)
|
|
||||||
.arg(luks_passwd)
|
|
||||||
.output()
|
|
||||||
.expect("failed to execute process");
|
|
||||||
if luks_check_cli.status.success() {
|
|
||||||
luks_manual_password_sender
|
|
||||||
.send_blocking(false)
|
|
||||||
.expect("The channel needs to be open.");
|
|
||||||
} else {
|
|
||||||
luks_manual_password_sender
|
|
||||||
.send_blocking(true)
|
|
||||||
.expect("The channel needs to be open.");
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
let luks_manual_password_main_context = MainContext::default();
|
|
||||||
// The main loop executes the asynchronous block
|
|
||||||
luks_manual_password_main_context.spawn_local(clone!(@weak partition_method_manual_luks_error_label, @weak bottom_next_button => async move {
|
|
||||||
while let Ok(state) = luks_manual_password_receiver.recv().await {
|
|
||||||
partition_method_manual_luks_error_label.set_visible(state);
|
|
||||||
bottom_next_button.set_sensitive(!state);
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
// Boot partition Checks
|
|
||||||
let home_not_boot_cli = Command::new("sudo")
|
|
||||||
.arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
|
|
||||||
.arg("home_not_boot")
|
|
||||||
.arg(custom_root_mountpoint.clone())
|
|
||||||
.output()
|
|
||||||
.expect("failed to execute process");
|
|
||||||
let root_not_boot_cli = Command::new("sudo")
|
|
||||||
.arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
|
|
||||||
.arg("root_not_boot")
|
|
||||||
.arg(custom_root_mountpoint.clone())
|
|
||||||
.output()
|
|
||||||
.expect("failed to execute process");
|
|
||||||
let boot_not_efi_cli = Command::new("sudo")
|
|
||||||
.arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
|
|
||||||
.arg("boot_not_efi")
|
|
||||||
.arg(custom_root_mountpoint.clone())
|
|
||||||
.output()
|
|
||||||
.expect("failed to execute process");
|
|
||||||
|
|
||||||
if home_not_boot_cli.status.success() && root_not_boot_cli.status.success() && boot_not_efi_cli.status.success() {
|
|
||||||
partition_method_manual_boot_error_label.set_visible(false)
|
|
||||||
} else {
|
|
||||||
if home_not_boot_cli.status.success() {
|
|
||||||
partition_method_manual_boot_error_label.set_visible(false);
|
|
||||||
} else {
|
|
||||||
partition_method_manual_boot_error_label.set_label("the /home and /boot partitions are the same.");
|
|
||||||
partition_method_manual_boot_error_label.set_visible(true);
|
|
||||||
}
|
|
||||||
if boot_not_efi_cli.status.success() {
|
|
||||||
partition_method_manual_boot_error_label.set_visible(false);
|
|
||||||
} else {
|
|
||||||
partition_method_manual_boot_error_label.set_label("the /boot/efi and /boot partitions are the same.");
|
|
||||||
partition_method_manual_boot_error_label.set_visible(true);
|
|
||||||
}
|
|
||||||
if root_not_boot_cli.status.success() {
|
|
||||||
partition_method_manual_boot_error_label.set_visible(false);
|
|
||||||
} else {
|
|
||||||
partition_method_manual_boot_error_label.set_label("No boot partition found in chroot, mount (CUSTOM_ROOT)/boot.");
|
|
||||||
partition_method_manual_boot_error_label.set_visible(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// EFI partition Checks
|
|
||||||
let root_not_efi_cli = Command::new("sudo")
|
|
||||||
.arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
|
|
||||||
.arg("root_not_efi")
|
|
||||||
.arg(custom_root_mountpoint.clone())
|
|
||||||
.output()
|
|
||||||
.expect("failed to execute process");
|
|
||||||
if root_not_efi_cli.status.success() {
|
|
||||||
partition_method_manual_efi_error_label.set_visible(false);
|
|
||||||
} else {
|
|
||||||
partition_method_manual_efi_error_label.set_label("No EFI partition found in chroot, mount (CUSTOM_ROOT)/boot/efi.");
|
|
||||||
partition_method_manual_efi_error_label.set_visible(true);
|
|
||||||
}
|
|
||||||
if partition_method_manual_chroot_error_label.get_visible() == false && partition_method_manual_luks_error_label.get_visible() == false && partition_method_manual_boot_error_label.get_visible() == false && partition_method_manual_efi_error_label.get_visible() == false {
|
|
||||||
partition_method_manual_target_buffer.set_text(&custom_root_mountpoint);
|
|
||||||
bottom_next_button.set_sensitive(true);
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
partition_method_manual_gparted_button.connect_clicked(move |_| {
|
partition_method_manual_gparted_button.connect_clicked(move |_| {
|
||||||
Command::new("gparted")
|
Command::new("gparted")
|
||||||
@ -562,7 +143,11 @@ pub fn manual_partitioning(window: &adw::ApplicationWindow, partitioning_stack:
|
|||||||
.expect("gparted failed to start");
|
.expect("gparted failed to start");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
drive_mount_add_button.connect_clicked(clone!(@weak drive_mounts_adw_listbox => move |_|{
|
||||||
|
drive_mounts_adw_listbox.append(&create_mount_row(&drive_mounts_adw_listbox))
|
||||||
|
}));
|
||||||
|
|
||||||
partitioning_stack.add_titled(&partition_method_manual_main_box, Some("partition_method_manual_page"), "partition_method_manual_page");
|
partitioning_stack.add_titled(&partition_method_manual_main_box, Some("partition_method_manual_page"), "partition_method_manual_page");
|
||||||
|
|
||||||
return(partition_method_manual_target_buffer, partition_method_manual_luks_buffer, partition_method_manual_luks_password_entry)
|
//return(partition_method_manual_target_buffer, partition_method_manual_luks_buffer, partition_method_manual_luks_password_entry)
|
||||||
}
|
}
|
||||||
|
@ -224,13 +224,13 @@ pub fn partitioning_page(done_main_box: >k::Box, install_main_box: >k::Box ,
|
|||||||
automatic_method_button.connect_clicked(clone!(@weak partitioning_stack => move |_| partitioning_stack.set_visible_child_name("partition_method_automatic_page")));
|
automatic_method_button.connect_clicked(clone!(@weak partitioning_stack => move |_| partitioning_stack.set_visible_child_name("partition_method_automatic_page")));
|
||||||
manual_method_button.connect_clicked(clone!(@weak partitioning_stack => move |_| partitioning_stack.set_visible_child_name("partition_method_manual_page")));
|
manual_method_button.connect_clicked(clone!(@weak partitioning_stack => move |_| partitioning_stack.set_visible_child_name("partition_method_manual_page")));
|
||||||
|
|
||||||
let partition_method_automatic_target_buffer_clone = partitioning_page_automatic_partitioning.0.clone();
|
//let partition_method_automatic_target_buffer_clone = partitioning_page_automatic_partitioning.0.clone();
|
||||||
|
|
||||||
let partition_method_automatic_luks_buffer_clone = partitioning_page_automatic_partitioning.1.clone();
|
//let partition_method_automatic_luks_buffer_clone = partitioning_page_automatic_partitioning.1.clone();
|
||||||
|
|
||||||
let partition_method_manual_target_buffer_clone = partitioning_page_manual_partitioning.0.clone();
|
//let partition_method_manual_target_buffer_clone = partitioning_page_manual_partitioning.0.clone();
|
||||||
|
|
||||||
let partition_method_manual_luks_buffer_clone = partitioning_page_manual_partitioning.1.clone();
|
//let partition_method_manual_luks_buffer_clone = partitioning_page_manual_partitioning.1.clone();
|
||||||
|
|
||||||
bottom_next_button.connect_clicked(clone!(@weak content_stack => move |_| {
|
bottom_next_button.connect_clicked(clone!(@weak content_stack => move |_| {
|
||||||
content_stack.set_visible_child_name("install_page")
|
content_stack.set_visible_child_name("install_page")
|
||||||
@ -255,24 +255,24 @@ pub fn partitioning_page(done_main_box: >k::Box, install_main_box: >k::Box ,
|
|||||||
fs::remove_file("/tmp/pika-installer-gtk4-target-manual-luks.txt").expect("Bad permissions on /tmp/pika-installer-gtk4-target-manual.txt");
|
fs::remove_file("/tmp/pika-installer-gtk4-target-manual-luks.txt").expect("Bad permissions on /tmp/pika-installer-gtk4-target-manual.txt");
|
||||||
}
|
}
|
||||||
if partitioning_stack.visible_child_name() == Some(GString::from_string_unchecked("partition_method_automatic_page".into())) {
|
if partitioning_stack.visible_child_name() == Some(GString::from_string_unchecked("partition_method_automatic_page".into())) {
|
||||||
fs::write("/tmp/pika-installer-gtk4-target-auto.txt", partition_method_automatic_target_buffer_clone.text(&partition_method_automatic_target_buffer_clone.bounds().0, &partition_method_automatic_target_buffer_clone.bounds().1, true).to_string()).expect("Unable to write file");
|
//fs::write("/tmp/pika-installer-gtk4-target-auto.txt", partition_method_automatic_target_buffer_clone.text(&partition_method_automatic_target_buffer_clone.bounds().0, &partition_method_automatic_target_buffer_clone.bounds().1, true).to_string()).expect("Unable to write file");
|
||||||
let automatic_luks_result = partition_method_automatic_luks_buffer_clone.text(&partition_method_automatic_luks_buffer_clone.bounds().0, &partition_method_automatic_luks_buffer_clone.bounds().1, true).to_string();
|
//let automatic_luks_result = partition_method_automatic_luks_buffer_clone.text(&partition_method_automatic_luks_buffer_clone.bounds().0, &partition_method_automatic_luks_buffer_clone.bounds().1, true).to_string();
|
||||||
if automatic_luks_result.is_empty() {
|
//if automatic_luks_result.is_empty() {
|
||||||
//
|
// //
|
||||||
} else {
|
//} else {
|
||||||
fs::write("/tmp/pika-installer-gtk4-target-automatic-luks.txt", automatic_luks_result);
|
// fs::write("/tmp/pika-installer-gtk4-target-automatic-luks.txt", automatic_luks_result);
|
||||||
}
|
//}
|
||||||
install_page(&done_main_box, &install_main_box, &content_stack, &window);
|
install_page(&done_main_box, &install_main_box, &content_stack, &window);
|
||||||
content_stack.set_visible_child_name("install_page");
|
content_stack.set_visible_child_name("install_page");
|
||||||
} else {
|
} else {
|
||||||
fs::write("/tmp/pika-installer-gtk4-target-manual.txt", partition_method_manual_target_buffer_clone.text(&partition_method_manual_target_buffer_clone.bounds().0, &partition_method_manual_target_buffer_clone.bounds().1, true).to_string()).expect("Unable to write file");
|
//fs::write("/tmp/pika-installer-gtk4-target-manual.txt", partition_method_manual_target_buffer_clone.text(&partition_method_manual_target_buffer_clone.bounds().0, &partition_method_manual_target_buffer_clone.bounds().1, true).to_string()).expect("Unable to write file");
|
||||||
partition_method_manual_luks_buffer_clone.set_text(&partitioning_page_manual_partitioning.2.text().to_string());
|
//partition_method_manual_luks_buffer_clone.set_text(&partitioning_page_manual_partitioning.2.text().to_string());
|
||||||
let manual_luks_result = partition_method_manual_luks_buffer_clone.text(&partition_method_manual_luks_buffer_clone.bounds().0, &partition_method_manual_luks_buffer_clone.bounds().1, true).to_string();
|
//let manual_luks_result = partition_method_manual_luks_buffer_clone.text(&partition_method_manual_luks_buffer_clone.bounds().0, &partition_method_manual_luks_buffer_clone.bounds().1, true).to_string();
|
||||||
if manual_luks_result.is_empty() {
|
//if manual_luks_result.is_empty() {
|
||||||
//
|
// //
|
||||||
} else {
|
//} else {
|
||||||
fs::write("/tmp/pika-installer-gtk4-target-manual-luks.txt", manual_luks_result);
|
// fs::write("/tmp/pika-installer-gtk4-target-manual-luks.txt", manual_luks_result);
|
||||||
}
|
//}
|
||||||
install_page(&done_main_box, &install_main_box, &content_stack, &window);
|
install_page(&done_main_box, &install_main_box, &content_stack, &window);
|
||||||
content_stack.set_visible_child_name("install_page");
|
content_stack.set_visible_child_name("install_page");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user