From 5b238c9fe777a5235ec53567e0a76f0e45891d30 Mon Sep 17 00:00:00 2001 From: Ward from fusion-voyager-3 Date: Mon, 22 Jan 2024 20:57:18 +0300 Subject: [PATCH] live media adaptations --- data/scripts/automatic-partition-install.sh | 24 ++++++++++++---- src/partitioning_page.rs | 32 ++++++++++----------- 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/data/scripts/automatic-partition-install.sh b/data/scripts/automatic-partition-install.sh index ef9ad37..0a0b755 100644 --- a/data/scripts/automatic-partition-install.sh +++ b/data/scripts/automatic-partition-install.sh @@ -6,16 +6,24 @@ KEYBOARD="$(cat /tmp/pika-installer-gtk4-target-auto.txt")" TIMEZONE="$(cat /tmp/pika-installer-gtk4-timezone.txt")" -if [[ -f "/tmp/pika-installer-gtk4-target-automatic-luks.txt" ]] +if [[ ! -f "/tmp/pika-installer-gtk4-target-automatic-luks.txt" ]] then + # Partition the drives parted -s -a optimal /dev/${DISK} mklabel gpt \ - mkpart "linux-efi" fat32 1MiB 513Mib \ - mkpart "linux-boot" ext4 513Mib 1537Mib \ - mkpart "linux-root" btrfs 1537Mib 42497Mib \ - mkpart "linux-home" btrfs 42497Mib 100% \ + mkpart "linux-efi" 1MiB 513Mib \ + mkpart "linux-boot" 513Mib 1537Mib \ + mkpart "linux-root" 1537Mib 42497Mib \ + mkpart "linux-home" 42497Mib 100% \ print + # add p to partition if it's nvme if echo ${DISK} | grep -i "nvme" then + # Add filesystems + mkfs -t vfat -F32 /dev/${DISK}p1 + mkfs -t ext4 /dev/${DISK}p2 + mkfs -t btrfs /dev/${DISK}p3 + mkfs -t btrfs /dev/${DISK}p4 + # Begin Mounting mkdir -p /media/pika-install-mount mount /dev/${DISK}p3 /media/pika-install-mount/ mkdir -p /media/pika-install-mount/home @@ -26,6 +34,12 @@ then mount /dev/${DISK}p1 /media/pika-install-mount/boot/efi pikainstall -r /media/pika-install-mount/ -b /media/pika-install-mount/boot -e /media/pika-install-mount/boot/efi -l ${LOCALE} -k ${KEYBOARD} -t ${TIMEZONE} && touch /tmp/pika-installer-gtk4-successful.txt else + # Add filesystems + mkfs -t vfat -F32 /dev/${DISK}1 + mkfs -t ext4 /dev/${DISK}2 + mkfs -t btrfs /dev/${DISK}3 + mkfs -t btrfs /dev/${DISK}4 + # Begin Mounting mkdir -p /media/pika-install-mount mount /dev/${DISK}3 /media/pika-install-mount/ mkdir -p /media/pika-install-mount/home diff --git a/src/partitioning_page.rs b/src/partitioning_page.rs index 522f178..c52fb56 100644 --- a/src/partitioning_page.rs +++ b/src/partitioning_page.rs @@ -286,7 +286,7 @@ pub fn partitioning_page(done_main_box: >k::Box, install_main_box: >k::Box , devices_selection_expander_row.add_row(&devices_selection_expander_row_viewport); - let partition_method_automatic_get_devices_cli = Command::new("pkexec") + let partition_method_automatic_get_devices_cli = Command::new("sudo") .arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh") .arg("get_block_devices") .stdin(Stdio::piped()) @@ -346,7 +346,7 @@ pub fn partitioning_page(done_main_box: >k::Box, install_main_box: >k::Box , for device in partition_method_automatic_get_devices_reader.lines() { let device = device.unwrap(); - let device_size_cli = Command::new("pkexec") + let device_size_cli = Command::new("sudo") .arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh") .arg("get_block_size") .arg(device.clone()) @@ -670,7 +670,7 @@ pub fn partitioning_page(done_main_box: >k::Box, install_main_box: >k::Box , partition_method_manual_chroot_error_label.set_visible(false); } // Home partition Check - let home_not_root_cli = Command::new("pkexec") + let home_not_root_cli = Command::new("sudo") .arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh") .arg("home_not_root") .arg(custom_root_mountpoint.clone()) @@ -682,7 +682,7 @@ pub fn partitioning_page(done_main_box: >k::Box, install_main_box: >k::Box , let luks_manual_is_encrypt_sender = luks_manual_is_encrypt_sender.clone(); // The long running operation runs now in a separate thread gio::spawn_blocking(clone!(@strong custom_root_mountpoint => move || { - let check_home_encryption_cli = Command::new("pkexec") + let check_home_encryption_cli = Command::new("sudo") .arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh") .arg("check_home_encryption") .arg(custom_root_mountpoint) @@ -711,7 +711,7 @@ pub fn partitioning_page(done_main_box: >k::Box, install_main_box: >k::Box , let luks_manual_password_sender = luks_manual_password_sender.clone(); // The long running operation runs now in a separate thread gio::spawn_blocking(clone!(@strong custom_root_mountpoint, @strong luks_passwd => move || { - let luks_check_cli = Command::new("pkexec") + let luks_check_cli = Command::new("sudo") .arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh") .arg("check_home_luks_passwd") .arg(custom_root_mountpoint) @@ -738,19 +738,19 @@ pub fn partitioning_page(done_main_box: >k::Box, install_main_box: >k::Box , })); } // Boot partition Checks - let home_not_boot_cli = Command::new("pkexec") + let home_not_boot_cli = Command::new("sudo") .arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh") .arg("home_not_boot") .arg(custom_root_mountpoint.clone()) .output() .expect("failed to execute process"); - let root_not_boot_cli = Command::new("pkexec") + let root_not_boot_cli = Command::new("sudo") .arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh") .arg("root_not_boot") .arg(custom_root_mountpoint.clone()) .output() .expect("failed to execute process"); - let boot_not_efi_cli = Command::new("pkexec") + let boot_not_efi_cli = Command::new("sudo") .arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh") .arg("boot_not_efi") .arg(custom_root_mountpoint.clone()) @@ -780,7 +780,7 @@ pub fn partitioning_page(done_main_box: >k::Box, install_main_box: >k::Box , } } // EFI partition Checks - let root_not_efi_cli = Command::new("pkexec") + let root_not_efi_cli = Command::new("sudo") .arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh") .arg("root_not_efi") .arg(custom_root_mountpoint.clone()) @@ -812,7 +812,7 @@ pub fn partitioning_page(done_main_box: >k::Box, install_main_box: >k::Box , partition_method_manual_chroot_error_label.set_visible(false); } // Home partition Check - let home_not_root_cli = Command::new("pkexec") + let home_not_root_cli = Command::new("sudo") .arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh") .arg("home_not_root") .arg(custom_root_mountpoint.clone()) @@ -824,7 +824,7 @@ pub fn partitioning_page(done_main_box: >k::Box, install_main_box: >k::Box , let luks_manual_is_encrypt_sender = luks_manual_is_encrypt_sender.clone(); // The long running operation runs now in a separate thread gio::spawn_blocking(clone!(@strong custom_root_mountpoint => move || { - let check_home_encryption_cli = Command::new("pkexec") + let check_home_encryption_cli = Command::new("sudo") .arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh") .arg("check_home_encryption") .arg(custom_root_mountpoint) @@ -853,7 +853,7 @@ pub fn partitioning_page(done_main_box: >k::Box, install_main_box: >k::Box , let luks_manual_password_sender = luks_manual_password_sender.clone(); // The long running operation runs now in a separate thread gio::spawn_blocking(clone!(@strong custom_root_mountpoint, @strong luks_passwd => move || { - let luks_check_cli = Command::new("pkexec") + let luks_check_cli = Command::new("sudo") .arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh") .arg("check_home_luks_passwd") .arg(custom_root_mountpoint) @@ -880,19 +880,19 @@ pub fn partitioning_page(done_main_box: >k::Box, install_main_box: >k::Box , })); } // Boot partition Checks - let home_not_boot_cli = Command::new("pkexec") + let home_not_boot_cli = Command::new("sudo") .arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh") .arg("home_not_boot") .arg(custom_root_mountpoint.clone()) .output() .expect("failed to execute process"); - let root_not_boot_cli = Command::new("pkexec") + let root_not_boot_cli = Command::new("sudo") .arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh") .arg("root_not_boot") .arg(custom_root_mountpoint.clone()) .output() .expect("failed to execute process"); - let boot_not_efi_cli = Command::new("pkexec") + let boot_not_efi_cli = Command::new("sudo") .arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh") .arg("boot_not_efi") .arg(custom_root_mountpoint.clone()) @@ -922,7 +922,7 @@ pub fn partitioning_page(done_main_box: >k::Box, install_main_box: >k::Box , } } // EFI partition Checks - let root_not_efi_cli = Command::new("pkexec") + let root_not_efi_cli = Command::new("sudo") .arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh") .arg("root_not_efi") .arg(custom_root_mountpoint.clone())