From 7b83565fe37c342877d26ebf42fc0f9754a3e834 Mon Sep 17 00:00:00 2001 From: Ward from fusion-voyager-3 Date: Sat, 17 Feb 2024 18:54:33 +0300 Subject: [PATCH] RR: Fix manual partitions refresh function --- data/scripts/manual-partition-install.sh | 10 +++++----- debian/changelog | 2 +- src/manual_partitioning/mod.rs | 14 ++++++++------ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/data/scripts/manual-partition-install.sh b/data/scripts/manual-partition-install.sh index 051c22d..fbe7153 100644 --- a/data/scripts/manual-partition-install.sh +++ b/data/scripts/manual-partition-install.sh @@ -26,7 +26,7 @@ then UUID="$(blkid "$(lsblk -sJp | jq -r --arg dsk /dev/"$LUKS" '.blockdevices | .[] | select(.name == $dsk) | .children | .[0] | .name')" -s UUID -o value)" LUKS_PASSWD=$(jq -r .password $cryptentry) echo "$MAP $UUID /key-"$MAP".txt luks" >> /tmp/pika-installer-gtk4-crypttab - touch /keyfile.txt + touch /key-"$MAP".txt openssl genrsa > /key-"$MAP".txt echo $LUKS_PASSWD | cryptsetup luksAddKey UUID=$UUID /key-"$MAP".txt - fi @@ -35,18 +35,18 @@ fi for drivemount in /tmp/pika-installer-gtk4-target-manual-p*.json; do PARTITION="/dev/$(jq -r .partition $drivemount)" - MOUNTPOINT=$(jq -r .mountpoint $drivemount) + MOUNTPOINT="/media/pika-install-mount/$(jq -r .mountpoint $drivemount)" MOUNTOPT=$(jq -r .mountopt $drivemount) if [[ -z $MOUNTOPT ]] then - mkdir -p /media/pika-install-mount/$MOUNTPOINT + mkdir -p $MOUNTPOINT mount $PARTITION $MOUNTPOINT elif [[ $MOUNTPOINT == "[SWAP]" ]] then touch /tmp/pika-installer-gtk4-swaplist echo $PARTITION > /tmp/pika-installer-gtk4-swaplist else - mkdir -p /media/pika-install-mount/$MOUNTPOINT + mkdir -p $MOUNTPOINT mount -o $MOUNTOPT $PARTITION $MOUNTPOINT fi done @@ -56,4 +56,4 @@ then pikainstall -r /media/pika-install-mount/ --manual 1 -l ${LOCALE} -k ${KEYBOARD} -t ${TIMEZONE} && touch /tmp/pika-installer-gtk4-successful.txt || touch /tmp/pika-installer-gtk4-fail.txt && exit 1 else pikainstall -r /media/pika-install-mount/ --manual 2 -l ${LOCALE} -k ${KEYBOARD} -t ${TIMEZONE} && touch /tmp/pika-installer-gtk4-successful.txt || touch /tmp/pika-installer-gtk4-fail.txt && exit 1 -fi \ No newline at end of file +fi diff --git a/debian/changelog b/debian/changelog index 9f97a96..32f26a0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -pika-installer-gtk4 (1.0.0-100pika8) pikauwu; urgency=low +pika-installer-gtk4 (1.0.0-100pika9) pikauwu; urgency=low * First release diff --git a/src/manual_partitioning/mod.rs b/src/manual_partitioning/mod.rs index 5199eda..ec46dda 100644 --- a/src/manual_partitioning/mod.rs +++ b/src/manual_partitioning/mod.rs @@ -261,17 +261,19 @@ pub fn manual_partitioning( partition_method_manual_main_box.append(&partition_method_manual_error_label); partition_method_manual_main_box.append(&partition_method_manual_warn_label); - partition_refresh_button.connect_clicked(clone!(@weak drive_mounts_adw_listbox,@strong part_table_array => move |_| { - let mut counter = drive_mounts_adw_listbox.first_child(); - while let Some(ref row) = counter { + partition_refresh_button.connect_clicked(clone!(@weak drive_mounts_adw_listbox,@strong part_table_array, @strong manual_drive_mount_array => move |_| { + while let Some(row) = drive_mounts_adw_listbox.last_child() { if row.widget_name() == "DriveMountRow" { - drive_mounts_adw_listbox.remove(row); - } - counter = row.next_sibling(); + drive_mounts_adw_listbox.remove(&row); + } else { + break } + } let partition_method_manual_get_partitions_lines = BufReader::new(cmd!("bash", "-c", "sudo /usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh get_partitions").reader().unwrap()).lines(); let mut part_table_array_ref = part_table_array.borrow_mut(); part_table_array_ref.clear(); + let mut manual_drive_mount_array_ref = manual_drive_mount_array.borrow_mut(); + manual_drive_mount_array_ref.clear(); for partition in partition_method_manual_get_partitions_lines { part_table_array_ref.push(partition.unwrap()); }