make partition selection more intuitive
All checks were successful
PikaOS Package Build & Release (amd64-v3) / build (push) Successful in 2m16s

This commit is contained in:
Ward from fusion-voyager-3 2024-10-11 23:51:38 +03:00
parent 93c4af1c05
commit 1af8042654
24 changed files with 1023 additions and 774 deletions

View File

@ -1 +1 @@
5
6

6
debian/changelog vendored
View File

@ -1,3 +1,9 @@
pika-installer-gtk4 (2.0.0-101pika6) pika; urgency=low
* Fix partition selection
-- Ward Nakchbandi <hotrod.master@hotmail.com> Thu, 20 Sep 2022 22:01:00 +0000
pika-installer-gtk4 (2.0.0-101pika5) pika; urgency=low
* First Release of new installer

View File

@ -35,8 +35,9 @@
"eula_page_title": "EULA",
"efi_error_header_text_label": "Un-Supported Boot Platform",
"efi_error_text_label": "PikaOS Only works on GPT UEFI Systems, This Machine is Booted in CSM/LEGACY mode.",
"exit_button_label": "exit_button_label",
"partition_row_expander_subtitle": "Partition",
"exit_button_label": "Exit",
"partition_button_row_title": "Partition",
"partition_button_row_subtitle_none_selected": "No Partition Selected",
"mountpoint_entry_row_title": "Mountpoint\nE.g: /var",
"mountopts_entry_row_title": "Additional Mount Options\nE.g: subvol=@home",
"automatic_partitioning_page_title": "Automatic Partitioning Installer",
@ -128,5 +129,7 @@
"installation_complete_page_subtitle_success": "The Installation of PikaOS Has Been Completed Sucessfully",
"devices_selection_button_row_dialog_auto_title": "Automatic Partition Disk Selection",
"devices_selection_button_row_dialog_auto_body": "Please Select A Disk for PikaOS to *Erase* And Install on.",
"devices_selection_button_row_dialog_manual_title": "Manual Partition Disk Selection",
"devices_selection_button_row_dialog_manual_body": "Please Select a Partition for This Filesystem Mount",
"devices_selection_button_row_dialog_ok_label": "Done"
}

View File

