live media adaptations

This commit is contained in:
Ward from fusion-voyager-3 2024-01-22 20:57:18 +03:00
parent 2a2536ce79
commit 5b238c9fe7
2 changed files with 35 additions and 21 deletions

View File

@ -6,16 +6,24 @@ KEYBOARD="$(cat /tmp/pika-installer-gtk4-target-auto.txt")"
TIMEZONE="$(cat /tmp/pika-installer-gtk4-timezone.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 then
# Partition the drives
parted -s -a optimal /dev/${DISK} mklabel gpt \ parted -s -a optimal /dev/${DISK} mklabel gpt \
mkpart "linux-efi" fat32 1MiB 513Mib \ mkpart "linux-efi" 1MiB 513Mib \
mkpart "linux-boot" ext4 513Mib 1537Mib \ mkpart "linux-boot" 513Mib 1537Mib \
mkpart "linux-root" btrfs 1537Mib 42497Mib \ mkpart "linux-root" 1537Mib 42497Mib \
mkpart "linux-home" btrfs 42497Mib 100% \ mkpart "linux-home" 42497Mib 100% \
print print
# add p to partition if it's nvme
if echo ${DISK} | grep -i "nvme" if echo ${DISK} | grep -i "nvme"
then 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 mkdir -p /media/pika-install-mount
mount /dev/${DISK}p3 /media/pika-install-mount/ mount /dev/${DISK}p3 /media/pika-install-mount/
mkdir -p /media/pika-install-mount/home mkdir -p /media/pika-install-mount/home
@ -26,6 +34,12 @@ then
mount /dev/${DISK}p1 /media/pika-install-mount/boot/efi 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 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 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 mkdir -p /media/pika-install-mount
mount /dev/${DISK}3 /media/pika-install-mount/ mount /dev/${DISK}3 /media/pika-install-mount/
mkdir -p /media/pika-install-mount/home mkdir -p /media/pika-install-mount/home

View File

