RR: working crypt checker
This commit is contained in:
parent
7aeabf54aa
commit
2f1c3316d5
@ -49,6 +49,8 @@ impl ObjectImpl for DriveMountRow {
|
|||||||
let action_row_content_box = gtk::Box::builder()
|
let action_row_content_box = gtk::Box::builder()
|
||||||
.orientation(Horizontal)
|
.orientation(Horizontal)
|
||||||
.spacing(0)
|
.spacing(0)
|
||||||
|
.vexpand(true)
|
||||||
|
.hexpand(true)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let partition_row_expander_adw_listbox = gtk::ListBox::builder()
|
let partition_row_expander_adw_listbox = gtk::ListBox::builder()
|
||||||
@ -56,39 +58,45 @@ impl ObjectImpl for DriveMountRow {
|
|||||||
.margin_start(10)
|
.margin_start(10)
|
||||||
.margin_top(5)
|
.margin_top(5)
|
||||||
.margin_bottom(5)
|
.margin_bottom(5)
|
||||||
|
.vexpand(true)
|
||||||
|
.hexpand(true)
|
||||||
.build();
|
.build();
|
||||||
partition_row_expander_adw_listbox.add_css_class("boxed-list");
|
partition_row_expander_adw_listbox.add_css_class("boxed-list");
|
||||||
|
|
||||||
let partition_row_expander = adw::ExpanderRow::builder()
|
let partition_row_expander = adw::ExpanderRow::builder()
|
||||||
.subtitle("Partition")
|
.subtitle("Partition")
|
||||||
|
.vexpand(true)
|
||||||
|
.hexpand(true)
|
||||||
.width_request(300)
|
.width_request(300)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let mountpoint_entry_adw_listbox = gtk::ListBox::builder()
|
let mountpoint_entry_adw_listbox = gtk::ListBox::builder()
|
||||||
.halign(gtk::Align::Center)
|
|
||||||
.margin_top(5)
|
.margin_top(5)
|
||||||
.margin_bottom(5)
|
.margin_bottom(5)
|
||||||
.vexpand(true)
|
.vexpand(true)
|
||||||
|
.hexpand(true)
|
||||||
.build();
|
.build();
|
||||||
mountpoint_entry_adw_listbox.add_css_class("boxed-list");
|
mountpoint_entry_adw_listbox.add_css_class("boxed-list");
|
||||||
|
|
||||||
let mountpoint_entry_row = adw::EntryRow::builder()
|
let mountpoint_entry_row = adw::EntryRow::builder()
|
||||||
.title("Mountpoint")
|
.title("Mountpoint")
|
||||||
.vexpand(true)
|
.vexpand(true)
|
||||||
|
.hexpand(true)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let mountopt_entry_adw_listbox = gtk::ListBox::builder()
|
let mountopt_entry_adw_listbox = gtk::ListBox::builder()
|
||||||
.margin_top(5)
|
.margin_top(5)
|
||||||
.margin_bottom(5)
|
.margin_bottom(5)
|
||||||
.margin_start(5)
|
.margin_start(5)
|
||||||
.halign(gtk::Align::Center)
|
|
||||||
.vexpand(true)
|
.vexpand(true)
|
||||||
|
.hexpand(true)
|
||||||
.build();
|
.build();
|
||||||
mountopt_entry_adw_listbox.add_css_class("boxed-list");
|
mountopt_entry_adw_listbox.add_css_class("boxed-list");
|
||||||
|
|
||||||
let mountopt_entry_row = adw::EntryRow::builder()
|
let mountopt_entry_row = adw::EntryRow::builder()
|
||||||
.title("Additional Mount Options")
|
.title("Additional Mount Options")
|
||||||
.vexpand(true)
|
.vexpand(true)
|
||||||
|
.hexpand(true)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let partition_row_delete_button = gtk::Button::builder()
|
let partition_row_delete_button = gtk::Button::builder()
|
||||||
@ -98,6 +106,7 @@ impl ObjectImpl for DriveMountRow {
|
|||||||
.margin_bottom(5)
|
.margin_bottom(5)
|
||||||
.width_request(40)
|
.width_request(40)
|
||||||
.vexpand(true)
|
.vexpand(true)
|
||||||
|
.hexpand(true)
|
||||||
.icon_name("edit-delete")
|
.icon_name("edit-delete")
|
||||||
.halign(gtk::Align::End)
|
.halign(gtk::Align::End)
|
||||||
.build();
|
.build();
|
||||||
|
@ -24,6 +24,7 @@ use std::rc::Rc;
|
|||||||
use crate::manual_partitioning::DriveMount;
|
use crate::manual_partitioning::DriveMount;
|
||||||
use serde::*;
|
use serde::*;
|
||||||
use serde_json::*;
|
use serde_json::*;
|
||||||
|
use duct::*;
|
||||||
|
|
||||||
#[derive(PartialEq, Debug, Eq, Hash, Clone, Serialize, Deserialize)]
|
#[derive(PartialEq, Debug, Eq, Hash, Clone, Serialize, Deserialize)]
|
||||||
struct CrypttabEntry {
|
struct CrypttabEntry {
|
||||||
@ -63,6 +64,7 @@ pub fn install_page(
|
|||||||
let crypttab_password = adw::PasswordEntryRow::builder()
|
let crypttab_password = adw::PasswordEntryRow::builder()
|
||||||
.title("LUKS Password for ".to_owned() + &partitions.partition)
|
.title("LUKS Password for ".to_owned() + &partitions.partition)
|
||||||
.build();
|
.build();
|
||||||
|
crypttab_password.set_show_apply_button(true);
|
||||||
crypttab_password_listbox.append(&crypttab_password);
|
crypttab_password_listbox.append(&crypttab_password);
|
||||||
let crypttab_dialog = adw::MessageDialog::builder()
|
let crypttab_dialog = adw::MessageDialog::builder()
|
||||||
.transient_for(window)
|
.transient_for(window)
|
||||||
@ -80,26 +82,18 @@ pub fn install_page(
|
|||||||
crypttab_dialog
|
crypttab_dialog
|
||||||
.add_response("crypttab_dialog_auto", "Automatic Unlock with root unlock");
|
.add_response("crypttab_dialog_auto", "Automatic Unlock with root unlock");
|
||||||
crypttab_dialog.set_response_enabled("crypttab_dialog_auto", false);
|
crypttab_dialog.set_response_enabled("crypttab_dialog_auto", false);
|
||||||
crypttab_password.connect_changed(clone!(@weak crypttab_password, @strong partitions, @weak crypttab_dialog => move |_| {
|
crypttab_password.connect_apply(clone!(@weak crypttab_password, @strong partitions, @weak crypttab_dialog => move |_| {
|
||||||
let (luks_manual_password_sender, luks_manual_password_receiver) = async_channel::unbounded();
|
let (luks_manual_password_sender, luks_manual_password_receiver) = async_channel::unbounded();
|
||||||
let luks_manual_password_sender = luks_manual_password_sender.clone();
|
let luks_manual_password_sender = luks_manual_password_sender.clone();
|
||||||
let luks_password = crypttab_password.text();
|
let luks_password = crypttab_password.text().to_string();
|
||||||
|
|
||||||
gio::spawn_blocking(clone!(@strong crypttab_password, @strong partitions => move || {
|
gio::spawn_blocking(clone!(@strong crypttab_password, @strong partitions => move || {
|
||||||
let luks_check_cli = Command::new("sudo")
|
let result = cmd!("sudo", "/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh", "test_luks_passwd", &partitions.partition, luks_password).run();
|
||||||
.arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
|
if result.is_ok() {
|
||||||
.arg("test_luks_passwd")
|
|
||||||
.arg(&partitions.partition)
|
|
||||||
.arg(&luks_password)
|
|
||||||
.output()
|
|
||||||
.expect("failed to execute process");
|
|
||||||
if luks_check_cli.status.success() {
|
|
||||||
println!("fuck");
|
|
||||||
luks_manual_password_sender
|
luks_manual_password_sender
|
||||||
.send_blocking(false)
|
.send_blocking(false)
|
||||||
.expect("The channel needs to be open.");
|
.expect("The channel needs to be open.");
|
||||||
} else {
|
} else {
|
||||||
println!("shit");
|
|
||||||
luks_manual_password_sender
|
luks_manual_password_sender
|
||||||
.send_blocking(true)
|
.send_blocking(true)
|
||||||
.expect("The channel needs to be open.");
|
.expect("The channel needs to be open.");
|
||||||
|
Loading…
Reference in New Issue
Block a user