cargo fmt
This commit is contained in:
parent
c7a5735e2d
commit
b70fc0a3fb
@ -1,7 +1,7 @@
|
||||
use crate::build_ui::BlockDevice;
|
||||
use crate::config::{MINIMUM_BOOT_BYTE_SIZE, MINIMUM_EFI_BYTE_SIZE, MINIMUM_ROOT_BYTE_SIZE};
|
||||
use crate::installer_stack_page;
|
||||
use crate::partitioning_page::get_block_devices;
|
||||
use crate::config::{MINIMUM_EFI_BYTE_SIZE, MINIMUM_BOOT_BYTE_SIZE, MINIMUM_ROOT_BYTE_SIZE};
|
||||
use crate::build_ui::BlockDevice;
|
||||
use adw::gio;
|
||||
use adw::prelude::*;
|
||||
use glib::{clone, closure_local, ffi::gboolean};
|
||||
@ -411,7 +411,8 @@ pub fn automatic_partitioning_page(
|
||||
device.block_size,
|
||||
);
|
||||
partition_method_automatic_disk_nodisk_error_label.set_visible(false);
|
||||
let usable_disk_space = device.block_size - (MINIMUM_EFI_BYTE_SIZE + MINIMUM_BOOT_BYTE_SIZE);
|
||||
let usable_disk_space =
|
||||
device.block_size - (MINIMUM_EFI_BYTE_SIZE + MINIMUM_BOOT_BYTE_SIZE);
|
||||
let default_root_size = if (usable_disk_space * 40.0) / 100.0 > 100000000000.0 {
|
||||
100000000000.0
|
||||
} else if (usable_disk_space * 40.0) / 100.0 < MINIMUM_ROOT_BYTE_SIZE {
|
||||
@ -426,8 +427,7 @@ pub fn automatic_partitioning_page(
|
||||
"change_value",
|
||||
&[gtk::ScrollType::None.into(), default_root_size.into()],
|
||||
);
|
||||
*partition_method_automatic_target_refcell.borrow_mut() =
|
||||
device.clone();
|
||||
*partition_method_automatic_target_refcell.borrow_mut() = device.clone();
|
||||
if check_for_errors(&error_labels) {
|
||||
automatic_partitioning_page.set_next_sensitive(true)
|
||||
} else {
|
||||
|
@ -1,5 +1,7 @@
|
||||
use crate::{
|
||||
config::APP_ID, efi_error_page, eula_page, keyboard_page, language_page, timezone_page, welcome_page, partitioning_page, installation_summary_page
|
||||
config::APP_ID, efi_error_page, eula_page, installation_progress_page,
|
||||
installation_summary_page, keyboard_page, language_page, partitioning_page, timezone_page,
|
||||
welcome_page,
|
||||
};
|
||||
use gtk::{gio, glib, prelude::*};
|
||||
use std::{cell::RefCell, path::Path, rc::Rc};
|
||||
@ -11,7 +13,7 @@ use std::{cell::RefCell, path::Path, rc::Rc};
|
||||
#[derive(Default, Clone, Debug)]
|
||||
pub struct PikaLocale {
|
||||
pub name: String,
|
||||
pub pretty_name: String
|
||||
pub pretty_name: String,
|
||||
}
|
||||
|
||||
/// Keyboard Data types
|
||||
@ -20,7 +22,7 @@ pub struct PikaLocale {
|
||||
pub struct PikaKeymap {
|
||||
pub name: String,
|
||||
pub variant: Option<String>,
|
||||
pub pretty_name: String
|
||||
pub pretty_name: String,
|
||||
}
|
||||
|
||||
#[derive(Default, Clone, Debug)]
|
||||
@ -172,7 +174,40 @@ pub fn build_ui(app: &adw::Application) {
|
||||
&page_done_action,
|
||||
);
|
||||
|
||||
installation_summary_page::installation_summary_page(&carousel, &language_changed_action, &page_done_action,&language_selection_text_refcell, &keymap_selection_text_refcell, &timezone_selection_text_refcell, &partition_method_type_refcell, &partition_method_automatic_target_refcell, &partition_method_automatic_target_fs_refcell, &partition_method_automatic_luks_enabled_refcell, &partition_method_automatic_luks_refcell, &partition_method_automatic_ratio_refcell, &partition_method_automatic_seperation_refcell, &partition_method_manual_fstab_entry_array_refcell, &partition_method_manual_luks_enabled_refcell, &partition_method_manual_crypttab_entry_array_refcell);
|
||||
installation_summary_page::installation_summary_page(
|
||||
&carousel,
|
||||
&language_changed_action,
|
||||
&page_done_action,
|
||||
&language_selection_text_refcell,
|
||||
&keymap_selection_text_refcell,
|
||||
&timezone_selection_text_refcell,
|
||||
&partition_method_type_refcell,
|
||||
&partition_method_automatic_target_refcell,
|
||||
&partition_method_automatic_target_fs_refcell,
|
||||
&partition_method_automatic_luks_enabled_refcell,
|
||||
&partition_method_automatic_luks_refcell,
|
||||
&partition_method_automatic_ratio_refcell,
|
||||
&partition_method_automatic_seperation_refcell,
|
||||
&partition_method_manual_fstab_entry_array_refcell,
|
||||
&partition_method_manual_luks_enabled_refcell,
|
||||
&partition_method_manual_crypttab_entry_array_refcell,
|
||||
);
|
||||
|
||||
installation_progress_page::create_installation_script(
|
||||
&language_selection_text_refcell,
|
||||
&keymap_selection_text_refcell,
|
||||
&timezone_selection_text_refcell,
|
||||
&partition_method_type_refcell,
|
||||
&partition_method_automatic_target_refcell,
|
||||
&partition_method_automatic_target_fs_refcell,
|
||||
&partition_method_automatic_luks_enabled_refcell,
|
||||
&partition_method_automatic_luks_refcell,
|
||||
&partition_method_automatic_ratio_refcell,
|
||||
&partition_method_automatic_seperation_refcell,
|
||||
&partition_method_manual_fstab_entry_array_refcell,
|
||||
&partition_method_manual_luks_enabled_refcell,
|
||||
&partition_method_manual_crypttab_entry_array_refcell,
|
||||
);
|
||||
|
||||
window.present()
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ use adw::{prelude::*, subclass::prelude::*, *};
|
||||
use glib::{clone, subclass::Signal, Properties};
|
||||
use gtk::{glib, Orientation::Horizontal};
|
||||
|
||||
use crate::{build_ui::{FstabEntry}};
|
||||
use crate::build_ui::FstabEntry;
|
||||
|
||||
// ANCHOR: custom_button
|
||||
// Object holding the state
|
||||
|
@ -3,7 +3,7 @@ mod imp;
|
||||
use glib::Object;
|
||||
use gtk::glib;
|
||||
|
||||
use crate::{build_ui::{FstabEntry}, partitioning_page::create_parition_struct};
|
||||
use crate::{build_ui::FstabEntry, partitioning_page::create_parition_struct};
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct DriveMountRow(ObjectSubclass<imp::DriveMountRow>)
|
||||
|
@ -1,6 +1,29 @@
|
||||
fn create_installation_script() {
|
||||
let standard_installation_prog =
|
||||
r###"#! /bin/bash
|
||||
use crate::{
|
||||
build_ui::{BlockDevice, CrypttabEntry, FstabEntry, PikaKeymap, PikaLocale},
|
||||
config::{MINIMUM_BOOT_BYTE_SIZE, MINIMUM_EFI_BYTE_SIZE},
|
||||
installer_stack_page,
|
||||
};
|
||||
use adw::prelude::*;
|
||||
use glib::{clone, closure_local};
|
||||
use gtk::{gio, glib};
|
||||
use std::{cell::RefCell, fs, ops::Deref, path::Path, process::Command, rc::Rc};
|
||||
|
||||
pub fn create_installation_script(
|
||||
language_selection_text_refcell: &Rc<RefCell<PikaLocale>>,
|
||||
keymap_selection_text_refcell: &Rc<RefCell<PikaKeymap>>,
|
||||
timezone_selection_text_refcell: &Rc<RefCell<String>>,
|
||||
partition_method_type_refcell: &Rc<RefCell<String>>,
|
||||
partition_method_automatic_target_refcell: &Rc<RefCell<BlockDevice>>,
|
||||
partition_method_automatic_target_fs_refcell: &Rc<RefCell<String>>,
|
||||
partition_method_automatic_luks_enabled_refcell: &Rc<RefCell<bool>>,
|
||||
partition_method_automatic_luks_refcell: &Rc<RefCell<String>>,
|
||||
partition_method_automatic_ratio_refcell: &Rc<RefCell<f64>>,
|
||||
partition_method_automatic_seperation_refcell: &Rc<RefCell<String>>,
|
||||
partition_method_manual_fstab_entry_array_refcell: &Rc<RefCell<Vec<FstabEntry>>>,
|
||||
partition_method_manual_luks_enabled_refcell: &Rc<RefCell<bool>>,
|
||||
partition_method_manual_crypttab_entry_array_refcell: &Rc<RefCell<Vec<CrypttabEntry>>>,
|
||||
) {
|
||||
let standard_installation_prog = r###"#! /bin/bash
|
||||
set -e
|
||||
|
||||
PIKA_INSTALL_CHROOT_PATH={CHROOT_PATH}
|
||||
@ -13,8 +36,7 @@ fn create_installation_script() {
|
||||
|
||||
"###;
|
||||
|
||||
let automatic_standard_installation_prog =
|
||||
r###"
|
||||
let automatic_standard_installation_prog = r###"
|
||||
|
||||
PIKA_INSTALL_AUTO_TARGET_DISK={AUTO_INSTALL_TARGET_DISK}
|
||||
|
||||
@ -28,11 +50,9 @@ fn create_installation_script() {
|
||||
|
||||
"###;
|
||||
|
||||
|
||||
//
|
||||
|
||||
let automatic_home_subvol_btrfs_open_installation_prog =
|
||||
r###"
|
||||
let automatic_home_subvol_btrfs_open_installation_prog = r###"
|
||||
|
||||
parted -s -a optimal /dev/${PIKA_INSTALL_AUTO_TARGET_DISK} mklabel gpt \
|
||||
mkpart "linux-efi" 1MiB 500Mib \
|
||||
@ -88,8 +108,7 @@ fn create_installation_script() {
|
||||
|
||||
"###;
|
||||
|
||||
let automatic_home_subvol_btrfs_locked_installation_prog =
|
||||
r###"
|
||||
let automatic_home_subvol_btrfs_locked_installation_prog = r###"
|
||||
|
||||
PIKA_INSTALL_AUTO_LUKS_PASSWORD={AUTO_LUKS_PASSWORD}
|
||||
|
||||
@ -153,8 +172,7 @@ fn create_installation_script() {
|
||||
|
||||
//
|
||||
|
||||
let automatic_home_part_btrfs_open_installation_prog =
|
||||
r###"
|
||||
let automatic_home_part_btrfs_open_installation_prog = r###"
|
||||
|
||||
PIKA_INSTALL_AUTO_ROOT_SIZE=$(echo "scale=2 ; {{ROOT_PART_SIZE}} / 1024 / 1024" | bc | cut -f1 -d".")
|
||||
|
||||
@ -221,8 +239,7 @@ fn create_installation_script() {
|
||||
|
||||
"###;
|
||||
|
||||
let automatic_home_part_btrfs_locked_installation_prog =
|
||||
r###"
|
||||
let automatic_home_part_btrfs_locked_installation_prog = r###"
|
||||
|
||||
PIKA_INSTALL_AUTO_LUKS_PASSWORD={AUTO_LUKS_PASSWORD}
|
||||
PIKA_INSTALL_AUTO_ROOT_SIZE=$(echo "scale=2 ; {{ROOT_PART_SIZE}} / 1024 / 1024" | bc | cut -f1 -d".")
|
||||
@ -300,8 +317,7 @@ fn create_installation_script() {
|
||||
|
||||
//
|
||||
|
||||
let automatic_home_none_btrfs_open_installation_prog =
|
||||
r###"
|
||||
let automatic_home_none_btrfs_open_installation_prog = r###"
|
||||
|
||||
parted -s -a optimal /dev/${PIKA_INSTALL_AUTO_TARGET_DISK} mklabel gpt \
|
||||
mkpart "linux-efi" 1MiB 500Mib \
|
||||
@ -351,8 +367,7 @@ fn create_installation_script() {
|
||||
|
||||
"###;
|
||||
|
||||
let automatic_home_none_btrfs_locked_installation_prog =
|
||||
r###"
|
||||
let automatic_home_none_btrfs_locked_installation_prog = r###"
|
||||
|
||||
PIKA_INSTALL_AUTO_LUKS_PASSWORD={AUTO_LUKS_PASSWORD}
|
||||
|
||||
@ -410,8 +425,7 @@ fn create_installation_script() {
|
||||
|
||||
//
|
||||
|
||||
let automatic_home_part_ext4_open_installation_prog =
|
||||
r###"
|
||||
let automatic_home_part_ext4_open_installation_prog = r###"
|
||||
|
||||
PIKA_INSTALL_AUTO_ROOT_SIZE=$(echo "scale=2 ; {{ROOT_PART_SIZE}} / 1024 / 1024" | bc | cut -f1 -d".")
|
||||
|
||||
@ -462,8 +476,7 @@ fn create_installation_script() {
|
||||
|
||||
"###;
|
||||
|
||||
let automatic_home_part_ext4_locked_installation_prog =
|
||||
r###"
|
||||
let automatic_home_part_ext4_locked_installation_prog = r###"
|
||||
|
||||
PIKA_INSTALL_AUTO_LUKS_PASSWORD={AUTO_LUKS_PASSWORD}
|
||||
PIKA_INSTALL_AUTO_ROOT_SIZE=$(echo "scale=2 ; {{ROOT_PART_SIZE}} / 1024 / 1024" | bc | cut -f1 -d".")
|
||||
@ -525,8 +538,7 @@ fn create_installation_script() {
|
||||
|
||||
//
|
||||
|
||||
let automatic_home_none_ext4_open_installation_prog =
|
||||
r###"
|
||||
let automatic_home_none_ext4_open_installation_prog = r###"
|
||||
|
||||
parted -s -a optimal /dev/${PIKA_INSTALL_AUTO_TARGET_DISK} mklabel gpt \
|
||||
mkpart "linux-efi" 1MiB 500Mib \
|
||||
@ -568,8 +580,7 @@ fn create_installation_script() {
|
||||
|
||||
"###;
|
||||
|
||||
let automatic_home_none_ext4_locked_installation_prog =
|
||||
r###"
|
||||
let automatic_home_none_ext4_locked_installation_prog = r###"
|
||||
|
||||
PIKA_INSTALL_AUTO_LUKS_PASSWORD={AUTO_LUKS_PASSWORD}
|
||||
|
||||
@ -619,8 +630,7 @@ fn create_installation_script() {
|
||||
|
||||
//
|
||||
|
||||
let automatic_home_part_xfs_open_installation_prog =
|
||||
r###"
|
||||
let automatic_home_part_xfs_open_installation_prog = r###"
|
||||
|
||||
PIKA_INSTALL_AUTO_ROOT_SIZE=$(echo "scale=2 ; {{ROOT_PART_SIZE}} / 1024 / 1024" | bc | cut -f1 -d".")
|
||||
|
||||
@ -671,8 +681,7 @@ fn create_installation_script() {
|
||||
|
||||
"###;
|
||||
|
||||
let automatic_home_part_xfs_locked_installation_prog =
|
||||
r###"
|
||||
let automatic_home_part_xfs_locked_installation_prog = r###"
|
||||
|
||||
PIKA_INSTALL_AUTO_LUKS_PASSWORD={AUTO_LUKS_PASSWORD}
|
||||
PIKA_INSTALL_AUTO_ROOT_SIZE=$(echo "scale=2 ; {{ROOT_PART_SIZE}} / 1024 / 1024" | bc | cut -f1 -d".")
|
||||
@ -734,8 +743,7 @@ fn create_installation_script() {
|
||||
|
||||
//
|
||||
|
||||
let automatic_home_none_xfs_open_installation_prog =
|
||||
r###"
|
||||
let automatic_home_none_xfs_open_installation_prog = r###"
|
||||
|
||||
parted -s -a optimal /dev/${PIKA_INSTALL_AUTO_TARGET_DISK} mklabel gpt \
|
||||
mkpart "linux-efi" 1MiB 500Mib \
|
||||
@ -777,8 +785,7 @@ fn create_installation_script() {
|
||||
|
||||
"###;
|
||||
|
||||
let automatic_home_none_xfs_locked_installation_prog =
|
||||
r###"
|
||||
let automatic_home_none_xfs_locked_installation_prog = r###"
|
||||
|
||||
PIKA_INSTALL_AUTO_LUKS_PASSWORD={AUTO_LUKS_PASSWORD}
|
||||
|
||||
@ -825,4 +832,29 @@ fn create_installation_script() {
|
||||
fi
|
||||
|
||||
"###;
|
||||
|
||||
let script = strfmt::strfmt(
|
||||
standard_installation_prog,
|
||||
&std::collections::HashMap::from([
|
||||
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
|
||||
(
|
||||
"LOCALE".to_string(),
|
||||
language_selection_text_refcell.borrow().name.as_str(),
|
||||
),
|
||||
(
|
||||
"KEYMAP_BASE".to_string(),
|
||||
keymap_selection_text_refcell.borrow().name.as_str(),
|
||||
),
|
||||
(
|
||||
"KEYMAP_VARIANT".to_string(),
|
||||
match &keymap_selection_text_refcell.borrow().variant {
|
||||
Some(t) => t.as_str(),
|
||||
None => "",
|
||||
},
|
||||
),
|
||||
]),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
println!("{}", script)
|
||||
}
|
@ -1,4 +1,8 @@
|
||||
use crate::{build_ui::{BlockDevice, CrypttabEntry, FstabEntry, PikaKeymap, PikaLocale}, config::{MINIMUM_BOOT_BYTE_SIZE, MINIMUM_EFI_BYTE_SIZE}, installer_stack_page};
|
||||
use crate::{
|
||||
build_ui::{BlockDevice, CrypttabEntry, FstabEntry, PikaKeymap, PikaLocale},
|
||||
config::{MINIMUM_BOOT_BYTE_SIZE, MINIMUM_EFI_BYTE_SIZE},
|
||||
installer_stack_page,
|
||||
};
|
||||
use adw::prelude::*;
|
||||
use glib::{clone, closure_local};
|
||||
use gtk::{gio, glib};
|
||||
@ -8,7 +12,7 @@ pub fn installation_summary_page(
|
||||
main_carousel: &adw::Carousel,
|
||||
language_changed_action: &gio::SimpleAction,
|
||||
page_done_action: &gio::SimpleAction,
|
||||
language_summary_text_refcell: &Rc<RefCell<PikaLocale>>,
|
||||
language_selection_text_refcell: &Rc<RefCell<PikaLocale>>,
|
||||
keymap_selection_text_refcell: &Rc<RefCell<PikaKeymap>>,
|
||||
timezone_selection_text_refcell: &Rc<RefCell<String>>,
|
||||
partition_method_type_refcell: &Rc<RefCell<String>>,
|
||||
@ -20,7 +24,7 @@ pub fn installation_summary_page(
|
||||
partition_method_automatic_seperation_refcell: &Rc<RefCell<String>>,
|
||||
partition_method_manual_fstab_entry_array_refcell: &Rc<RefCell<Vec<FstabEntry>>>,
|
||||
partition_method_manual_luks_enabled_refcell: &Rc<RefCell<bool>>,
|
||||
partition_method_manual_crypttab_entry_array_refcell: &Rc<RefCell<Vec<CrypttabEntry>>>
|
||||
partition_method_manual_crypttab_entry_array_refcell: &Rc<RefCell<Vec<CrypttabEntry>>>,
|
||||
) {
|
||||
let installation_summary_page = installer_stack_page::InstallerStackPage::new();
|
||||
installation_summary_page.set_page_icon("dialog-warning-symbolic");
|
||||
@ -72,7 +76,7 @@ pub fn installation_summary_page(
|
||||
#[strong]
|
||||
installation_summary_row_viewport_listbox,
|
||||
#[strong]
|
||||
language_summary_text_refcell,
|
||||
language_selection_text_refcell,
|
||||
#[strong]
|
||||
keymap_selection_text_refcell,
|
||||
#[strong]
|
||||
@ -108,7 +112,7 @@ pub fn installation_summary_page(
|
||||
//
|
||||
let install_confirm_detail_language = adw::ActionRow::builder()
|
||||
.title(t!("install_confirm_detail_language_title"))
|
||||
.subtitle(&language_summary_text_refcell.borrow().pretty_name)
|
||||
.subtitle(&language_selection_text_refcell.borrow().pretty_name)
|
||||
.build();
|
||||
install_confirm_detail_language.add_css_class("property");
|
||||
installation_summary_row_viewport_listbox.append(&install_confirm_detail_language);
|
||||
|
@ -91,7 +91,7 @@ pub fn keyboard_page(
|
||||
} else {
|
||||
Some(keymap_variant)
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
sorted_keymap_vec.sort_by_key(|k| k.pretty_name.clone());
|
||||
|
@ -88,7 +88,7 @@ pub fn language_page(
|
||||
name: locale.to_string(),
|
||||
pretty_name: gnome_desktop::language_from_locale(&locale, None)
|
||||
.unwrap_or(locale.clone().into())
|
||||
.to_string()
|
||||
.to_string(),
|
||||
})
|
||||
}
|
||||
sorted_locale_vec.sort_by_key(|k| k.pretty_name.clone());
|
||||
|
@ -4,23 +4,23 @@ use std::env;
|
||||
mod build_ui;
|
||||
mod config;
|
||||
//
|
||||
mod installer_stack_page;
|
||||
mod drive_mount_row;
|
||||
mod installer_stack_page;
|
||||
//
|
||||
mod welcome_page;
|
||||
mod efi_error_page;
|
||||
mod welcome_page;
|
||||
//
|
||||
mod eula_page;
|
||||
mod keyboard_page;
|
||||
mod language_page;
|
||||
mod timezone_page;
|
||||
//
|
||||
mod partitioning_page;
|
||||
mod automatic_partitioning_page;
|
||||
mod manual_partitioning_page;
|
||||
mod partitioning_page;
|
||||
//
|
||||
mod installation_summary_page;
|
||||
mod installation_progress_page;
|
||||
mod installation_summary_page;
|
||||
|
||||
#[macro_use]
|
||||
extern crate rust_i18n;
|
||||
|
@ -1,19 +1,8 @@
|
||||
use crate::drive_mount_row::DriveMountRow;
|
||||
use crate::{
|
||||
build_ui::{
|
||||
CrypttabEntry,
|
||||
FstabEntry,
|
||||
Partition,
|
||||
SubvolDeclaration
|
||||
},
|
||||
partitioning_page::{
|
||||
get_partitions
|
||||
},
|
||||
config::{
|
||||
MINIMUM_EFI_BYTE_SIZE,
|
||||
MINIMUM_BOOT_BYTE_SIZE,
|
||||
MINIMUM_ROOT_BYTE_SIZE,
|
||||
}
|
||||
build_ui::{CrypttabEntry, FstabEntry, Partition, SubvolDeclaration},
|
||||
config::{MINIMUM_BOOT_BYTE_SIZE, MINIMUM_EFI_BYTE_SIZE, MINIMUM_ROOT_BYTE_SIZE},
|
||||
partitioning_page::get_partitions,
|
||||
};
|
||||
use adw::gio;
|
||||
use adw::prelude::*;
|
||||
@ -224,11 +213,11 @@ pub fn create_efi_row(
|
||||
if row.mountopts().contains("subvol=") || row.mountopts().contains("subvolid") {
|
||||
(*subvol_partition_array_refcell.borrow_mut()).push(SubvolDeclaration {
|
||||
part_name: Rc::new(RefCell::new(row.partition())),
|
||||
made_by: Rc::new(RefCell::new(row.id()))
|
||||
}
|
||||
);
|
||||
made_by: Rc::new(RefCell::new(row.id())),
|
||||
});
|
||||
} else {
|
||||
(*subvol_partition_array_refcell.borrow_mut()).retain(|x| *x.made_by.borrow() != row.id());
|
||||
(*subvol_partition_array_refcell.borrow_mut())
|
||||
.retain(|x| *x.made_by.borrow() != row.id());
|
||||
}
|
||||
partition_changed_action.activate(None);
|
||||
}
|
||||
@ -451,11 +440,11 @@ pub fn create_boot_row(
|
||||
if row.mountopts().contains("subvol=") || row.mountopts().contains("subvolid") {
|
||||
(*subvol_partition_array_refcell.borrow_mut()).push(SubvolDeclaration {
|
||||
part_name: Rc::new(RefCell::new(row.partition())),
|
||||
made_by: Rc::new(RefCell::new(row.id()))
|
||||
}
|
||||
);
|
||||
made_by: Rc::new(RefCell::new(row.id())),
|
||||
});
|
||||
} else {
|
||||
(*subvol_partition_array_refcell.borrow_mut()).retain(|x| *x.made_by.borrow() != row.id());
|
||||
(*subvol_partition_array_refcell.borrow_mut())
|
||||
.retain(|x| *x.made_by.borrow() != row.id());
|
||||
}
|
||||
partition_changed_action.activate(None);
|
||||
}
|
||||
@ -683,11 +672,11 @@ pub fn create_root_row(
|
||||
if row.mountopts().contains("subvol=") || row.mountopts().contains("subvolid") {
|
||||
(*subvol_partition_array_refcell.borrow_mut()).push(SubvolDeclaration {
|
||||
part_name: Rc::new(RefCell::new(row.partition())),
|
||||
made_by: Rc::new(RefCell::new(row.id()))
|
||||
}
|
||||
);
|
||||
made_by: Rc::new(RefCell::new(row.id())),
|
||||
});
|
||||
} else {
|
||||
(*subvol_partition_array_refcell.borrow_mut()).retain(|x| *x.made_by.borrow() != row.id());
|
||||
(*subvol_partition_array_refcell.borrow_mut())
|
||||
.retain(|x| *x.made_by.borrow() != row.id());
|
||||
}
|
||||
partition_changed_action.activate(None);
|
||||
}
|
||||
@ -879,11 +868,11 @@ pub fn create_mount_row(
|
||||
if row.mountopts().contains("subvol=") || row.mountopts().contains("subvolid") {
|
||||
(*subvol_partition_array_refcell.borrow_mut()).push(SubvolDeclaration {
|
||||
part_name: Rc::new(RefCell::new(row.partition())),
|
||||
made_by: Rc::new(RefCell::new(row.id()))
|
||||
}
|
||||
);
|
||||
made_by: Rc::new(RefCell::new(row.id())),
|
||||
});
|
||||
} else {
|
||||
(*subvol_partition_array_refcell.borrow_mut()).retain(|x| *x.made_by.borrow() != row.id());
|
||||
(*subvol_partition_array_refcell.borrow_mut())
|
||||
.retain(|x| *x.made_by.borrow() != row.id());
|
||||
}
|
||||
partition_changed_action.activate(None);
|
||||
}
|
||||
@ -1053,7 +1042,9 @@ fn post_check_drive_mount(
|
||||
|
||||
if used_partition_array.iter().any(|e| {
|
||||
(part_name == &e.partition.part_name && part_name != &row.partition())
|
||||
&& (subvol_partition_array.iter().any(|e| *e.part_name.borrow() == *part_name))
|
||||
&& (subvol_partition_array
|
||||
.iter()
|
||||
.any(|e| *e.part_name.borrow() == *part_name))
|
||||
}) {
|
||||
if *partition_row_struct.never.borrow() == false
|
||||
&& *partition_row_struct.swap_fs_error.borrow() == false
|
||||
@ -1065,7 +1056,9 @@ fn post_check_drive_mount(
|
||||
} else if used_partition_array.iter().any(|e| {
|
||||
part_name == &e.partition.part_name
|
||||
&& e.used_by != row.id()
|
||||
&& !subvol_partition_array.iter().any(|e| *e.part_name.borrow() == *part_name)
|
||||
&& !subvol_partition_array
|
||||
.iter()
|
||||
.any(|e| *e.part_name.borrow() == *part_name)
|
||||
}) {
|
||||
if &row.partition() == part_name {
|
||||
null_checkbutton.set_active(true);
|
||||
|
@ -1,12 +1,16 @@
|
||||
use crate::drive_mount_row::DriveMountRow;
|
||||
use crate::{build_ui::{CrypttabEntry, FstabEntry, Partition, SubvolDeclaration}, installer_stack_page, partitioning_page::{get_partitions, get_luks_uuid, test_luks_passwd}};
|
||||
use crate::{
|
||||
build_ui::{CrypttabEntry, FstabEntry, Partition, SubvolDeclaration},
|
||||
installer_stack_page,
|
||||
partitioning_page::{get_luks_uuid, get_partitions, test_luks_passwd},
|
||||
};
|
||||
use adw::gio;
|
||||
use adw::prelude::*;
|
||||
use glib::{clone, closure_local};
|
||||
use gtk::{glib, Orientation};
|
||||
use std::{cell::RefCell, collections::HashSet, rc::Rc};
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use std::sync::Arc;
|
||||
use std::{cell::RefCell, collections::HashSet, rc::Rc};
|
||||
|
||||
mod func;
|
||||
|
||||
@ -30,13 +34,13 @@ pub fn manual_partitioning_page(
|
||||
|
||||
let partition_array_refcell = Rc::new(RefCell::new(get_partitions()));
|
||||
let used_partition_array_refcell: Rc<RefCell<Vec<FstabEntry>>> = Rc::new(RefCell::default());
|
||||
let subvol_partition_array_refcell: Rc<RefCell<Vec<SubvolDeclaration>>> = Rc::new(RefCell::default());
|
||||
let subvol_partition_array_refcell: Rc<RefCell<Vec<SubvolDeclaration>>> =
|
||||
Rc::new(RefCell::default());
|
||||
let extra_mount_id_refcell: Rc<RefCell<i32>> = Rc::new(RefCell::new(3));
|
||||
|
||||
//
|
||||
|
||||
let partition_changed_action =
|
||||
gio::SimpleAction::new("partition-changed", None);
|
||||
let partition_changed_action = gio::SimpleAction::new("partition-changed", None);
|
||||
|
||||
//
|
||||
|
||||
@ -281,12 +285,10 @@ pub fn manual_partitioning_page(
|
||||
} else {
|
||||
(errored.store(true, std::sync::atomic::Ordering::Relaxed));
|
||||
partition_method_manual_mountpoint_invalid_error_label.set_visible(true);
|
||||
|
||||
}
|
||||
if fs_entry.partition.part_name.is_empty() {
|
||||
(errored.store(true, std::sync::atomic::Ordering::Relaxed));
|
||||
partition_method_manual_partition_empty_error_label.set_visible(true);
|
||||
|
||||
}
|
||||
if !seen_mountpoints.insert(fs_entry.clone().mountpoint) {
|
||||
(errored.store(true, std::sync::atomic::Ordering::Relaxed));
|
||||
@ -324,7 +326,13 @@ pub fn manual_partitioning_page(
|
||||
while let Ok(state) = check_delay_receiver.recv().await {
|
||||
if state.load(std::sync::atomic::Ordering::Relaxed) == false {
|
||||
partition_method_manual_valid_label.set_visible(true);
|
||||
set_crypttab_entries(&fs_entry_clone0, &seen_crypts, window.clone(), &partition_method_manual_crypttab_entry_array_refcell, &partition_method_manual_luks_enabled_refcell);
|
||||
set_crypttab_entries(
|
||||
&fs_entry_clone0,
|
||||
&seen_crypts,
|
||||
window.clone(),
|
||||
&partition_method_manual_crypttab_entry_array_refcell,
|
||||
&partition_method_manual_luks_enabled_refcell,
|
||||
);
|
||||
manual_partitioning_page.set_next_sensitive(true);
|
||||
}
|
||||
}
|
||||
@ -415,15 +423,25 @@ pub fn manual_partitioning_page(
|
||||
manual_partitioning_page.set_back_tooltip_label(t!("back"));
|
||||
manual_partitioning_page.set_next_tooltip_label(t!("next"));
|
||||
//
|
||||
partition_method_manual_mountpoint_empty_error_label.set_label(&t!("partition_method_manual_mountpoint_empty_error_label_label"));
|
||||
partition_method_manual_mountpoint_invalid_error_label.set_label(&t!("partition_method_manual_mountpoint_invalid_error_label_label"));
|
||||
partition_method_manual_partition_empty_error_label.set_label(&t!("partition_method_manual_partition_empty_error_label_label"));
|
||||
partition_method_manual_mountpoint_duplicate_label.set_label(&t!("partition_method_manual_mountpoint_duplicate_label_label"));
|
||||
partition_method_manual_valid_label.set_label(&t!("partition_method_manual_valid_label_label"));
|
||||
partition_method_manual_mountpoint_empty_error_label.set_label(&t!(
|
||||
"partition_method_manual_mountpoint_empty_error_label_label"
|
||||
));
|
||||
partition_method_manual_mountpoint_invalid_error_label.set_label(&t!(
|
||||
"partition_method_manual_mountpoint_invalid_error_label_label"
|
||||
));
|
||||
partition_method_manual_partition_empty_error_label.set_label(&t!(
|
||||
"partition_method_manual_partition_empty_error_label_label"
|
||||
));
|
||||
partition_method_manual_mountpoint_duplicate_label.set_label(&t!(
|
||||
"partition_method_manual_mountpoint_duplicate_label_label"
|
||||
));
|
||||
partition_method_manual_valid_label
|
||||
.set_label(&t!("partition_method_manual_valid_label_label"));
|
||||
//
|
||||
open_disk_utility_button.set_label(&t!("open_disk_utility_button_label"));
|
||||
filesystem_table_refresh_button.set_label(&t!("filesystem_table_refresh_button_label"));
|
||||
filesystem_table_validate_button.set_label(&t!("filesystem_table_validate_button_label"))
|
||||
filesystem_table_validate_button
|
||||
.set_label(&t!("filesystem_table_validate_button_label"))
|
||||
}
|
||||
));
|
||||
//
|
||||
@ -557,11 +575,19 @@ fn set_crypttab_entries(
|
||||
.margin_start(10)
|
||||
.margin_end(10)
|
||||
.build();
|
||||
let crypttab_password_status_label = gtk::Label::builder()
|
||||
.build();
|
||||
let crypttab_password_status_label = gtk::Label::builder().build();
|
||||
crypttab_password_listbox.add_css_class("boxed-list");
|
||||
let crypttab_password_entry_row = adw::PasswordEntryRow::builder()
|
||||
.title(strfmt::strfmt(&t!("crypttab_password_entry_row_title"), &std::collections::HashMap::from([("LUKS_NAME".to_string(), fs_entry.clone().partition.part_name)])).unwrap())
|
||||
.title(
|
||||
strfmt::strfmt(
|
||||
&t!("crypttab_password_entry_row_title"),
|
||||
&std::collections::HashMap::from([(
|
||||
"LUKS_NAME".to_string(),
|
||||
fs_entry.clone().partition.part_name,
|
||||
)]),
|
||||
)
|
||||
.unwrap(),
|
||||
)
|
||||
.build();
|
||||
crypttab_password_entry_row.set_show_apply_button(true);
|
||||
crypttab_password_listbox.append(&crypttab_password_entry_row);
|
||||
@ -574,11 +600,25 @@ fn set_crypttab_entries(
|
||||
.extra_child(&crypttab_password_child_box)
|
||||
.width_request(400)
|
||||
.height_request(200)
|
||||
.heading(strfmt::strfmt(&t!("crypttab_password_entry_row_title"), &std::collections::HashMap::from([("LUKS_NAME".to_string(), fs_entry.clone().partition.part_name)])).unwrap())
|
||||
.heading(
|
||||
strfmt::strfmt(
|
||||
&t!("crypttab_password_entry_row_title"),
|
||||
&std::collections::HashMap::from([(
|
||||
"LUKS_NAME".to_string(),
|
||||
fs_entry.clone().partition.part_name,
|
||||
)]),
|
||||
)
|
||||
.unwrap(),
|
||||
)
|
||||
.build();
|
||||
crypttab_dialog
|
||||
.add_response("crypttab_dialog_boot", &t!("crypttab_dialog_response_crypttab_dialog_boot"));
|
||||
crypttab_dialog.add_response("crypttab_dialog_auto", &t!("crypttab_dialog_response_crypttab_dialog_auto"));
|
||||
crypttab_dialog.add_response(
|
||||
"crypttab_dialog_boot",
|
||||
&t!("crypttab_dialog_response_crypttab_dialog_boot"),
|
||||
);
|
||||
crypttab_dialog.add_response(
|
||||
"crypttab_dialog_auto",
|
||||
&t!("crypttab_dialog_response_crypttab_dialog_auto"),
|
||||
);
|
||||
crypttab_dialog.set_response_enabled("crypttab_dialog_auto", false);
|
||||
crypttab_password_entry_row.connect_apply(clone!(
|
||||
#[weak]
|
||||
@ -595,7 +635,8 @@ fn set_crypttab_entries(
|
||||
|
||||
let fs_entry_clone1 = fs_entry.clone();
|
||||
|
||||
crypttab_password_status_label.set_label(&t!("crypttab_password_status_label_label_checking"));
|
||||
crypttab_password_status_label
|
||||
.set_label(&t!("crypttab_password_status_label_label_checking"));
|
||||
|
||||
std::thread::spawn(move || {
|
||||
luks_manual_password_sender
|
||||
@ -618,7 +659,8 @@ fn set_crypttab_entries(
|
||||
while let Ok(state) = luks_manual_password_receiver.recv().await {
|
||||
crypttab_dialog.set_response_enabled("crypttab_dialog_auto", state);
|
||||
if state == false {
|
||||
crypttab_password_status_label.set_label(&t!("crypttab_password_status_label_label_wrong_password"))
|
||||
crypttab_password_status_label
|
||||
.set_label(&t!("crypttab_password_status_label_label_wrong_password"))
|
||||
} else {
|
||||
crypttab_password_status_label.set_label("")
|
||||
}
|
||||
@ -634,23 +676,23 @@ fn set_crypttab_entries(
|
||||
crypttab_dialog.choose(None::<&gio::Cancellable>, move |choice| {
|
||||
let part_name = fs_entry.partition.part_name;
|
||||
if choice == "crypttab_dialog_auto" {
|
||||
(*partition_method_manual_crypttab_entry_array_refcell_clone0
|
||||
.borrow_mut())
|
||||
.push(CrypttabEntry {
|
||||
(*partition_method_manual_crypttab_entry_array_refcell_clone0.borrow_mut()).push(
|
||||
CrypttabEntry {
|
||||
partition: part_name.clone(),
|
||||
map: part_name.replace("mapper/", ""),
|
||||
uuid: get_luks_uuid(&part_name),
|
||||
password: Some(crypttab_password_entry_row.text().to_string()),
|
||||
});
|
||||
},
|
||||
);
|
||||
} else {
|
||||
(*partition_method_manual_crypttab_entry_array_refcell_clone0
|
||||
.borrow_mut())
|
||||
.push(CrypttabEntry {
|
||||
(*partition_method_manual_crypttab_entry_array_refcell_clone0.borrow_mut()).push(
|
||||
CrypttabEntry {
|
||||
partition: part_name.clone(),
|
||||
map: part_name.replace("mapper/", ""),
|
||||
uuid: get_luks_uuid(&part_name),
|
||||
password: None,
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
(*partition_method_manual_luks_enabled_refcell_clone0.borrow_mut()) = true;
|
||||
});
|
||||
|
@ -1,4 +1,8 @@
|
||||
use crate::{build_ui::{FstabEntry, CrypttabEntry, BlockDevice, SubvolDeclaration, Partition}, installer_stack_page, automatic_partitioning_page, manual_partitioning_page};
|
||||
use crate::{
|
||||
automatic_partitioning_page,
|
||||
build_ui::{BlockDevice, CrypttabEntry, FstabEntry, Partition, SubvolDeclaration},
|
||||
installer_stack_page, manual_partitioning_page,
|
||||
};
|
||||
use glib::{clone, closure_local, Properties};
|
||||
use gtk::{gio, glib, prelude::*};
|
||||
use std::io::BufRead;
|
||||
|
Loading…
Reference in New Issue
Block a user