@ -3,8 +3,8 @@ use crate::config::{MINIMUM_BOOT_BYTE_SIZE, MINIMUM_EFI_BYTE_SIZE, MINIMUM_ROOT_
use crate::installer_stack_page;
use crate::partitioning_page::get_block_devices;
use adw::prelude::*;
use gtk::{glib, gio};
use glib::{clone, closure_local};
use gtk::{gio, glib};
use std::{cell::RefCell, rc::Rc};
pub fn automatic_partitioning_page(
@ -262,6 +262,7 @@ pub fn automatic_partitioning_page(
devices_selection_button_row_listbox.add_css_class("boxed-list");
let devices_selection_button_row = adw::ButtonRow::builder()
.start_icon_name("drive-harddisk-symbolic")
.build();
devices_selection_button_row.add_css_class("accent-blink");
@ -292,11 +293,18 @@ pub fn automatic_partitioning_page(
.height_request(400)
.build();
devices_selection_button_row_dialog.add_response("devices_selection_button_row_dialog_ok", "devices_selection_button_row_dialog_ok");
devices_selection_button_row_dialog.add_response(
"devices_selection_button_row_dialog_ok",
"devices_selection_button_row_dialog_ok",
);
devices_selection_button_row.connect_activated(clone!(#[weak] devices_selection_button_row_dialog, move |_| {
devices_selection_button_row.connect_activated(clone!(
#[weak]
devices_selection_button_row_dialog,
move |_| {
devices_selection_button_row_dialog.present(Some(&window));
}));
}
));
//devices_selection_button_row.add_row(&devices_selection_button_row_viewport);
@ -670,13 +678,17 @@ pub fn automatic_partitioning_page(
automatic_partitioning_page.set_back_tooltip_label(t!("back"));
automatic_partitioning_page.set_next_tooltip_label(t!("next"));
//
devices_selection_button_row.set_title(&t!(
"devices_selection_button_row_title_no_drive_selected"
));
devices_selection_button_row
.set_title(&t!("devices_selection_button_row_title_no_drive_selected"));
//
devices_selection_button_row_dialog.set_title(&t!("devices_selection_button_row_dialog_auto_title"));
devices_selection_button_row_dialog.set_body(&t!("devices_selection_button_row_dialog_auto_body"));
devices_selection_button_row_dialog.set_response_label("devices_selection_button_row_dialog_ok", &t!("devices_selection_button_row_dialog_ok_label"));
devices_selection_button_row_dialog
.set_title(&t!("devices_selection_button_row_dialog_auto_title"));
devices_selection_button_row_dialog
.set_body(&t!("devices_selection_button_row_dialog_auto_body"));
devices_selection_button_row_dialog.set_response_label(
"devices_selection_button_row_dialog_ok",
&t!("devices_selection_button_row_dialog_ok_label"),
);
//
partition_method_automatic_disk_nodisk_error_label.set_label(&t!(
"partition_method_automatic_disk_nodisk_error_label_label"
@ -740,7 +752,13 @@ fn disk_check(
device_block_size: f64,
) {
if device_button.is_active() {
devices_selection_button_row.set_title(&(device_block_model.to_owned() + ": " + device_block_name + " " + device_block_size_pretty));
devices_selection_button_row.set_title(
&(device_block_model.to_owned()
+ ": "
+ device_block_name
+ " "
+ device_block_size_pretty),
);
devices_selection_button_row.remove_css_class("accent-blink");
if device_block_size >= MINIMUM_ROOT_BYTE_SIZE {
partition_method_automatic_disk_size_error_label.set_visible(false);

View File

@ -1,7 +1,7 @@
use crate::{
config::APP_ID, efi_error_page, eula_page, installation_progress_page,
installation_summary_page, keyboard_page, language_page, partitioning_page, timezone_page, installation_complete_page,
welcome_page,
config::APP_ID, efi_error_page, eula_page, installation_complete_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};
@ -22,7 +22,7 @@ pub struct PikaLocale {
pub struct KBDMap {
pub console: String,
pub layout: String,
pub variant: String
pub variant: String,
}
#[derive(Default, Clone, Debug)]
@ -78,10 +78,13 @@ pub fn build_ui(app: &adw::Application) {
glib::set_application_name(&t!("application_name"));
let (installation_log_loop_sender, installation_log_loop_receiver) = async_channel::unbounded();
let installation_log_loop_sender: async_channel::Sender<String> = installation_log_loop_sender.clone();
let installation_log_loop_sender: async_channel::Sender<String> =
installation_log_loop_sender.clone();
let (installation_log_status_loop_sender, installation_log_status_loop_receiver) = async_channel::unbounded();
let installation_log_status_loop_sender: async_channel::Sender<bool> = installation_log_status_loop_sender.clone();
let (installation_log_status_loop_sender, installation_log_status_loop_receiver) =
async_channel::unbounded();
let installation_log_status_loop_sender: async_channel::Sender<bool> =
installation_log_status_loop_sender.clone();
let carousel = adw::Carousel::builder()
.allow_long_swipes(false)
@ -208,9 +211,18 @@ pub fn build_ui(app: &adw::Application) {
&partition_method_manual_crypttab_entry_array_refcell,
);
installation_progress_page::installation_progress_page(&carousel, &language_changed_action, installation_log_loop_receiver);
installation_progress_page::installation_progress_page(
&carousel,
&language_changed_action,
installation_log_loop_receiver,
);
installation_complete_page::installation_complete_page(&carousel, &window, &language_changed_action, installation_log_status_loop_receiver);
installation_complete_page::installation_complete_page(
&carousel,
&window,
&language_changed_action,
installation_log_status_loop_receiver,
);
window.present()
}

View File

@ -20,6 +20,8 @@ pub struct DriveMountRow {
#[property(get, set)]
partitionscroll: Rc<RefCell<gtk::ScrolledWindow>>,
#[property(get, set)]
transient_for: Rc<RefCell<adw::ApplicationWindow>>,
#[property(get, set)]
sizegroup: RefCell<Option<gtk::SizeGroup>>,
#[property(get, set)]
langaction: RefCell<Option<gio::SimpleAction>>,
@ -51,6 +53,8 @@ impl ObjectImpl for DriveMountRow {
// `SYNC_CREATE` ensures that the label will be immediately set
let obj = self.obj();
let is_selected = Rc::new(RefCell::new(false));
let action_row_content_box = gtk::Box::builder()
.orientation(Horizontal)
.spacing(0)
@ -58,7 +62,7 @@ impl ObjectImpl for DriveMountRow {
.hexpand(true)
.build();
let partition_row_expander_adw_listbox = gtk::ListBox::builder()
let partition_button_row_adw_listbox = gtk::ListBox::builder()
.hexpand(true)
.vexpand(true)
.selection_mode(gtk::SelectionMode::None)
@ -67,7 +71,7 @@ impl ObjectImpl for DriveMountRow {
.margin_start(5)
.margin_end(5)
.build();
partition_row_expander_adw_listbox.add_css_class("boxed-list");
partition_button_row_adw_listbox.add_css_class("boxed-list");
let mountpoint_entry_row_adw_listbox = gtk::ListBox::builder()
.hexpand(true)
@ -93,9 +97,21 @@ impl ObjectImpl for DriveMountRow {
.build();
mountopts_entry_row_adw_listbox.add_css_class("boxed-list");
let partition_row_expander = adw::ExpanderRow::builder()
.subtitle(t!("partition_row_expander_subtitle"))
let partition_button_row = adw::ActionRow::builder()
.title(t!("partition_button_row_title"))
.subtitle(t!("partition_button_row_subtitle_none_selected"))
.hexpand(true)
.vexpand(true)
.build();
partition_button_row.add_prefix(&gtk::Image::from_icon_name("drive-harddisk-symbolic"));
let partition_button = gtk::Button::builder()
.valign(gtk::Align::Center)
.hexpand(true)
.vexpand(true)
.child(&partition_button_row)
.build();
partition_button.add_css_class("flat");
let mountpoint_entry_row = adw::EntryRow::builder()
.title(t!("mountpoint_entry_row_title"))
@ -138,6 +154,24 @@ impl ObjectImpl for DriveMountRow {
.bidirectional()
.build();
obj.connect_partition_notify(clone!(
#[strong]
is_selected,
#[strong]
partition_button_row,
move |obj| {
let partition = obj.property::<String>("partition");
let is_empty = partition.trim().is_empty();
*is_selected.borrow_mut() = !is_empty;
if is_empty {
partition_button_row
.set_subtitle(&t!("partition_button_row_subtitle_none_selected"));
} else {
partition_button_row.set_subtitle(&partition);
}
}
));
partition_row_delete_button.connect_clicked(clone!(
#[weak]
obj,
@ -148,7 +182,7 @@ impl ObjectImpl for DriveMountRow {
//
partition_row_expander_adw_listbox.append(&partition_row_expander);
partition_button_row_adw_listbox.append(&partition_button);
mountpoint_entry_row_adw_listbox.append(&mountpoint_entry_row);
@ -156,7 +190,7 @@ impl ObjectImpl for DriveMountRow {
//
action_row_content_box.append(&partition_row_expander_adw_listbox);
action_row_content_box.append(&partition_button_row_adw_listbox);
action_row_content_box.append(&mountpoint_entry_row_adw_listbox);
@ -168,27 +202,54 @@ impl ObjectImpl for DriveMountRow {
#[weak]
obj,
#[weak]
partition_row_expander_adw_listbox,
partition_button_row_adw_listbox,
#[weak]
mountpoint_entry_row_adw_listbox,
#[weak]
mountopts_entry_row_adw_listbox,
move |_| {
if let Some(t) = obj.sizegroup() {
t.add_widget(&partition_row_expander_adw_listbox);
t.add_widget(&partition_button_row_adw_listbox);
t.add_widget(&mountpoint_entry_row_adw_listbox);
t.add_widget(&mountopts_entry_row_adw_listbox);
}
}
));
let partition_button_row_dialog_extra_child = adw::Bin::new();
let partition_button_row_dialog = adw::AlertDialog::builder()
.extra_child(&partition_button_row_dialog_extra_child)
.width_request(400)
.height_request(400)
.title(t!("devices_selection_button_row_dialog_manual_title"))
.body(t!("devices_selection_button_row_dialog_manual_body"))
.build();
partition_button_row_dialog.add_response(
"devices_selection_button_row_dialog_ok",
"devices_selection_button_row_dialog_ok_label",
);
partition_button.connect_clicked(clone!(
#[strong]
obj,
#[strong]
partition_button_row_dialog,
move |_| {
partition_button_row_dialog.present(Some(
&obj.property::<adw::ApplicationWindow>("transient_for"),
));
}
));
// Bind label to number
// `SYNC_CREATE` ensures that the label will be immediately set
let obj = self.obj();
obj.bind_property("partition", &partition_row_expander, "title")
/*obj.bind_property("partition", &partition_button_row, "subtitle")
.sync_create()
.bidirectional()
.build();
.build();*/
obj.bind_property("mountpoint", &mountpoint_entry_row, "text")
.sync_create()
@ -204,10 +265,11 @@ impl ObjectImpl for DriveMountRow {
#[weak]
obj,
#[weak]
partition_row_expander,
partition_button_row_dialog_extra_child,
move |_| {
partition_row_expander
.add_row(&obj.property::<gtk::ScrolledWindow>("partitionscroll"));
partition_button_row_dialog_extra_child.set_child(Some(
&obj.property::<gtk::ScrolledWindow>("partitionscroll"),
));
}
));
@ -215,25 +277,45 @@ impl ObjectImpl for DriveMountRow {
#[weak]
obj,
#[weak]
partition_row_expander,
partition_button_row,
#[weak]
mountpoint_entry_row,
#[weak]
mountopts_entry_row,
#[weak]
partition_button_row_dialog,
#[strong]
is_selected,
move |_| {
if let Some(t) = obj.langaction() {
t.connect_activate(clone!(
#[weak]
partition_row_expander,
partition_button_row,
#[weak]
mountpoint_entry_row,
#[weak]
mountopts_entry_row,
#[weak]
partition_button_row_dialog,
#[strong]
is_selected,
move |_, _| {
partition_row_expander
.set_subtitle(&t!("partition_row_expander_subtitle"));
if !*is_selected.borrow() {
partition_button_row.set_subtitle(&t!(
"partition_button_row_subtitle_none_selected"
));
}
mountpoint_entry_row.set_title(&t!("mountpoint_entry_row_title"));
mountopts_entry_row.set_title(&t!("mountopts_entry_row_title"));
//
partition_button_row_dialog
.set_title(&t!("devices_selection_button_row_dialog_manual_title"));
partition_button_row_dialog
.set_body(&t!("devices_selection_button_row_dialog_manual_body"));
partition_button_row_dialog.set_response_label(
"devices_selection_button_row_dialog_ok",
&t!("devices_selection_button_row_dialog_ok_label"),
);
}
));
}

View File

@ -15,9 +15,13 @@ impl DriveMountRow {
pub fn new() -> Self {
Object::builder().build()
}
pub fn new_with_scroll(partitions_scroll: &gtk::ScrolledWindow) -> Self {
pub fn new_with_widgets(
partitions_scroll: &gtk::ScrolledWindow,
parent_window: &adw::ApplicationWindow,
) -> Self {
Object::builder()
.property("partitionscroll", partitions_scroll)
.property("transient-for", parent_window)
.build()
}
pub fn get_fstab_entry(&self) -> FstabEntry {

View File

@ -1,7 +1,7 @@
use crate::{config::LOG_FILE_PATH, installer_stack_page};
use adw::prelude::*;
use gtk::{gio, glib};
use glib::clone;
use gtk::{gio, glib};
use std::process::Command;
pub fn installation_complete_page(
@ -52,16 +52,14 @@ pub fn installation_complete_page(
let installation_status_context = glib::MainContext::default();
// The main loop executes the asynchronous block
installation_status_context.spawn_local(
clone!(
installation_status_context.spawn_local(clone!(
#[strong]
main_carousel,
#[strong]
installation_complete_page,
#[strong]
installation_log_status_loop_receiver,
async move
{
async move {
while let Ok(state) = installation_log_status_loop_receiver.recv().await {
main_carousel.scroll_to(&installation_complete_page, true);
match state {
@ -71,8 +69,10 @@ pub fn installation_complete_page(
installation_complete_page.set_next_visible(false);
installation_complete_page.set_back_sensitive(false);
installation_complete_page.set_next_sensitive(false);
installation_complete_page.set_page_title(t!("installation_complete_page_title_success"));
installation_complete_page.set_page_subtitle(t!("installation_complete_page_subtitle_success"));
installation_complete_page
.set_page_title(t!("installation_complete_page_title_success"));
installation_complete_page
.set_page_subtitle(t!("installation_complete_page_subtitle_success"));
}
false => {
installation_complete_page.set_page_icon("dialog-error-symbolic");
@ -80,26 +80,23 @@ pub fn installation_complete_page(
installation_complete_page.set_next_visible(false);
installation_complete_page.set_back_sensitive(false);
installation_complete_page.set_next_sensitive(false);
installation_complete_page.set_page_title(t!("installation_complete_page_title_failed"));
installation_complete_page.set_page_subtitle(t!("installation_complete_page_subtitle_failed"));
installation_complete_page
.set_page_title(t!("installation_complete_page_title_failed"));
installation_complete_page
.set_page_subtitle(t!("installation_complete_page_subtitle_failed"));
}
}
}
}
)
);
));
//
installation_complete_exit_button.connect_clicked(clone!(
#[strong]
window,
move |_|
{
window.close()
}
)
);
move |_| window.close()
));
installation_complete_reboot_button.connect_clicked(move |_| {
Command::new("reboot")
@ -127,9 +124,12 @@ pub fn installation_complete_page(
#[weak]
installation_complete_view_logs_button,
move |_, _| {
installation_complete_exit_button.set_label(&t!("installation_complete_exit_button_label"));
installation_complete_reboot_button.set_label(&t!("installation_complete_reboot_button_label"));
installation_complete_view_logs_button.set_label(&t!("installation_complete_view_logs_button_label"));
installation_complete_exit_button
.set_label(&t!("installation_complete_exit_button_label"));
installation_complete_reboot_button
.set_label(&t!("installation_complete_reboot_button_label"));
installation_complete_view_logs_button
.set_label(&t!("installation_complete_view_logs_button_label"));
}
));
//

View File

@ -1,11 +1,10 @@
use crate::unix_socket_tools;
use adw::prelude::*;
use gtk::{gio, glib};
use glib::{clone, GString};
use gtk::{gio, glib};
use std::thread;
use tokio::runtime::Runtime;
pub fn installation_progress_page(
main_carousel: &adw::Carousel,
language_changed_action: &gio::SimpleAction,
@ -15,7 +14,9 @@ pub fn installation_progress_page(
let socket_status_sender: async_channel::Sender<String> = socket_status_sender.clone();
thread::spawn(move || {
Runtime::new().unwrap().block_on(unix_socket_tools::start_socket_server(
Runtime::new()
.unwrap()
.block_on(unix_socket_tools::start_socket_server(
socket_status_sender,
"/tmp/pikainstall-status.sock",
));
@ -103,53 +104,55 @@ pub fn installation_progress_page(
//
progress_log_button.connect_clicked(
clone!(
progress_log_button.connect_clicked(clone!(
#[weak]
installation_progress_log_stack,
move |_|
move |_| {
if installation_progress_log_stack.visible_child_name()
== Some(GString::from_string_unchecked("slideshow_page".into()))
{
if installation_progress_log_stack.visible_child_name() == Some(GString::from_string_unchecked("slideshow_page".into())) {
installation_progress_log_stack.set_visible_child_name("terminal_log_page");
} else {
installation_progress_log_stack.set_visible_child_name("slideshow_page");
}
}
)
);
));
//
installation_progress_log_terminal_buffer.connect_changed(clone!(
#[weak]
installation_progress_log_scroll,
move |_|
move |_| {
if installation_progress_log_scroll.vadjustment().upper()
- installation_progress_log_scroll.vadjustment().value()
< (installation_progress_log_scroll.size(gtk::Orientation::Vertical) as f64 * 1.48)
{
if installation_progress_log_scroll.vadjustment().upper() - installation_progress_log_scroll.vadjustment().value() < (installation_progress_log_scroll.size(gtk::Orientation::Vertical) as f64 * 1.48 ) {
installation_progress_log_scroll.vadjustment().set_value(installation_progress_log_scroll.vadjustment().upper())
installation_progress_log_scroll
.vadjustment()
.set_value(installation_progress_log_scroll.vadjustment().upper())
}
}
)
);
));
//
let installation_log_loop_context = glib::MainContext::default();
// The main loop executes the asynchronous block
installation_log_loop_context.spawn_local(
clone!(
installation_log_loop_context.spawn_local(clone!(
#[weak]
installation_progress_log_terminal_buffer,
#[strong]
installation_progress_log_terminal_buffer,
async move
{
async move {
while let Ok(state) = installation_log_loop_receiver.recv().await {
installation_progress_log_terminal_buffer.insert(&mut installation_progress_log_terminal_buffer.end_iter(), &("\n".to_string() + &state))
}
}
installation_progress_log_terminal_buffer.insert(
&mut installation_progress_log_terminal_buffer.end_iter(),
&("\n".to_string() + &state),
)
);
}
}
));
//
@ -165,55 +168,68 @@ pub fn installation_progress_page(
match state.trim() {
"PARTING" => {
installation_progress_bar.set_fraction(0.15);
installation_progress_bar.set_text(Some(&t!("installation_progress_bar_text_parting")));
installation_progress_bar
.set_text(Some(&t!("installation_progress_bar_text_parting")));
}
"IMAGE" => {
installation_progress_bar.set_fraction(0.50);
installation_progress_bar.set_text(Some(&t!("installation_progress_bar_text_image")));
installation_progress_bar
.set_text(Some(&t!("installation_progress_bar_text_image")));
}
"FLAG" => {
installation_progress_bar.set_fraction(0.55);
installation_progress_bar.set_text(Some(&t!("installation_progress_bar_text_flag")));
installation_progress_bar
.set_text(Some(&t!("installation_progress_bar_text_flag")));
}
"BIND" => {
installation_progress_bar.set_fraction(0.60);
installation_progress_bar.set_text(Some(&t!("installation_progress_bar_text_bind")));
installation_progress_bar
.set_text(Some(&t!("installation_progress_bar_text_bind")));
}
"ARCH_COPY" => {
installation_progress_bar.set_fraction(0.65);
installation_progress_bar.set_text(Some(&t!("installation_progress_bar_text_arch_copy")));
installation_progress_bar
.set_text(Some(&t!("installation_progress_bar_text_arch_copy")));
}
"ENCRYPTION" => {
installation_progress_bar.set_fraction(0.70);
installation_progress_bar.set_text(Some(&t!("installation_progress_bar_text_encryption")));
installation_progress_bar
.set_text(Some(&t!("installation_progress_bar_text_encryption")));
}
"SWAP" => {
installation_progress_bar.set_fraction(0.75);
installation_progress_bar.set_text(Some(&t!("installation_progress_bar_text_swap")));
installation_progress_bar
.set_text(Some(&t!("installation_progress_bar_text_swap")));
}
"GEN_FSTAB" => {
installation_progress_bar.set_fraction(0.80);
installation_progress_bar.set_text(Some(&t!("installation_progress_bar_text_gen_fstab")));
installation_progress_bar
.set_text(Some(&t!("installation_progress_bar_text_gen_fstab")));
}
"LOCALE" => {
installation_progress_bar.set_fraction(0.85);
installation_progress_bar.set_text(Some(&t!("installation_progress_bar_text_locale")));
installation_progress_bar
.set_text(Some(&t!("installation_progress_bar_text_locale")));
}
"BOOTLOADER" => {
installation_progress_bar.set_fraction(0.90);
installation_progress_bar.set_text(Some(&t!("installation_progress_bar_text_bootloader")));
installation_progress_bar
.set_text(Some(&t!("installation_progress_bar_text_bootloader")));
}
"LIVE_REMOVE" => {
installation_progress_bar.set_fraction(0.95);
installation_progress_bar.set_text(Some(&t!("installation_progress_bar_text_live_remove")));
installation_progress_bar
.set_text(Some(&t!("installation_progress_bar_text_live_remove")));
}
"BASIC_USER" => {
installation_progress_bar.set_fraction(0.98);
installation_progress_bar.set_text(Some(&t!("installation_progress_bar_text_basic_user")));
installation_progress_bar
.set_text(Some(&t!("installation_progress_bar_text_basic_user")));
}
"UNBIND" => {
installation_progress_bar.set_fraction(0.99);
installation_progress_bar.set_text(Some(&t!("installation_progress_bar_text_unbind")));
installation_progress_bar
.set_text(Some(&t!("installation_progress_bar_text_unbind")));
}
_ => {}
}

View File

@ -1,13 +1,21 @@
use crate::{
build_ui::{BlockDevice, CrypttabEntry, FstabEntry, PikaKeymap, PikaLocale},
config::{MINIMUM_BOOT_BYTE_SIZE, MINIMUM_EFI_BYTE_SIZE, LOG_FILE_PATH},
config::{LOG_FILE_PATH, MINIMUM_BOOT_BYTE_SIZE, MINIMUM_EFI_BYTE_SIZE},
installer_stack_page,
};
use adw::prelude::*;
use gtk::{gio, glib};
use glib::{clone, closure_local};
use std::{cell::RefCell, fs, path::Path, rc::Rc, thread, io::{Write, prelude::*, BufReader}, error::Error};
use duct::cmd;
use glib::{clone, closure_local};
use gtk::{gio, glib};
use std::{
cell::RefCell,
error::Error,
fs,
io::{prelude::*, BufReader, Write},
path::Path,
rc::Rc,
thread,
};
mod script_gen;
@ -36,7 +44,6 @@ fn run_install_process(
.send_blocking(line)
.expect("Channel needs to be opened.");
let mut log_file = fs::OpenOptions::new()
.append(true)
.open(log_file_path)
.unwrap();
@ -154,8 +161,7 @@ pub fn installation_summary_page(
partition_method_manual_luks_enabled_refcell,
#[strong]
partition_method_manual_crypttab_entry_array_refcell,
move |_|
{
move |_| {
let cmd = script_gen::create_installation_script(
&language_selection_text_refcell,
&keymap_selection_text_refcell,
@ -169,22 +175,28 @@ pub fn installation_summary_page(
&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,);
&partition_method_manual_crypttab_entry_array_refcell,
);
let installation_log_loop_sender_clone0 = installation_log_loop_sender.clone();
let installation_log_status_loop_sender_clone0 = installation_log_status_loop_sender.clone();
let installation_log_status_loop_sender_clone0 =
installation_log_status_loop_sender.clone();
thread::spawn(move || {
if Path::new(LOG_FILE_PATH).exists() {
fs::remove_file(LOG_FILE_PATH).expect("bad perms on log file");
}
match run_install_process(installation_log_loop_sender_clone0, &cmd, LOG_FILE_PATH) {
Ok(_) => installation_log_status_loop_sender_clone0.send_blocking(true).expect("channel needs to be open"),
Err(_) => installation_log_status_loop_sender_clone0.send_blocking(false).expect("channel needs to be open")
match run_install_process(installation_log_loop_sender_clone0, &cmd, LOG_FILE_PATH)
{
Ok(_) => installation_log_status_loop_sender_clone0
.send_blocking(true)
.expect("channel needs to be open"),
Err(_) => installation_log_status_loop_sender_clone0
.send_blocking(false)
.expect("channel needs to be open"),
}
});
main_carousel.scroll_to(&main_carousel.nth_page(7), true);
}
)
);
));
//

View File

@ -46,23 +46,45 @@ pub fn create_installation_script(
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
(
"LOCALE".to_string(),
language_selection_text_refcell.borrow().name.replace("'", r###"'"'"'"###).as_str(),
language_selection_text_refcell
.borrow()
.name
.replace("'", r###"'"'"'"###)
.as_str(),
),
(
"KEYMAP".to_string(),
keymap_selection_text_refcell.borrow().kbdmap.console.replace("'", r###"'"'"'"###).as_str(),
keymap_selection_text_refcell
.borrow()
.kbdmap
.console
.replace("'", r###"'"'"'"###)
.as_str(),
),
(
"XKB_LAYOUT".to_string(),
keymap_selection_text_refcell.borrow().kbdmap.layout.replace("'", r###"'"'"'"###).as_str(),
keymap_selection_text_refcell
.borrow()
.kbdmap
.layout
.replace("'", r###"'"'"'"###)
.as_str(),
),
(
"XKB_VARIANT".to_string(),
keymap_selection_text_refcell.borrow().kbdmap.variant.replace("'", r###"'"'"'"###).as_str(),
keymap_selection_text_refcell
.borrow()
.kbdmap
.variant
.replace("'", r###"'"'"'"###)
.as_str(),
),
(
"TIMEZONE".to_string(),
timezone_selection_text_refcell.borrow().replace("'", r###"'"'"'"###).as_str(),
timezone_selection_text_refcell
.borrow()
.replace("'", r###"'"'"'"###)
.as_str(),
),
]),
)
@ -76,21 +98,30 @@ pub fn create_installation_script(
//
let automatic_standard_installation_format = strfmt::strfmt(
auto_basic::AUTOMATIC_STANDARD_INSTALLATION_PROG,
&std::collections::HashMap::from([
(
&std::collections::HashMap::from([(
"AUTO_INSTALL_TARGET_DISK".to_string(),
partition_method_automatic_target_refcell.borrow().block_name.replace("'", r###"'"'"'"###).as_str(),
),
]),
partition_method_automatic_target_refcell
.borrow()
.block_name
.replace("'", r###"'"'"'"###)
.as_str(),
)]),
)
.unwrap();
final_script.push_str(&automatic_standard_installation_format);
//
match &*partition_method_automatic_target_fs_refcell.borrow().as_str().to_lowercase() {
match &*partition_method_automatic_target_fs_refcell
.borrow()
.as_str()
.to_lowercase()
{
"btrfs" => {
match partition_method_automatic_seperation_refcell.borrow().as_str() {
match partition_method_automatic_seperation_refcell
.borrow()
.as_str()
{
"subvol" => {
if is_encrypted {
final_script.push_str(&strfmt::strfmt(
@ -168,11 +199,14 @@ pub fn create_installation_script(
.unwrap());
}
}
_ => panic!()
_ => panic!(),
}
}
"ext4" => {
match partition_method_automatic_seperation_refcell.borrow().as_str() {
match partition_method_automatic_seperation_refcell
.borrow()
.as_str()
{
"partition" => {
if is_encrypted {
final_script.push_str(&strfmt::strfmt(
@ -191,17 +225,29 @@ pub fn create_installation_script(
)
.unwrap());
} else {
final_script.push_str(&strfmt::strfmt(
final_script.push_str(
&strfmt::strfmt(
auto_ext4::AUTOMATIC_HOME_PART_EXT4_OPEN_INSTALLATION_PROG,
&std::collections::HashMap::from([
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
(
"CHROOT_PATH".to_string(),
"/media/pikaos/installation",
),
(
"ROOT_PART_SIZE_AS_I64_MIB".to_string(),
(partition_method_automatic_ratio_refcell.borrow().round() as i64 / 1048576).to_string().replace("'", r###"'"'"'"###).as_str(),
)
(partition_method_automatic_ratio_refcell
.borrow()
.round()
as i64
/ 1048576)
.to_string()
.replace("'", r###"'"'"'"###)
.as_str(),
),
]),
)
.unwrap());
.unwrap(),
);
}
}
"none" => {
@ -218,78 +264,122 @@ pub fn create_installation_script(
)
.unwrap());
} else {
final_script.push_str(&strfmt::strfmt(
final_script.push_str(
&strfmt::strfmt(
auto_ext4::AUTOMATIC_HOME_NONE_EXT4_OPEN_INSTALLATION_PROG,
&std::collections::HashMap::from([
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
]),
&std::collections::HashMap::from([(
"CHROOT_PATH".to_string(),
"/media/pikaos/installation",
)]),
)
.unwrap());
.unwrap(),
);
}
}
_ => panic!()
_ => panic!(),
}
}
"xfs" => {
match partition_method_automatic_seperation_refcell.borrow().as_str() {
match partition_method_automatic_seperation_refcell
.borrow()
.as_str()
{
"partition" => {
if is_encrypted {
final_script.push_str(&strfmt::strfmt(
final_script.push_str(
&strfmt::strfmt(
auto_xfs::AUTOMATIC_HOME_PART_XFS_LOCKED_INSTALLATION_PROG,
&std::collections::HashMap::from([
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
(
"CHROOT_PATH".to_string(),
"/media/pikaos/installation",
),
(
"AUTO_LUKS_PASSWORD".to_string(),
partition_method_automatic_luks_refcell.borrow().replace("'", r###"'"'"'"###).as_str(),
partition_method_automatic_luks_refcell
.borrow()
.replace("'", r###"'"'"'"###)
.as_str(),
),
(
"ROOT_PART_SIZE_AS_I64_MIB".to_string(),
(partition_method_automatic_ratio_refcell.borrow().round() as i64 / 1048576).to_string().replace("'", r###"'"'"'"###).as_str(),
)
(partition_method_automatic_ratio_refcell
.borrow()
.round()
as i64
/ 1048576)
.to_string()
.replace("'", r###"'"'"'"###)
.as_str(),
),
]),
)
.unwrap());
.unwrap(),
);
} else {
final_script.push_str(&strfmt::strfmt(
final_script.push_str(
&strfmt::strfmt(
auto_xfs::AUTOMATIC_HOME_PART_XFS_OPEN_INSTALLATION_PROG,
&std::collections::HashMap::from([
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
(
"CHROOT_PATH".to_string(),
"/media/pikaos/installation",
),
(
"ROOT_PART_SIZE_AS_I64_MIB".to_string(),
(partition_method_automatic_ratio_refcell.borrow().round() as i64 / 1048576).to_string().replace("'", r###"'"'"'"###).as_str(),
)
(partition_method_automatic_ratio_refcell
.borrow()
.round()
as i64
/ 1048576)
.to_string()
.replace("'", r###"'"'"'"###)
.as_str(),
),
]),
)
.unwrap());
.unwrap(),
);
}
}
"none" => {
if is_encrypted {
final_script.push_str(&strfmt::strfmt(
final_script.push_str(
&strfmt::strfmt(
auto_xfs::AUTOMATIC_HOME_NONE_XFS_LOCKED_INSTALLATION_PROG,
&std::collections::HashMap::from([
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
(
"CHROOT_PATH".to_string(),
"/media/pikaos/installation",
),
(
"AUTO_LUKS_PASSWORD".to_string(),
partition_method_automatic_luks_refcell.borrow().replace("'", r###"'"'"'"###).as_str(),
)
partition_method_automatic_luks_refcell
.borrow()
.replace("'", r###"'"'"'"###)
.as_str(),
),
]),
)
.unwrap());
.unwrap(),
);
} else {
final_script.push_str(&strfmt::strfmt(
final_script.push_str(
&strfmt::strfmt(
auto_xfs::AUTOMATIC_HOME_NONE_XFS_OPEN_INSTALLATION_PROG,
&std::collections::HashMap::from([
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
]),
&std::collections::HashMap::from([(
"CHROOT_PATH".to_string(),
"/media/pikaos/installation",
)]),
)
.unwrap());
.unwrap(),
);
}
}
_ => panic!()
_ => panic!(),
}
}
_ => panic!()
_ => panic!(),
}
//
if is_encrypted {
@ -308,54 +398,64 @@ r###"
mkdir -p /tmp/PIKA_CRYPT/
touch /tmp/PIKA_CRYPT/crypttab
"###
"###,
);
for crypt_entry in partition_method_manual_crypttab_entry_array_refcell.borrow().iter() {
for crypt_entry in partition_method_manual_crypttab_entry_array_refcell
.borrow()
.iter()
{
match &crypt_entry.password {
Some(p) => {
final_script.push_str(&strfmt::strfmt(
final_script.push_str(
&strfmt::strfmt(
manual_basic::MANUAL_CRYPT_ENTRY_WITH_KEYFILE,
&std::collections::HashMap::from([
(
"MAP".to_string(),
crypt_entry.map.replace("'", r###"'"'"'"###).as_str()
crypt_entry.map.replace("'", r###"'"'"'"###).as_str(),
),
(
"UUID".to_string(),
crypt_entry.uuid.replace("'", r###"'"'"'"###).as_str()
crypt_entry.uuid.replace("'", r###"'"'"'"###).as_str(),
),
(
"LUKS_PASSWD".to_string(),
p.replace("'", r###"'"'"'"###).as_str()
)
p.replace("'", r###"'"'"'"###).as_str(),
),
]),
)
.unwrap());
.unwrap(),
);
}
None => {
final_script.push_str(&strfmt::strfmt(
final_script.push_str(
&strfmt::strfmt(
manual_basic::MANUAL_CRYPT_ENTRY,
&std::collections::HashMap::from([
(
"MAP".to_string(),
crypt_entry.map.replace("'", r###"'"'"'"###).as_str()
crypt_entry.map.replace("'", r###"'"'"'"###).as_str(),
),
(
"UUID".to_string(),
crypt_entry.uuid.replace("'", r###"'"'"'"###).as_str()
)
crypt_entry.uuid.replace("'", r###"'"'"'"###).as_str(),
),
]),
)
.unwrap());
.unwrap(),
);
}
}
}
};
}
let mut did_make_swap_list = false;
for fstab_entry in partition_method_manual_fstab_entry_array_refcell.borrow().iter() {
for fstab_entry in partition_method_manual_fstab_entry_array_refcell
.borrow()
.iter()
{
if fstab_entry.mountpoint == "[SWAP]" {
if !did_make_swap_list {
final_script.push_str(
@ -363,54 +463,70 @@ r###"
touch /tmp/pika-installer-gtk4-swaplist
"###
"###,
);
did_make_swap_list = true
}
final_script.push_str(&strfmt::strfmt(
final_script.push_str(
&strfmt::strfmt(
manual_basic::MANUAL_SWAP_MOUNT_PROG,
&std::collections::HashMap::from([
(
&std::collections::HashMap::from([(
"PART".to_string(),
fstab_entry.partition.part_name.replace("'", r###"'"'"'"###).as_str()
),
]),
fstab_entry
.partition
.part_name
.replace("'", r###"'"'"'"###)
.as_str(),
)]),
)
.unwrap());
.unwrap(),
);
} else if !fstab_entry.mountopts.is_empty() {
final_script.push_str(&strfmt::strfmt(
final_script.push_str(
&strfmt::strfmt(
manual_basic::MANUAL_PARTITION_MOUNT_WITH_OPTS_PROG,
&std::collections::HashMap::from([
(
"PART".to_string(),
fstab_entry.partition.part_name.replace("'", r###"'"'"'"###).as_str()
fstab_entry
.partition
.part_name
.replace("'", r###"'"'"'"###)
.as_str(),
),
(
"MOUNTPOINT".to_string(),
fstab_entry.mountpoint.replace("'", r###"'"'"'"###).as_str()
fstab_entry.mountpoint.replace("'", r###"'"'"'"###).as_str(),
),
(
"OPTS".to_string(),
fstab_entry.mountopts.replace("'", r###"'"'"'"###).as_str()
fstab_entry.mountopts.replace("'", r###"'"'"'"###).as_str(),
),
]),
)
.unwrap());
.unwrap(),
);
} else {
final_script.push_str(&strfmt::strfmt(
final_script.push_str(
&strfmt::strfmt(
manual_basic::MANUAL_PARTITION_MOUNT_PROG,
&std::collections::HashMap::from([
(
"PART".to_string(),
fstab_entry.partition.part_name.replace("'", r###"'"'"'"###).as_str()
fstab_entry
.partition
.part_name
.replace("'", r###"'"'"'"###)
.as_str(),
),
(
"MOUNTPOINT".to_string(),
fstab_entry.mountpoint.replace("'", r###"'"'"'"###).as_str()
fstab_entry.mountpoint.replace("'", r###"'"'"'"###).as_str(),
),
]),
)
.unwrap());
.unwrap(),
);
}
}
@ -420,7 +536,7 @@ touch /tmp/pika-installer-gtk4-swaplist
final_script.push_str(manual_basic::MANUAL_OPEN_PART_PIKAINSTALL_PROG);
}
}
_ => panic!()
_ => panic!(),
}
final_script

View File

@ -1,8 +1,11 @@
use crate::{build_ui::{PikaKeymap, KBDMap}, installer_stack_page};
use crate::{
build_ui::{KBDMap, PikaKeymap},
installer_stack_page,
};
use adw::prelude::*;
use glib::{clone, closure_local};
use gnome_desktop::XkbInfoExt;
use gtk::{gio, glib};
use glib::{clone, closure_local};
use std::{cell::RefCell, process::Command, rc::Rc};
pub fn keyboard_page(
@ -70,374 +73,314 @@ pub fn keyboard_page(
KBDMap {
console: "sg".to_string(),
layout: "ch".to_string(),
variant: "de_nodeadkeys".to_string()
variant: "de_nodeadkeys".to_string(),
},
KBDMap {
console: "nl".to_string(),
layout: "nl".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "mk-utf".to_string(),
layout: "mk".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "trq".to_string(),
layout: "tr".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "trf".to_string(),
layout: "tr".to_string(),
variant: "f".to_string()
variant: "f".to_string(),
},
KBDMap {
console: "uk".to_string(),
layout: "gb".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "is-latin1".to_string(),
layout: "is".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "de".to_string(),
layout: "de".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "la-latin1".to_string(),
layout: "latam".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "us".to_string(),
layout: "us".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "ko".to_string(),
layout: "kr".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "ro_std".to_string(),
layout: "ro".to_string(),
variant: "std".to_string()
variant: "std".to_string(),
},
KBDMap {
console: "slovene".to_string(),
layout: "si".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "hu".to_string(),
layout: "hu".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "jp106".to_string(),
layout: "jp".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "croat".to_string(),
layout: "hr".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "hu101".to_string(),
layout: "hu".to_string(),
variant: "qwerty".to_string()
variant: "qwerty".to_string(),
},
KBDMap {
console: "sr-latin".to_string(),
layout: "rs".to_string(),
variant: "latin".to_string()
variant: "latin".to_string(),
},
KBDMap {
console: "fi".to_string(),
layout: "fi".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "fr_CH".to_string(),
layout: "ch".to_string(),
variant: "fr".to_string()
variant: "fr".to_string(),
},
KBDMap {
console: "dk-latin1".to_string(),
layout: "dk".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "fr".to_string(),
layout: "fr".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "ua-utf".to_string(),
layout: "ua".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "fr-latin9".to_string(),
layout: "fr".to_string(),
variant: "latin9".to_string()
variant: "latin9".to_string(),
},
KBDMap {
console: "sg-latin1".to_string(),
layout: "ch".to_string(),
variant: "de_nodeadkeys".to_string()
variant: "de_nodeadkeys".to_string(),
},
KBDMap {
console: "be-latin1".to_string(),
layout: "be".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "dk".to_string(),
layout: "dk".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "bg_pho-utf8".to_string(),
layout: "bg".to_string(),
variant: "phonetic".to_string()
variant: "phonetic".to_string(),
},
KBDMap {
console: "it-ibm".to_string(),
layout: "it".to_string(),
variant: "ibm".to_string()
variant: "ibm".to_string(),
},
KBDMap {
console: "cz-us-qwertz".to_string(),
layout: "cz".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "cz-qwerty".to_string(),
layout: "cz".to_string(),
variant: "qwerty".to_string()
variant: "qwerty".to_string(),
},
KBDMap {
console: "br".to_string(),
layout: "br".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "ro".to_string(),
layout: "ro".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "us-acentos".to_string(),
layout: "us".to_string(),
variant: "intl".to_string()
variant: "intl".to_string(),
},
KBDMap {
console: "pt-latin1".to_string(),
layout: "pt".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "tj_alt-UTF8".to_string(),
layout: "tj".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "de-latin1-nodeadkeys".to_string(),
layout: "de".to_string(),
variant: "nodeadkeys".to_string()
variant: "nodeadkeys".to_string(),
},
KBDMap {
console: "no".to_string(),
layout: "no".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "bg_bds-utf8".to_string(),
layout: "bg".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "dvorak".to_string(),
layout: "us".to_string(),
variant: "dvorak".to_string()
variant: "dvorak".to_string(),
},
KBDMap {
console: "ru".to_string(),
layout: "ru".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "cz-lat2".to_string(),
layout: "cz".to_string(),
variant: "qwerty".to_string()
variant: "qwerty".to_string(),
},
KBDMap {
console: "pl".to_string(),
layout: "pl".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "es".to_string(),
layout: "es".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "ie".to_string(),
layout: "ie".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "et".to_string(),
layout: "ee".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "sk-qwerty".to_string(),
layout: "sk".to_string(),
variant: "qwerty".to_string()
variant: "qwerty".to_string(),
},
KBDMap {
console: "sk-qwertz".to_string(),
layout: "sk".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "fr-latin9".to_string(),
layout: "fr".to_string(),
variant: "latin9".to_string()
variant: "latin9".to_string(),
},
KBDMap {
console: "fr_CH-latin1".to_string(),
layout: "ch".to_string(),
variant: "fr".to_string()
variant: "fr".to_string(),
},
KBDMap {
console: "cf".to_string(),
layout: "ca".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "sv-latin1".to_string(),
layout: "se".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "sr-cy".to_string(),
layout: "rs".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "gr".to_string(),
layout: "gr".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "by".to_string(),
layout: "by".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "il".to_string(),
layout: "il".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "kazakh".to_string(),
layout: "kz".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "lt".to_string(),
layout: "lt".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "khmer".to_string(),
layout: "kh".to_string(),
variant: "".to_string()
variant: "".to_string(),
},
KBDMap {
console: "dvorak-es".to_string(),
layout: "es".to_string(),
variant: "dvorak".to_string()
variant: "dvorak".to_string(),
},
KBDMap {
console: "lv".to_string(),
layout: "lv".to_string(),
variant: "apostrophe".to_string()
variant: "apostrophe".to_string(),
},
KBDMap {
console: "lv-tilde".to_string(),
layout: "lv".to_string(),
variant: "tilde".to_string()
}];
variant: "tilde".to_string(),
},
];
let xkbinfo = gnome_desktop::XkbInfo::new();
@ -447,12 +390,22 @@ pub fn keyboard_page(
if map.variant.is_empty() {
sorted_keymap_vec.push(PikaKeymap {
kbdmap: kbd_map,
pretty_name: xkbinfo.layout_info(&map.layout).unwrap().0.unwrap().to_string(),
pretty_name: xkbinfo
.layout_info(&map.layout)
.unwrap()
.0
.unwrap()
.to_string(),
})
} else {
sorted_keymap_vec.push(PikaKeymap {
kbdmap: kbd_map,
pretty_name: xkbinfo.layout_info(format!("{}+{}", map.layout, map.variant).as_str()).unwrap().0.unwrap().to_string(),
pretty_name: xkbinfo
.layout_info(format!("{}+{}", map.layout, map.variant).as_str())
.unwrap()
.0
.unwrap()
.to_string(),
})
}
}
@ -521,7 +474,9 @@ pub fn keyboard_page(
}
}
));
if current_keymap == keymap_clone0.kbdmap.layout && current_keymap_variant == keymap_variant_clone0 {
if current_keymap == keymap_clone0.kbdmap.layout
&& current_keymap_variant == keymap_variant_clone0
{
keymap_checkbutton.set_active(true);
}
}

View File

@ -1,7 +1,7 @@
use crate::{build_ui::PikaLocale, installer_stack_page};
use adw::prelude::*;
use gtk::{gio, glib};
use glib::{clone, closure_local};
use gtk::{gio, glib};
use std::{cell::RefCell, env, process::Command, rc::Rc};
pub fn language_page(

View File

@ -20,9 +20,9 @@ mod automatic_partitioning_page;
mod manual_partitioning_page;
mod partitioning_page;
//
mod installation_summary_page;
mod installation_progress_page;
mod installation_complete_page;
mod installation_progress_page;
mod installation_summary_page;
#[macro_use]
extern crate rust_i18n;

View File

@ -4,8 +4,8 @@ use crate::{
drive_mount_row::DriveMountRow,
};
use adw::prelude::*;
use gtk::{glib, gio};
use glib::{clone, closure_local};
use gtk::{gio, glib};
use std::{cell::RefCell, rc::Rc};
#[derive(Clone, Debug)]
@ -19,6 +19,7 @@ struct PartitionRow {
pub fn create_efi_row(
listbox: &gtk::ListBox,
window: adw::ApplicationWindow,
drive_rows_size_group: &gtk::SizeGroup,
partition_array: &Vec<Partition>,
partition_changed_action: &gio::SimpleAction,
@ -29,15 +30,20 @@ pub fn create_efi_row(
let partition_scroll_child = gtk::ListBox::builder()
.selection_mode(gtk::SelectionMode::None)
.build();
partition_scroll_child.add_css_class("boxed-list");
partition_scroll_child.add_css_class("no-round-borders");
let partitions_scroll = gtk::ScrolledWindow::builder()
.hexpand(true)
.vexpand(true)
.overflow(gtk::Overflow::Hidden)
.has_frame(true)
.child(&partition_scroll_child)
.build();
partitions_scroll.add_css_class("round-all-scroll-no-padding");
// Create row
let row = DriveMountRow::new_with_scroll(&partitions_scroll);
let row = DriveMountRow::new_with_widgets(&partitions_scroll, &window);
row.set_deletable(false);
@ -92,7 +98,6 @@ pub fn create_efi_row(
{
PartitionRow {
widget: {
adw::ActionRow::builder()
.activatable_widget(&partition_button)
.title(part_name)
@ -117,7 +122,6 @@ pub fn create_efi_row(
{
PartitionRow {
widget: {
adw::ActionRow::builder()
.activatable_widget(&partition_button)
.title(part_name)
@ -169,7 +173,6 @@ pub fn create_efi_row(
} else {
PartitionRow {
widget: {
adw::ActionRow::builder()
.activatable_widget(&partition_button)
.title(part_name)
@ -244,6 +247,7 @@ pub fn create_efi_row(
pub fn create_boot_row(
listbox: &gtk::ListBox,
window: adw::ApplicationWindow,
drive_rows_size_group: &gtk::SizeGroup,
partition_array: &Vec<Partition>,
partition_changed_action: &gio::SimpleAction,
@ -254,15 +258,20 @@ pub fn create_boot_row(
let partition_scroll_child = gtk::ListBox::builder()
.selection_mode(gtk::SelectionMode::None)
.build();
partition_scroll_child.add_css_class("boxed-list");
partition_scroll_child.add_css_class("no-round-borders");
let partitions_scroll = gtk::ScrolledWindow::builder()
.hexpand(true)
.vexpand(true)
.overflow(gtk::Overflow::Hidden)
.has_frame(true)
.child(&partition_scroll_child)
.build();
partitions_scroll.add_css_class("round-all-scroll-no-padding");
// Create row
let row = DriveMountRow::new_with_scroll(&partitions_scroll);
let row = DriveMountRow::new_with_widgets(&partitions_scroll, &window);
row.set_deletable(false);
@ -317,7 +326,6 @@ pub fn create_boot_row(
{
PartitionRow {
widget: {
adw::ActionRow::builder()
.activatable_widget(&partition_button)
.title(part_name)
@ -342,7 +350,6 @@ pub fn create_boot_row(
{
PartitionRow {
widget: {
adw::ActionRow::builder()
.activatable_widget(&partition_button)
.title(part_name)
@ -394,7 +401,6 @@ pub fn create_boot_row(
} else {
PartitionRow {
widget: {
adw::ActionRow::builder()
.activatable_widget(&partition_button)
.title(part_name)
@ -469,6 +475,7 @@ pub fn create_boot_row(
pub fn create_root_row(
listbox: &gtk::ListBox,
window: adw::ApplicationWindow,
drive_rows_size_group: &gtk::SizeGroup,
partition_array: &Vec<Partition>,
partition_changed_action: &gio::SimpleAction,
@ -479,15 +486,20 @@ pub fn create_root_row(
let partition_scroll_child = gtk::ListBox::builder()
.selection_mode(gtk::SelectionMode::None)
.build();
partition_scroll_child.add_css_class("boxed-list");
partition_scroll_child.add_css_class("no-round-borders");
let partitions_scroll = gtk::ScrolledWindow::builder()
.hexpand(true)
.vexpand(true)
.overflow(gtk::Overflow::Hidden)
.has_frame(true)
.child(&partition_scroll_child)
.build();
partitions_scroll.add_css_class("round-all-scroll-no-padding");
// Create row
let row = DriveMountRow::new_with_scroll(&partitions_scroll);
let row = DriveMountRow::new_with_widgets(&partitions_scroll, &window);
row.set_deletable(false);
@ -542,7 +554,6 @@ pub fn create_root_row(
{
PartitionRow {
widget: {
adw::ActionRow::builder()
.activatable_widget(&partition_button)
.title(part_name)
@ -567,7 +578,6 @@ pub fn create_root_row(
{
PartitionRow {
widget: {
adw::ActionRow::builder()
.activatable_widget(&partition_button)
.title(part_name)
@ -624,7 +634,6 @@ pub fn create_root_row(
} else {
PartitionRow {
widget: {
adw::ActionRow::builder()
.activatable_widget(&partition_button)
.title(part_name)
@ -699,6 +708,7 @@ pub fn create_root_row(
pub fn create_mount_row(
listbox: &gtk::ListBox,
window: adw::ApplicationWindow,
drive_rows_size_group: &gtk::SizeGroup,
partition_array: &Vec<Partition>,
partition_changed_action: &gio::SimpleAction,
@ -710,15 +720,20 @@ pub fn create_mount_row(
let partition_scroll_child = gtk::ListBox::builder()
.selection_mode(gtk::SelectionMode::None)
.build();
partition_scroll_child.add_css_class("boxed-list");
partition_scroll_child.add_css_class("no-round-borders");
let partitions_scroll = gtk::ScrolledWindow::builder()
.hexpand(true)
.vexpand(true)
.overflow(gtk::Overflow::Hidden)
.has_frame(true)
.child(&partition_scroll_child)
.build();
partitions_scroll.add_css_class("round-all-scroll-no-padding");
// Create row
let row = DriveMountRow::new_with_scroll(&partitions_scroll);
let row = DriveMountRow::new_with_widgets(&partitions_scroll, &window);
row.set_deletable(true);
@ -773,7 +788,6 @@ pub fn create_mount_row(
{
PartitionRow {
widget: {
adw::ActionRow::builder()
.activatable_widget(&partition_button)
.title(part_name)
@ -798,7 +812,6 @@ pub fn create_mount_row(
{
PartitionRow {
widget: {
adw::ActionRow::builder()
.activatable_widget(&partition_button)
.title(part_name)
@ -818,7 +831,6 @@ pub fn create_mount_row(
} else {
PartitionRow {
widget: {
adw::ActionRow::builder()
.activatable_widget(&partition_button)
.title(part_name)

View File

@ -1,13 +1,18 @@
use crate::{
build_ui::{CrypttabEntry, FstabEntry, Partition, SubvolDeclaration},
installer_stack_page,
drive_mount_row::DriveMountRow,
installer_stack_page,
partitioning_page::{get_luks_uuid, get_partitions, test_luks_passwd},
};
use gtk::{glib, gio, Orientation};
use adw::prelude::*;
use glib::{clone, closure_local};
use std::{cell::RefCell, collections::HashSet, rc::Rc, sync::{Arc, atomic::AtomicBool}};
use gtk::{gio, glib, Orientation};
use std::{
cell::RefCell,
collections::HashSet,
rc::Rc,
sync::{atomic::AtomicBool, Arc},
};
mod func;
@ -68,6 +73,7 @@ pub fn manual_partitioning_page(
create_hardcoded_rows(
&drive_mounts_adw_listbox,
window.clone(),
&drive_rows_size_group,
&partition_array_refcell,
&partition_changed_action,
@ -189,6 +195,8 @@ pub fn manual_partitioning_page(
partition_method_manual_valid_label,
#[strong]
manual_partitioning_page,
#[strong]
window,
move |_| {
while let Some(row) = drive_mounts_adw_listbox.last_child() {
drive_mounts_adw_listbox.remove(&row);
@ -209,6 +217,7 @@ pub fn manual_partitioning_page(
manual_partitioning_page.set_next_sensitive(false);
create_hardcoded_rows(
&drive_mounts_adw_listbox,
window.clone(),
&drive_rows_size_group,
&partition_array_refcell,
&partition_changed_action,
@ -264,11 +273,15 @@ pub fn manual_partitioning_page(
for fs_entry in generate_filesystem_table_array(&drive_mounts_adw_listbox) {
let fs_entry_clone0 = fs_entry.clone();
if subvol_partition_array_refcell.borrow().is_empty() && !seen_partitions.insert(fs_entry.clone().partition.part_name) {
if subvol_partition_array_refcell.borrow().is_empty()
&& !seen_partitions.insert(fs_entry.clone().partition.part_name)
{
(errored.store(true, std::sync::atomic::Ordering::Relaxed));
}
if fs_entry.mountpoint == "[SWAP]" {
if fs_entry.partition.part_fs == "linux-swap" || fs_entry.partition.part_fs == "swap" {
if fs_entry.partition.part_fs == "linux-swap"
|| fs_entry.partition.part_fs == "swap"
{
} else {
(errored.store(true, std::sync::atomic::Ordering::Relaxed));
}
@ -339,7 +352,8 @@ pub fn manual_partitioning_page(
));
}
(*partition_method_manual_fstab_entry_array_refcell.borrow_mut()).sort_by_key(|p| p.mountpoint.clone())
(*partition_method_manual_fstab_entry_array_refcell.borrow_mut())
.sort_by_key(|p| p.mountpoint.clone())
}
));
@ -444,6 +458,7 @@ pub fn manual_partitioning_page(
fn create_hardcoded_rows(
drive_mounts_adw_listbox: &gtk::ListBox,
window: adw::ApplicationWindow,
drive_rows_size_group: &gtk::SizeGroup,
partition_array_refcell: &Rc<RefCell<Vec<Partition>>>,
partition_changed_action: &gio::SimpleAction,
@ -476,6 +491,7 @@ fn create_hardcoded_rows(
func::create_efi_row(
drive_mounts_adw_listbox,
window.clone(),
drive_rows_size_group,
&partition_array_refcell.borrow(),
partition_changed_action,
@ -485,6 +501,7 @@ fn create_hardcoded_rows(
);
func::create_boot_row(
drive_mounts_adw_listbox,
window.clone(),
drive_rows_size_group,
&partition_array_refcell.borrow(),
partition_changed_action,
@ -494,6 +511,7 @@ fn create_hardcoded_rows(
);
func::create_root_row(
drive_mounts_adw_listbox,
window.clone(),
drive_rows_size_group,
&partition_array_refcell.borrow(),
partition_changed_action,
@ -524,6 +542,7 @@ fn create_hardcoded_rows(
move |_| {
func::create_mount_row(
&drive_mounts_adw_listbox,
window.clone(),
&drive_rows_size_group,
&partition_array_refcell.borrow(),
&partition_changed_action,

View File

@ -3,9 +3,9 @@ use crate::{
build_ui::{BlockDevice, CrypttabEntry, FstabEntry, Partition},
installer_stack_page, manual_partitioning_page,
};
use gtk::{gio, glib, prelude::*};
use glib::{clone, closure_local};
use std::{cell::RefCell, rc::Rc, io::BufRead};
use gtk::{gio, glib, prelude::*};
use std::{cell::RefCell, io::BufRead, rc::Rc};
pub fn partitioning_page(
main_carousel: &adw::Carousel,

View File

@ -1,7 +1,7 @@
use crate::installer_stack_page;
use adw::prelude::*;
use gtk::{gio, glib};
use glib::{clone, closure_local};
use gtk::{gio, glib};
use std::{cell::RefCell, io::BufRead, process::Command, rc::Rc};
pub fn timezone_page(

View File

@ -1,13 +1,10 @@
use std::fs;
use std::path::Path;
use tokio::io::{AsyncReadExt};
use tokio::io::AsyncReadExt;
use tokio::net::{UnixListener, UnixStream};
use tokio::task;
pub async fn handle_client(
mut stream: UnixStream,
buffer_sender: async_channel::Sender<String>,
) {
pub async fn handle_client(mut stream: UnixStream, buffer_sender: async_channel::Sender<String>) {
// Buffer to store incoming data
let mut buffer = [0; 1024];
@ -29,10 +26,7 @@ pub async fn handle_client(
}
}
pub async fn start_socket_server(
buffer_sender: async_channel::Sender<String>,
socket_path: &str,
) {
pub async fn start_socket_server(buffer_sender: async_channel::Sender<String>, socket_path: &str) {
// Remove the socket file if it already exists
if Path::new(socket_path).exists() {
fs::remove_file(socket_path).expect("Could not remove existing socket file");