@ -286,7 +286,7 @@ pub fn partitioning_page(done_main_box: &gtk::Box, install_main_box: &gtk::Box ,
devices_selection_expander_row.add_row(&devices_selection_expander_row_viewport); 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("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
.arg("get_block_devices") .arg("get_block_devices")
.stdin(Stdio::piped()) .stdin(Stdio::piped())
@ -346,7 +346,7 @@ pub fn partitioning_page(done_main_box: &gtk::Box, install_main_box: &gtk::Box ,
for device in partition_method_automatic_get_devices_reader.lines() { for device in partition_method_automatic_get_devices_reader.lines() {
let device = device.unwrap(); 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("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
.arg("get_block_size") .arg("get_block_size")
.arg(device.clone()) .arg(device.clone())
@ -670,7 +670,7 @@ pub fn partitioning_page(done_main_box: &gtk::Box, install_main_box: &gtk::Box ,
partition_method_manual_chroot_error_label.set_visible(false); partition_method_manual_chroot_error_label.set_visible(false);
} }
// Home partition Check // 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("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
.arg("home_not_root") .arg("home_not_root")
.arg(custom_root_mountpoint.clone()) .arg(custom_root_mountpoint.clone())
@ -682,7 +682,7 @@ pub fn partitioning_page(done_main_box: &gtk::Box, install_main_box: &gtk::Box ,
let luks_manual_is_encrypt_sender = luks_manual_is_encrypt_sender.clone(); let luks_manual_is_encrypt_sender = luks_manual_is_encrypt_sender.clone();
// The long running operation runs now in a separate thread // The long running operation runs now in a separate thread
gio::spawn_blocking(clone!(@strong custom_root_mountpoint => move || { 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("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
.arg("check_home_encryption") .arg("check_home_encryption")
.arg(custom_root_mountpoint) .arg(custom_root_mountpoint)
@ -711,7 +711,7 @@ pub fn partitioning_page(done_main_box: &gtk::Box, install_main_box: &gtk::Box ,
let luks_manual_password_sender = luks_manual_password_sender.clone(); let luks_manual_password_sender = luks_manual_password_sender.clone();
// The long running operation runs now in a separate thread // The long running operation runs now in a separate thread
gio::spawn_blocking(clone!(@strong custom_root_mountpoint, @strong luks_passwd => move || { 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("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
.arg("check_home_luks_passwd") .arg("check_home_luks_passwd")
.arg(custom_root_mountpoint) .arg(custom_root_mountpoint)
@ -738,19 +738,19 @@ pub fn partitioning_page(done_main_box: &gtk::Box, install_main_box: &gtk::Box ,
})); }));
} }
// Boot partition Checks // 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("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
.arg("home_not_boot") .arg("home_not_boot")
.arg(custom_root_mountpoint.clone()) .arg(custom_root_mountpoint.clone())
.output() .output()
.expect("failed to execute process"); .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("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
.arg("root_not_boot") .arg("root_not_boot")
.arg(custom_root_mountpoint.clone()) .arg(custom_root_mountpoint.clone())
.output() .output()
.expect("failed to execute process"); .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("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
.arg("boot_not_efi") .arg("boot_not_efi")
.arg(custom_root_mountpoint.clone()) .arg(custom_root_mountpoint.clone())
@ -780,7 +780,7 @@ pub fn partitioning_page(done_main_box: &gtk::Box, install_main_box: &gtk::Box ,
} }
} }
// EFI partition Checks // 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("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
.arg("root_not_efi") .arg("root_not_efi")
.arg(custom_root_mountpoint.clone()) .arg(custom_root_mountpoint.clone())
@ -812,7 +812,7 @@ pub fn partitioning_page(done_main_box: &gtk::Box, install_main_box: &gtk::Box ,
partition_method_manual_chroot_error_label.set_visible(false); partition_method_manual_chroot_error_label.set_visible(false);
} }
// Home partition Check // 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("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
.arg("home_not_root") .arg("home_not_root")
.arg(custom_root_mountpoint.clone()) .arg(custom_root_mountpoint.clone())
@ -824,7 +824,7 @@ pub fn partitioning_page(done_main_box: &gtk::Box, install_main_box: &gtk::Box ,
let luks_manual_is_encrypt_sender = luks_manual_is_encrypt_sender.clone(); let luks_manual_is_encrypt_sender = luks_manual_is_encrypt_sender.clone();
// The long running operation runs now in a separate thread // The long running operation runs now in a separate thread
gio::spawn_blocking(clone!(@strong custom_root_mountpoint => move || { 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("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
.arg("check_home_encryption") .arg("check_home_encryption")
.arg(custom_root_mountpoint) .arg(custom_root_mountpoint)
@ -853,7 +853,7 @@ pub fn partitioning_page(done_main_box: &gtk::Box, install_main_box: &gtk::Box ,
let luks_manual_password_sender = luks_manual_password_sender.clone(); let luks_manual_password_sender = luks_manual_password_sender.clone();
// The long running operation runs now in a separate thread // The long running operation runs now in a separate thread
gio::spawn_blocking(clone!(@strong custom_root_mountpoint, @strong luks_passwd => move || { 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("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
.arg("check_home_luks_passwd") .arg("check_home_luks_passwd")
.arg(custom_root_mountpoint) .arg(custom_root_mountpoint)
@ -880,19 +880,19 @@ pub fn partitioning_page(done_main_box: &gtk::Box, install_main_box: &gtk::Box ,
})); }));
} }
// Boot partition Checks // 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("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
.arg("home_not_boot") .arg("home_not_boot")
.arg(custom_root_mountpoint.clone()) .arg(custom_root_mountpoint.clone())
.output() .output()
.expect("failed to execute process"); .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("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
.arg("root_not_boot") .arg("root_not_boot")
.arg(custom_root_mountpoint.clone()) .arg(custom_root_mountpoint.clone())
.output() .output()
.expect("failed to execute process"); .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("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
.arg("boot_not_efi") .arg("boot_not_efi")
.arg(custom_root_mountpoint.clone()) .arg(custom_root_mountpoint.clone())
@ -922,7 +922,7 @@ pub fn partitioning_page(done_main_box: &gtk::Box, install_main_box: &gtk::Box ,
} }
} }
// EFI partition Checks // 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("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
.arg("root_not_efi") .arg("root_not_efi")
.arg(custom_root_mountpoint.clone()) .arg(custom_root_mountpoint.clone())