Keyboard tester + more confirm detail + no close + percent based auto root
This commit is contained in:
parent
cba0e00264
commit
ff6ed36a05
@ -7,6 +7,8 @@ LOCALE="$(cat "/tmp/pika-installer-gtk4-lang.txt")"
|
||||
KEYBOARD="$(cat "/tmp/pika-installer-gtk4-keyboard.txt")"
|
||||
TIMEZONE="$(cat "/tmp/pika-installer-gtk4-timezone.txt")"
|
||||
|
||||
p3_size=$(echo "scale=2 ; $(cat /tmp/pika-installer-p3-size.txt) / 1024 / 1024" | bc | cut -f1 -d".")
|
||||
|
||||
touch "/tmp/pika-installer-gtk4-status-parting.txt"
|
||||
|
||||
if [[ ! -f "/tmp/pika-installer-gtk4-target-automatic-luks.txt" ]]
|
||||
@ -16,8 +18,8 @@ then
|
||||
parted -s -a optimal /dev/${DISK} mklabel gpt \
|
||||
mkpart "linux-efi" 1MiB 513Mib \
|
||||
mkpart "linux-boot" 513Mib 1537Mib \
|
||||
mkpart "linux-root" 1537Mib 42497Mib \
|
||||
mkpart "linux-home" 42497Mib 100% \
|
||||
mkpart "linux-root" 1537Mib "$(p3_size)"Mib \
|
||||
mkpart "linux-home" "$(p3_size)"Mib 100% \
|
||||
print
|
||||
# add p to partition if it's nvme
|
||||
if echo ${DISK} | grep -i "nvme"
|
||||
@ -66,8 +68,8 @@ else
|
||||
parted -s -a optimal /dev/${DISK} mklabel gpt \
|
||||
mkpart "linux-efi" 1MiB 513Mib \
|
||||
mkpart "linux-boot" 513Mib 1537Mib \
|
||||
mkpart "linux-root" 1537Mib 42497Mib \
|
||||
mkpart "linux-home" 42497Mib 100% \
|
||||
mkpart "linux-root" 1537Mib "$(p3_size)"Mib \
|
||||
mkpart "linux-home" "$(p3_size)"Mib 100% \
|
||||
print
|
||||
# add p to partition if it's nvme
|
||||
if echo ${DISK} | grep -i "nvme"
|
||||
|
2
debian/changelog
vendored
2
debian/changelog
vendored
@ -1,4 +1,4 @@
|
||||
pika-installer-gtk4 (1.0.0-100pika4) pikauwu; urgency=low
|
||||
pika-installer-gtk4 (1.0.0-100pika5) pikauwu; urgency=low
|
||||
|
||||
* First release
|
||||
|
||||
|
@ -85,6 +85,8 @@ pub fn build_ui(app: &adw::Application) {
|
||||
.height_request(500)
|
||||
// Hide window instead of destroy
|
||||
.hide_on_close(true)
|
||||
//
|
||||
.deletable(false)
|
||||
// Startup
|
||||
.startup_id("pika-installer-gtk4")
|
||||
// build the window
|
||||
|
@ -11,6 +11,10 @@ use gtk::subclass::layout_child;
|
||||
use vte::prelude::*;
|
||||
use vte::*;
|
||||
|
||||
|
||||
use std::process::Command;
|
||||
use pretty_bytes::converter::convert;
|
||||
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
|
||||
@ -125,6 +129,73 @@ pub fn install_page(done_main_box: >k::Box, install_main_box: >k::Box ,conte
|
||||
}
|
||||
install_confirm_detail_target.add_css_class("property");
|
||||
|
||||
if Path::new("/tmp/pika-installer-gtk4-target-auto.txt").exists() {
|
||||
let target_block_device = &fs::read_to_string("/tmp/pika-installer-gtk4-target-auto.txt").expect("Unable to read file");
|
||||
let target_size_cli = Command::new("sudo")
|
||||
.arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
|
||||
.arg("get_block_size")
|
||||
.arg(target_block_device)
|
||||
.output()
|
||||
.expect("failed to execute process");
|
||||
let target_size = String::from_utf8(target_size_cli.stdout).expect("Failed to create float").trim().parse::<f64>().unwrap();
|
||||
let mut target_p3_size = 0.0;
|
||||
if (target_size * 40.0) / 100.0 >= 150000000000.0 {
|
||||
target_p3_size = 150000000000.0 ;
|
||||
} else {
|
||||
target_p3_size = (target_size * 40.0) / 100.0 ;
|
||||
}
|
||||
let target_p4_size = target_size - (target_p3_size + 1536.0);
|
||||
if Path::new("/tmp/pika-installer-p3-size.txt").exists() {
|
||||
fs::remove_file("/tmp/pika-installer-p3-size.txt").expect("Bad permissions on /tmp/pika-installer-p3-size.txt");
|
||||
}
|
||||
let target_p3_sector = target_p3_size + 1537.0;
|
||||
fs::write("/tmp/pika-installer-p3-size.txt", target_p3_sector.to_string()).expect("Unable to write file");
|
||||
let mut p1_row_text = String::new();
|
||||
let mut p2_row_text = String::new();
|
||||
let mut p3_row_text = String::new();
|
||||
let mut p4_row_text = String::new();
|
||||
if target_block_device.contains("nvme") {
|
||||
p1_row_text = "512 MB ".to_owned() + target_block_device + "p1" + " as fat32" + " on /boot/efi";
|
||||
p2_row_text = "1 GB ".to_owned() + target_block_device + "p2" + " as ext4" + " on /boot";
|
||||
p3_row_text = pretty_bytes::converter::convert(target_p3_size) + " " + target_block_device + "p3" + " as btrfs" + " on /";
|
||||
p4_row_text = pretty_bytes::converter::convert(target_p4_size) + " " + target_block_device + "p4" + " as btrfs" + " on /home";
|
||||
} else {
|
||||
p1_row_text = "512 MB ".to_owned() + target_block_device + "1" + " as fat32" + " on /boot/efi";
|
||||
p2_row_text = "1 GB ".to_owned() + target_block_device + "2" + " as ext4" + " on /boot";
|
||||
p3_row_text = pretty_bytes::converter::convert(target_p3_size) + " " + target_block_device + "3" + " as btrfs" + " on /";
|
||||
p4_row_text = pretty_bytes::converter::convert(target_p4_size) + " " + target_block_device + "4" + " as btrfs" + " on /home";
|
||||
}
|
||||
let install_confirm_p1 = adw::ActionRow::builder()
|
||||
.title(p1_row_text.clone())
|
||||
.build();
|
||||
let install_confirm_p2 = adw::ActionRow::builder()
|
||||
.title(p2_row_text.clone())
|
||||
.build();
|
||||
let install_confirm_p3 = adw::ActionRow::builder()
|
||||
.title(p3_row_text.clone())
|
||||
.build();
|
||||
let install_confirm_p4 = adw::ActionRow::builder()
|
||||
.title(p4_row_text.clone())
|
||||
.build();
|
||||
// / install_confirm_selection_box appends
|
||||
//// add live and install media button to install page selections
|
||||
install_confirm_details_boxed_list.append(&install_confirm_detail_language);
|
||||
install_confirm_details_boxed_list.append(&install_confirm_detail_timezone);
|
||||
install_confirm_details_boxed_list.append(&install_confirm_detail_keyboard);
|
||||
install_confirm_details_boxed_list.append(&install_confirm_detail_target);
|
||||
install_confirm_details_boxed_list.append(&install_confirm_p1);
|
||||
install_confirm_details_boxed_list.append(&install_confirm_p2);
|
||||
install_confirm_details_boxed_list.append(&install_confirm_p3);
|
||||
install_confirm_details_boxed_list.append(&install_confirm_p4);
|
||||
} else {
|
||||
// / install_confirm_selection_box appends
|
||||
//// add live and install media button to install page selections
|
||||
install_confirm_details_boxed_list.append(&install_confirm_detail_language);
|
||||
install_confirm_details_boxed_list.append(&install_confirm_detail_timezone);
|
||||
install_confirm_details_boxed_list.append(&install_confirm_detail_keyboard);
|
||||
install_confirm_details_boxed_list.append(&install_confirm_detail_target);
|
||||
}
|
||||
|
||||
let install_confirm_button = gtk::Button::builder()
|
||||
.label("Confirm & Install PikaOS")
|
||||
.halign(gtk::Align::Center)
|
||||
@ -145,12 +216,6 @@ pub fn install_page(done_main_box: >k::Box, install_main_box: >k::Box ,conte
|
||||
|
||||
// Start Appending widgets to boxes
|
||||
|
||||
// / install_confirm_selection_box appends
|
||||
//// add live and install media button to install page selections
|
||||
install_confirm_details_boxed_list.append(&install_confirm_detail_language);
|
||||
install_confirm_details_boxed_list.append(&install_confirm_detail_timezone);
|
||||
install_confirm_details_boxed_list.append(&install_confirm_detail_keyboard);
|
||||
install_confirm_details_boxed_list.append(&install_confirm_detail_target);
|
||||
//
|
||||
install_confirm_selection_box.append(&install_confirm_details_boxed_list);
|
||||
install_confirm_selection_box.append(&install_confirm_button);
|
||||
|
@ -227,7 +227,7 @@ pub fn keyboard_page(content_stack: >k::Stack) {
|
||||
keyboard_main_box.append(&keyboard_selection_box);
|
||||
|
||||
//// Add the keyboard selection/page content box to keyboard main box
|
||||
keyboard_main_box.append(>k::Entry::builder().hexpand(true).valign(Align::End).vexpand(false).margin_bottom(15).margin_top(15).margin_end(15).margin_start(15).build());
|
||||
keyboard_main_box.append(>k::Entry::builder().hexpand(true).valign(Align::End).vexpand(false).margin_bottom(15).margin_top(15).margin_end(15).margin_start(15).placeholder_text("Test Your Keyboard here!").build());
|
||||
|
||||
keyboard_main_box.append(&bottom_box);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user