From 3f56e07b2a53da241f6559b5663f5d77cd727469 Mon Sep 17 00:00:00 2001 From: Ward from fusion-voyager-3 Date: Sun, 25 Feb 2024 21:38:11 +0300 Subject: [PATCH] BTRFS automatic subvols --- Cargo.lock | 2 +- Cargo.toml | 2 +- data/scripts/automatic-partition-install.sh | 48 ++++++++++++++--- debian/changelog | 2 +- src/drive_mount_row/imp.rs | 57 +++++---------------- 5 files changed, 57 insertions(+), 54 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ac3fe9c..7da5c50 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -833,7 +833,7 @@ checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" [[package]] name = "pika-installer-gtk4" -version = "1.0.1" +version = "1.0.2" dependencies = [ "async-channel", "duct", diff --git a/Cargo.toml b/Cargo.toml index 6f3718c..bd3bdc9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pika-installer-gtk4" -version = "1.0.1" +version = "1.0.2" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/data/scripts/automatic-partition-install.sh b/data/scripts/automatic-partition-install.sh index c8e124d..ae07066 100644 --- a/data/scripts/automatic-partition-install.sh +++ b/data/scripts/automatic-partition-install.sh @@ -39,10 +39,18 @@ then yes | mkfs.btrfs -f /dev/${S_DISK}p4 sleep 2 # Begin Mounting + mkdir -p /var/cache/root-mnt + mount /dev/${S_DISK}p3 /var/cache/root-mnt + btrfs subvolume create /var/cache/root-mnt/@ + # + mkdir -p /var/cache/home-mnt + mount /dev/${S_DISK}p4 /var/cache/home-mnt + btrfs subvolume create /var/cache/home-mnt/@ + # mkdir -p /media/pika-install-mount - mount /dev/${S_DISK}p3 /media/pika-install-mount/ + mount /dev/${S_DISK}p3 /media/pika-install-mount/ -o subvol=@ mkdir -p /media/pika-install-mount/home - mount /dev/${S_DISK}p4 /media/pika-install-mount/home + mount /dev/${S_DISK}p4 /media/pika-install-mount/home -o subvol=@ mkdir -p /media/pika-install-mount/boot mount /dev/${S_DISK}p2 /media/pika-install-mount/boot mkdir -p /media/pika-install-mount/boot/efi @@ -57,10 +65,18 @@ then yes | mkfs.btrfs -f /dev/${S_DISK}4 sleep 2 # Begin Mounting + mkdir -p /var/cache/root-mnt + mount /dev/${S_DISK}3 /var/cache/root-mnt + btrfs subvolume create /var/cache/root-mnt/@ + # + mkdir -p /var/cache/home-mnt + mount /dev/${S_DISK}4 /var/cache/home-mnt + btrfs subvolume create /var/cache/home-mnt/@ + # mkdir -p /media/pika-install-mount - mount /dev/${S_DISK}3 /media/pika-install-mount/ + mount /dev/${S_DISK}3 /media/pika-install-mount/ -o subvol=@ mkdir -p /media/pika-install-mount/home - mount /dev/${S_DISK}4 /media/pika-install-mount/home + mount /dev/${S_DISK}4 /media/pika-install-mount/home -o subvol=@ mkdir -p /media/pika-install-mount/boot mount /dev/${S_DISK}2 /media/pika-install-mount/boot mkdir -p /media/pika-install-mount/boot/efi @@ -96,10 +112,18 @@ else yes | mkfs.btrfs -f /dev/mapper/crypt_home sleep 2 # Begin Mounting + mkdir -p /var/cache/root-mnt + mount /dev/mapper/crypt_root /var/cache/root-mnt + btrfs subvolume create /var/cache/root-mnt/@ + # + mkdir -p /var/cache/home-mnt + mount /dev/mapper/crypt_home /var/cache/home-mnt + btrfs subvolume create /var/cache/home-mnt/@ + # mkdir -p /media/pika-install-mount - mount /dev/mapper/crypt_root /media/pika-install-mount/ + mount /dev/mapper/crypt_root /media/pika-install-mount/ -o subvol=@ mkdir -p /media/pika-install-mount/home - mount /dev/mapper/crypt_home /media/pika-install-mount/home + mount /dev/mapper/crypt_home /media/pika-install-mount/home -o subvol=@ mkdir -p /media/pika-install-mount/boot mount /dev/${S_DISK}p2 /media/pika-install-mount/boot mkdir -p /media/pika-install-mount/boot/efi @@ -118,10 +142,18 @@ else yes | mkfs.btrfs -f /dev/mapper/crypt_home sleep 2 # Begin Mounting + mkdir -p /var/cache/root-mnt + mount /dev/mapper/crypt_root /var/cache/root-mnt + btrfs subvolume create /var/cache/root-mnt/@ + # + mkdir -p /var/cache/home-mnt + mount /dev/mapper/crypt_home /var/cache/home-mnt + btrfs subvolume create /var/cache/home-mnt/@ + # mkdir -p /media/pika-install-mount - mount /dev/mapper/crypt_root /media/pika-install-mount/ + mount /dev/mapper/crypt_root /media/pika-install-mount/ -o subvol=@ mkdir -p /media/pika-install-mount/home - mount /dev/mapper/crypt_home /media/pika-install-mount/home + mount /dev/mapper/crypt_home /media/pika-install-mount/home -o subvol=@ mkdir -p /media/pika-install-mount/boot mount /dev/${S_DISK}2 /media/pika-install-mount/boot mkdir -p /media/pika-install-mount/boot/efi diff --git a/debian/changelog b/debian/changelog index 309acea..6180c9c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -pika-installer-gtk4 (1.0.1-100pika4) pikauwu; urgency=low +pika-installer-gtk4 (1.0.2-100pika1) pikauwu; urgency=low * First release diff --git a/src/drive_mount_row/imp.rs b/src/drive_mount_row/imp.rs index 40ee119..695a39d 100644 --- a/src/drive_mount_row/imp.rs +++ b/src/drive_mount_row/imp.rs @@ -74,52 +74,27 @@ impl ObjectImpl for DriveMountRow { .width_request(300) .build(); - let mountpoint_entry_adw_box = gtk::Box::builder() + let mountpoint_entry_row = gtk::Entry::builder() + .placeholder_text(t!("title_mountpoint")) .hexpand(true) - .valign(gtk::Align::Start) - .homogeneous(true) - .build(); - - let mountpoint_entry_adw_listbox = gtk::ListBox::builder() - .margin_top(5) + .vexpand(true) .margin_bottom(5) - .hexpand(true) - .valign(gtk::Align::Start) - .build(); - mountpoint_entry_adw_listbox.add_css_class("boxed-list"); - - let mountpoint_entry_row = adw::EntryRow::builder() - .title(t!("title_mountpoint")) - .hexpand(true) - .valign(gtk::Align::Start) + .margin_top(5) .width_request(300) .build(); - let mountopt_entry_adw_box = gtk::Box::builder() + let mountopt_entry_row = gtk::Entry::builder() + .placeholder_text(t!("title_mountopt")) .hexpand(true) - .valign(gtk::Align::Start) - .homogeneous(true) - .build(); - - let mountopt_entry_adw_listbox = gtk::ListBox::builder() - .margin_top(5) + .vexpand(true) + .margin_start(10) .margin_bottom(5) - .margin_start(5) - .hexpand(true) - .valign(gtk::Align::Start) - .build(); - mountopt_entry_adw_listbox.add_css_class("boxed-list"); - - let mountopt_entry_row = adw::EntryRow::builder() - .title(t!("title_mountopt")) - .hexpand(true) - .valign(gtk::Align::Start) + .margin_top(5) .width_request(300) .build(); let partition_row_delete_button = gtk::Button::builder() - .margin_end(0) - .margin_start(5) + .margin_end(5) .margin_top(5) .margin_bottom(5) .width_request(53) @@ -136,18 +111,14 @@ impl ObjectImpl for DriveMountRow { partition_row_expander_adw_listbox.append(&partition_row_expander); action_row_content_box.append(&partition_row_expander_adw_listbox); - mountpoint_entry_adw_listbox.append(&mountpoint_entry_row); - mountpoint_entry_adw_box.append(&mountpoint_entry_adw_listbox); - action_row_content_box.append(&mountpoint_entry_adw_box); + action_row_content_box.append(&mountpoint_entry_row); - mountopt_entry_adw_listbox.append(&mountopt_entry_row); - mountopt_entry_adw_box.append(&mountopt_entry_adw_listbox); - action_row_content_box.append(&mountopt_entry_adw_box); - - action_row_content_box.append(&partition_row_delete_button); + action_row_content_box.append(&mountopt_entry_row); obj.add_prefix(&action_row_content_box); + obj.add_suffix(&partition_row_delete_button); + // Bind label to number // `SYNC_CREATE` ensures that the label will be immediately set let obj = self.obj();