diff --git a/data/scripts/automatic-partition-install.sh b/data/scripts/automatic-partition-install.sh index 293cfd8..f5d3c27 100644 --- a/data/scripts/automatic-partition-install.sh +++ b/data/scripts/automatic-partition-install.sh @@ -13,7 +13,11 @@ touch "/tmp/pika-installer-gtk4-status-parting.txt" if [[ ! -f "/tmp/pika-installer-gtk4-target-automatic-luks.txt" ]] then - wipefs -a /dev/${DISK} + for part in $(sudo /usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh get_partitions | grep ${DISK}); do + PARTITION="/dev/$part" + sudo swapoff $PARTITION || true + done + wipefs -af /dev/${DISK} # Partition the drives parted -s -a optimal /dev/${DISK} mklabel gpt \ mkpart "linux-efi" 1MiB 513Mib \ @@ -63,7 +67,11 @@ then fi else LUKS_KEY="$(cat "/tmp/pika-installer-gtk4-target-automatic-luks.txt")" - wipefs -a /dev/${DISK} + for part in $(sudo /usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh get_partitions | grep ${DISK}); do + PARTITION="/dev/$part" + sudo swapoff $PARTITION || true + done + wipefs -af /dev/${DISK} # Partition the drives parted -s -a optimal /dev/${DISK} mklabel gpt \ mkpart "linux-efi" 1MiB 513Mib \ diff --git a/debian/changelog b/debian/changelog index 8a8b2d1..f02a4f3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -pika-installer-gtk4 (1.0.0-100pika12) pikauwu; urgency=low +pika-installer-gtk4 (1.0.0-100pika13) pikauwu; urgency=low * First release diff --git a/src/partitioning_page/mod.rs b/src/partitioning_page/mod.rs index 2eb124b..7b6136d 100644 --- a/src/partitioning_page/mod.rs +++ b/src/partitioning_page/mod.rs @@ -17,6 +17,8 @@ use std::path::Path; use std::cell::RefCell; use std::rc::Rc; +use duct::*; + use crate::{manual_partitioning}; use manual_partitioning::DriveMount; @@ -262,14 +264,13 @@ pub fn partitioning_page( fs::remove_file("/tmp/pika-installer-gtk4-target-manual-luks.txt").expect("Bad permissions on /tmp/pika-installer-gtk4-target-manual.txt"); } if Path::new("/tmp/pika-installer-gtk4-fail.txt").exists() { - fs::remove_file("/tmp/pika-installer-gtk4-fail.txt").expect("Bad permissions on /tmp/pika-installer-gtk4-fail.txt"); + cmd!("sudo", "rm", "-rf", "/tmp/pika-installer-gtk4-fail.txt").run(); } if Path::new("/tmp/pika-installer-gtk4-successful.txt").exists() { - fs::remove_file("/tmp/pika-installer-gtk4-successful.txt").expect("Bad permissions on /tmp/pika-installer-gtk4-successful.txt"); + cmd!("sudo", "rm", "-rf", "/tmp/pika-installer-gtk4-successful.txt").run(); } for status_file in glob("/tmp/pika-installer-gtk4-status*").expect("Failed to read glob pattern") { - let status_file = status_file.unwrap(); - fs::remove_file(&status_file).expect(&status_file.to_str().unwrap()); + cmd!("sudo", "rm", "-rf", "/tmp/pika-installer-gtk4-status*").run(); } for partition_file in glob("/tmp/pika-installer-gtk4-target-manual-p*").expect("Failed to read glob pattern") { let partition_file = partition_file.unwrap();