RR: Fix manual partitions refresh function

This commit is contained in:
Ward from fusion-voyager-3 2024-02-17 18:54:33 +03:00
parent 44b90ff768
commit 7b83565fe3
3 changed files with 14 additions and 12 deletions

View File

@ -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)" 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) LUKS_PASSWD=$(jq -r .password $cryptentry)
echo "$MAP $UUID /key-"$MAP".txt luks" >> /tmp/pika-installer-gtk4-crypttab echo "$MAP $UUID /key-"$MAP".txt luks" >> /tmp/pika-installer-gtk4-crypttab
touch /keyfile.txt touch /key-"$MAP".txt
openssl genrsa > /key-"$MAP".txt openssl genrsa > /key-"$MAP".txt
echo $LUKS_PASSWD | cryptsetup luksAddKey UUID=$UUID /key-"$MAP".txt - echo $LUKS_PASSWD | cryptsetup luksAddKey UUID=$UUID /key-"$MAP".txt -
fi fi
@ -35,18 +35,18 @@ fi
for drivemount in /tmp/pika-installer-gtk4-target-manual-p*.json; do for drivemount in /tmp/pika-installer-gtk4-target-manual-p*.json; do
PARTITION="/dev/$(jq -r .partition $drivemount)" 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) MOUNTOPT=$(jq -r .mountopt $drivemount)
if [[ -z $MOUNTOPT ]] if [[ -z $MOUNTOPT ]]
then then
mkdir -p /media/pika-install-mount/$MOUNTPOINT mkdir -p $MOUNTPOINT
mount $PARTITION $MOUNTPOINT mount $PARTITION $MOUNTPOINT
elif [[ $MOUNTPOINT == "[SWAP]" ]] elif [[ $MOUNTPOINT == "[SWAP]" ]]
then then
touch /tmp/pika-installer-gtk4-swaplist touch /tmp/pika-installer-gtk4-swaplist
echo $PARTITION > /tmp/pika-installer-gtk4-swaplist echo $PARTITION > /tmp/pika-installer-gtk4-swaplist
else else
mkdir -p /media/pika-install-mount/$MOUNTPOINT mkdir -p $MOUNTPOINT
mount -o $MOUNTOPT $PARTITION $MOUNTPOINT mount -o $MOUNTOPT $PARTITION $MOUNTPOINT
fi fi
done done

2
debian/changelog vendored
View File

@ -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 * First release

View File

@ -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_error_label);
partition_method_manual_main_box.append(&partition_method_manual_warn_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 |_| { partition_refresh_button.connect_clicked(clone!(@weak drive_mounts_adw_listbox,@strong part_table_array, @strong manual_drive_mount_array => move |_| {
let mut counter = drive_mounts_adw_listbox.first_child(); while let Some(row) = drive_mounts_adw_listbox.last_child() {
while let Some(ref row) = counter {
if row.widget_name() == "DriveMountRow" { if row.widget_name() == "DriveMountRow" {
drive_mounts_adw_listbox.remove(row); drive_mounts_adw_listbox.remove(&row);
} else {
break
} }
counter = row.next_sibling();
} }
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 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(); let mut part_table_array_ref = part_table_array.borrow_mut();
part_table_array_ref.clear(); 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 { for partition in partition_method_manual_get_partitions_lines {
part_table_array_ref.push(partition.unwrap()); part_table_array_ref.push(partition.unwrap());
} }