RR: Fix the new bs issues

This commit is contained in:
Ward from fusion-voyager-3 2024-02-19 20:44:10 +03:00
parent fc546fbc23
commit 87ae8a7c37
17 changed files with 256 additions and 159 deletions

View File

@ -4,10 +4,10 @@ export LANG=en_US.UTF8
set -e
DISK="$(cat "/tmp/pika-installer-gtk4-target-auto.txt")"
LOCALE="$(cat "/tmp/pika-installer-gtk4-lang.txt")"
KEYBOARD="$(cat "/tmp/pika-installer-gtk4-keyboard.txt")"
TIMEZONE="$(cat "/tmp/pika-installer-gtk4-timezone.txt")"
S_DISK="$(cat "/tmp/pika-installer-gtk4-target-auto.txt")"
S_LOCALE="$(cat "/tmp/pika-installer-gtk4-lang.txt")"
S_KEYBOARD="$(cat "/tmp/pika-installer-gtk4-keyboard.txt")"
S_TIMEZONE="$(cat "/tmp/pika-installer-gtk4-timezone.txt")"
p3_size=$(echo "scale=2 ; $(cat /tmp/pika-installer-p3-size.txt) / 1024 / 1024" | bc | cut -f1 -d".")
@ -15,83 +15,83 @@ touch "/tmp/pika-installer-gtk4-status-parting.txt"
if [[ ! -f "/tmp/pika-installer-gtk4-target-automatic-luks.txt" ]]
then
for part in $(sudo /usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh get_partitions | grep ${DISK}); do
for part in $(sudo /usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh get_partitions | grep ${S_DISK}); do
PARTITION="/dev/$part"
sudo swapoff $PARTITION || true
done
wipefs -af /dev/${DISK}
wipefs -af /dev/${S_DISK}
# Partition the drives
parted -s -a optimal /dev/${DISK} mklabel gpt \
parted -s -a optimal /dev/${S_DISK} mklabel gpt \
mkpart "linux-efi" 1MiB 513Mib \
mkpart "linux-boot" 513Mib 1537Mib \
mkpart "linux-root" 1537Mib "$p3_size"Mib \
mkpart "linux-home" "$p3_size"Mib 100% \
print
# add p to partition if it's nvme
if echo ${DISK} | grep -i "nvme"
if echo ${S_DISK} | grep -i "nvme"
then
#
sleep 10
# Add filesystems
yes | mkfs -t vfat -F 32 /dev/${DISK}p1
yes | mkfs -t ext4 /dev/${DISK}p2
yes | mkfs.btrfs -f /dev/${DISK}p3
yes | mkfs.btrfs -f /dev/${DISK}p4
yes | mkfs -t vfat -F 32 /dev/${S_DISK}p1
yes | mkfs -t ext4 /dev/${S_DISK}p2
yes | mkfs.btrfs -f /dev/${S_DISK}p3
yes | mkfs.btrfs -f /dev/${S_DISK}p4
sleep 2
# Begin Mounting
mkdir -p /media/pika-install-mount
mount /dev/${DISK}p3 /media/pika-install-mount/
mount /dev/${S_DISK}p3 /media/pika-install-mount/
mkdir -p /media/pika-install-mount/home
mount /dev/${DISK}p4 /media/pika-install-mount/home
mount /dev/${S_DISK}p4 /media/pika-install-mount/home
mkdir -p /media/pika-install-mount/boot
mount /dev/${DISK}p2 /media/pika-install-mount/boot
mount /dev/${S_DISK}p2 /media/pika-install-mount/boot
mkdir -p /media/pika-install-mount/boot/efi
mount /dev/${DISK}p1 /media/pika-install-mount/boot/efi
pikainstall -r /media/pika-install-mount/ -l ${LOCALE} -k ${KEYBOARD} -t ${TIMEZONE} && touch /tmp/pika-installer-gtk4-successful.txt || touch /tmp/pika-installer-gtk4-fail.txt && exit 1
mount /dev/${S_DISK}p1 /media/pika-install-mount/boot/efi
pikainstall -r /media/pika-install-mount/ -l ${S_LOCALE} -k ${S_KEYBOARD} -t ${S_TIMEZONE} && touch /tmp/pika-installer-gtk4-successful.txt || touch /tmp/pika-installer-gtk4-fail.txt && exit 1
else
sleep 10
# Add filesystems
yes | mkfs -t vfat -F 32 /dev/${DISK}1
yes | mkfs -t ext4 /dev/${DISK}2
yes | mkfs.btrfs -f /dev/${DISK}3
yes | mkfs.btrfs -f /dev/${DISK}4
yes | mkfs -t vfat -F 32 /dev/${S_DISK}1
yes | mkfs -t ext4 /dev/${S_DISK}2
yes | mkfs.btrfs -f /dev/${S_DISK}3
yes | mkfs.btrfs -f /dev/${S_DISK}4
sleep 2
# Begin Mounting
mkdir -p /media/pika-install-mount
mount /dev/${DISK}3 /media/pika-install-mount/
mount /dev/${S_DISK}3 /media/pika-install-mount/
mkdir -p /media/pika-install-mount/home
mount /dev/${DISK}4 /media/pika-install-mount/home
mount /dev/${S_DISK}4 /media/pika-install-mount/home
mkdir -p /media/pika-install-mount/boot
mount /dev/${DISK}2 /media/pika-install-mount/boot
mount /dev/${S_DISK}2 /media/pika-install-mount/boot
mkdir -p /media/pika-install-mount/boot/efi
mount /dev/${DISK}1 /media/pika-install-mount/boot/efi
pikainstall -r /media/pika-install-mount/ -l ${LOCALE} -k ${KEYBOARD} -t ${TIMEZONE} && touch /tmp/pika-installer-gtk4-successful.txt || touch /tmp/pika-installer-gtk4-fail.txt && exit 1
mount /dev/${S_DISK}1 /media/pika-install-mount/boot/efi
pikainstall -r /media/pika-install-mount/ -l ${S_LOCALE} -k ${S_KEYBOARD} -t ${S_TIMEZONE} && touch /tmp/pika-installer-gtk4-successful.txt || touch /tmp/pika-installer-gtk4-fail.txt && exit 1
fi
else
LUKS_KEY="$(cat "/tmp/pika-installer-gtk4-target-automatic-luks.txt")"
for part in $(sudo /usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh get_partitions | grep ${DISK}); do
S_LUKS_KEY="$(cat "/tmp/pika-installer-gtk4-target-automatic-luks.txt")"
for part in $(sudo /usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh get_partitions | grep ${S_DISK}); do
PARTITION="/dev/$part"
sudo swapoff $PARTITION || true
done
wipefs -af /dev/${DISK}
wipefs -af /dev/${S_DISK}
# Partition the drives
parted -s -a optimal /dev/${DISK} mklabel gpt \
parted -s -a optimal /dev/${S_DISK} mklabel gpt \
mkpart "linux-efi" 1MiB 513Mib \
mkpart "linux-boot" 513Mib 1537Mib \
mkpart "linux-root" 1537Mib "$p3_size"Mib \
mkpart "linux-home" "$p3_size"Mib 100% \
print
# add p to partition if it's nvme
if echo ${DISK} | grep -i "nvme"
if echo ${S_DISK} | grep -i "nvme"
then
sleep 10
# Add filesystems
yes | mkfs -t vfat -F 32 /dev/${DISK}p1
yes | mkfs -t ext4 /dev/${DISK}p2
printf ${LUKS_KEY} | cryptsetup -q -v --type luks2 luksFormat /dev/${DISK}p3
printf ${LUKS_KEY} | cryptsetup -q -v --type luks2 luksFormat /dev/${DISK}p4
printf ${LUKS_KEY} | cryptsetup -q -v luksOpen /dev/${DISK}p3 crypt_root
printf ${LUKS_KEY} | cryptsetup -q -v luksOpen /dev/${DISK}p4 crypt_home
yes | mkfs -t vfat -F 32 /dev/${S_DISK}p1
yes | mkfs -t ext4 /dev/${S_DISK}p2
printf ${S_LUKS_KEY} | cryptsetup -q -v --type luks2 luksFormat /dev/${S_DISK}p3
printf ${S_LUKS_KEY} | cryptsetup -q -v --type luks2 luksFormat /dev/${S_DISK}p4
printf ${S_LUKS_KEY} | cryptsetup -q -v luksOpen /dev/${S_DISK}p3 crypt_root
printf ${S_LUKS_KEY} | cryptsetup -q -v luksOpen /dev/${S_DISK}p4 crypt_home
yes | mkfs.btrfs -f /dev/mapper/crypt_root
yes | mkfs.btrfs -f /dev/mapper/crypt_home
sleep 2
@ -101,19 +101,19 @@ else
mkdir -p /media/pika-install-mount/home
mount /dev/mapper/crypt_home /media/pika-install-mount/home
mkdir -p /media/pika-install-mount/boot
mount /dev/${DISK}p2 /media/pika-install-mount/boot
mount /dev/${S_DISK}p2 /media/pika-install-mount/boot
mkdir -p /media/pika-install-mount/boot/efi
mount /dev/${DISK}p1 /media/pika-install-mount/boot/efi
pikainstall -r /media/pika-install-mount/ -c ${LUKS_KEY} -l ${LOCALE} -k ${KEYBOARD} -t ${TIMEZONE} && touch /tmp/pika-installer-gtk4-successful.txt || touch /tmp/pika-installer-gtk4-fail.txt && exit 1
mount /dev/${S_DISK}p1 /media/pika-install-mount/boot/efi
pikainstall -r /media/pika-install-mount/ -c ${S_LUKS_KEY} -l ${S_LOCALE} -k ${S_KEYBOARD} -t ${S_TIMEZONE} && touch /tmp/pika-installer-gtk4-successful.txt || touch /tmp/pika-installer-gtk4-fail.txt && exit 1
else
sleep 10
# Add filesystems
yes | mkfs -t vfat -F 32 /dev/${DISK}1
yes | mkfs -t ext4 /dev/${DISK}2
printf ${LUKS_KEY} | cryptsetup -q -v --type luks2 luksFormat /dev/${DISK}3
printf ${LUKS_KEY} | cryptsetup -q -v --type luks2 luksFormat /dev/${DISK}4
printf ${LUKS_KEY} | cryptsetup -q -v luksOpen /dev/${DISK}3 crypt_root
printf ${LUKS_KEY} | cryptsetup -q -v luksOpen /dev/${DISK}4 crypt_home
yes | mkfs -t vfat -F 32 /dev/${S_DISK}1
yes | mkfs -t ext4 /dev/${S_DISK}2
printf ${S_LUKS_KEY} | cryptsetup -q -v --type luks2 luksFormat /dev/${S_DISK}3
printf ${S_LUKS_KEY} | cryptsetup -q -v --type luks2 luksFormat /dev/${S_DISK}4
printf ${S_LUKS_KEY} | cryptsetup -q -v luksOpen /dev/${S_DISK}3 crypt_root
printf ${S_LUKS_KEY} | cryptsetup -q -v luksOpen /dev/${S_DISK}4 crypt_home
yes | mkfs.btrfs -f /dev/mapper/crypt_root
yes | mkfs.btrfs -f /dev/mapper/crypt_home
sleep 2
@ -123,9 +123,9 @@ else
mkdir -p /media/pika-install-mount/home
mount /dev/mapper/crypt_home /media/pika-install-mount/home
mkdir -p /media/pika-install-mount/boot
mount /dev/${DISK}2 /media/pika-install-mount/boot
mount /dev/${S_DISK}2 /media/pika-install-mount/boot
mkdir -p /media/pika-install-mount/boot/efi
mount /dev/${DISK}1 /media/pika-install-mount/boot/efi
pikainstall -r /media/pika-install-mount/ -c ${LUKS_KEY} -l ${LOCALE} -k ${KEYBOARD} -t ${TIMEZONE} && touch /tmp/pika-installer-gtk4-successful.txt || touch /tmp/pika-installer-gtk4-fail.txt && exit 1
mount /dev/${S_DISK}1 /media/pika-install-mount/boot/efi
pikainstall -r /media/pika-install-mount/ -c ${S_LUKS_KEY} -l ${S_LOCALE} -k ${S_KEYBOARD} -t ${S_TIMEZONE} && touch /tmp/pika-installer-gtk4-successful.txt || touch /tmp/pika-installer-gtk4-fail.txt && exit 1
fi
fi

View File

@ -6,12 +6,12 @@ exec &> >(tee /tmp/pika-installer-gtk4-log)
if [[ -f /tmp/pika-installer-gtk4-target-manual.txt ]]
then
sudo /usr/lib/pika/pika-installer-gtk4/scripts/manual-partition-install.sh
sudo /usr/lib/pika/pika-installer-gtk4/scripts/manual-partition-install.sh || touch /tmp/pika-installer-gtk4-fail.txt
else
if [[ -f /tmp/pika-installer-gtk4-target-auto.txt ]]
then
sudo /usr/lib/pika/pika-installer-gtk4/scripts/automatic-partition-install.sh
sudo /usr/lib/pika/pika-installer-gtk4/scripts/automatic-partition-install.sh || touch /tmp/pika-installer-gtk4-fail.txt
else
echo "critical installer error" && exit 1 && touch /tmp/pika-installer-gtk4-fail.txt
echo "critical installer error" && touch /tmp/pika-installer-gtk4-fail.txt && exit 1
fi
fi

View File

@ -4,9 +4,9 @@ export LANG=en_US.UTF8
set -e
LOCALE="$(cat "/tmp/pika-installer-gtk4-lang.txt")"
KEYBOARD="$(cat "/tmp/pika-installer-gtk4-keyboard.txt")"
TIMEZONE="$(cat "/tmp/pika-installer-gtk4-timezone.txt")"
S_LOCALE="$(cat "/tmp/pika-installer-gtk4-lang.txt")"
S_KEYBOARD="$(cat "/tmp/pika-installer-gtk4-keyboard.txt")"
S_TIMEZONE="$(cat "/tmp/pika-installer-gtk4-timezone.txt")"
touch "/tmp/pika-installer-gtk4-status-parting.txt"
@ -57,7 +57,7 @@ done
if [[ ! -f "/tmp/pika-installer-gtk4-crypttab" ]]
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
pikainstall -r /media/pika-install-mount/ --manual 1 -l ${S_LOCALE} -k ${S_KEYBOARD} -t ${S_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
pikainstall -r /media/pika-install-mount/ --manual 2 -l ${S_LOCALE} -k ${S_KEYBOARD} -t ${S_TIMEZONE} && touch /tmp/pika-installer-gtk4-successful.txt || touch /tmp/pika-installer-gtk4-fail.txt && exit 1
fi

View File

@ -321,3 +321,10 @@ msgstr "Done"
msgid "partitioning"
msgstr "Partitioning"
msgid "luks2_password_confirm"
msgstr "Confirm LUKS Password"
msgid "luks_not_match"
msgstr "The LUKS Passwords do not match!"

View File

@ -6,7 +6,7 @@ use glib::*;
/// Use all libadwaita libraries (libadwaita -> adw because cargo)
use gtk::*;
use gettextrs::{gettext};
use gettextrs::gettext;
use std::io::BufRead;
use std::io::BufReader;
@ -127,6 +127,15 @@ pub fn automatic_partitioning(
.build();
partition_method_automatic_luks_error_label.add_css_class("small_error_text");
let partition_method_automatic_luks_error2_label = gtk::Label::builder()
.label(gettext("luks_not_match"))
.halign(Align::Start)
.valign(Align::End)
.vexpand(true)
.visible(false)
.build();
partition_method_automatic_luks_error2_label.add_css_class("small_error_text");
let partition_method_automatic_luks_box = gtk::Box::builder()
.orientation(Orientation::Horizontal)
.build();
@ -153,6 +162,21 @@ pub fn automatic_partitioning(
.sensitive(false)
.build();
let partition_method_automatic_luks_password_confirm_entry = adw::PasswordEntryRow::builder()
.title(gettext("luks2_password_confirm"))
.hexpand(true)
.sensitive(true)
.visible(false)
.build();
let _partition_method_automatic_luks_password = partition_method_automatic_luks_password_entry
.bind_property(
"sensitive",
&partition_method_automatic_luks_password_confirm_entry,
"visible",
)
.sync_create()
.build();
let partition_method_automatic_target_buffer = gtk::TextBuffer::builder().build();
let partition_method_automatic_luks_buffer = gtk::TextBuffer::builder().build();
@ -207,59 +231,102 @@ pub fn automatic_partitioning(
}));
}
partition_method_automatic_luks_checkbutton.connect_toggled(clone!(@weak partition_method_automatic_luks_checkbutton, @weak partition_method_automatic_luks_password_entry, @weak partition_method_automatic_disk_error_label, @weak partition_method_automatic_luks_error_label, @weak bottom_next_button, @weak partition_method_automatic_target_buffer, @weak partition_method_automatic_luks_buffer => move |_| {
partition_method_automatic_luks_checkbutton.connect_toggled(clone!(@weak partition_method_automatic_luks_error2_label,@weak partition_method_automatic_luks_checkbutton, @weak partition_method_automatic_luks_password_confirm_entry, @weak partition_method_automatic_luks_password_entry, @weak partition_method_automatic_disk_error_label, @weak partition_method_automatic_luks_error_label, @weak bottom_next_button, @weak partition_method_automatic_target_buffer, @weak partition_method_automatic_luks_buffer => move |_| {
if partition_method_automatic_luks_checkbutton.is_active() == true {
partition_method_automatic_luks_password_entry.set_sensitive(true);
if partition_method_automatic_luks_password_entry.text() != partition_method_automatic_luks_password_confirm_entry.text() {
partition_method_automatic_luks_error2_label.set_visible(true)
} else {
partition_method_automatic_luks_error2_label.set_visible(false)
}
if partition_method_automatic_luks_password_entry.text().to_string().is_empty() {
partition_method_automatic_luks_error_label.set_visible(true);
bottom_next_button.set_sensitive(false);
} else {
partition_method_automatic_luks_error_label.set_visible(false);
if partition_method_automatic_disk_error_label.get_visible() {
//
} else {
bottom_next_button.set_sensitive(true);
}
if !partition_method_automatic_disk_error_label.get_visible() && !partition_method_automatic_luks_error_label.get_visible() && !partition_method_automatic_luks_error2_label.get_visible() {
bottom_next_button.set_sensitive(true);
} else {
bottom_next_button.set_sensitive(false);
}
}
} else {
partition_method_automatic_luks_password_entry.set_sensitive(false);
partition_method_automatic_luks_error_label.set_visible(false);
if partition_method_automatic_disk_error_label.get_visible() {
//
} else {
partition_method_automatic_luks_error2_label.set_visible(false);
if !partition_method_automatic_disk_error_label.get_visible() && !partition_method_automatic_luks_error_label.get_visible() && !partition_method_automatic_luks_error2_label.get_visible() {
bottom_next_button.set_sensitive(true);
} else {
bottom_next_button.set_sensitive(false);
}
}
}));
partition_method_automatic_luks_password_entry.connect_changed(clone!(@weak partition_method_automatic_luks_checkbutton, @weak partition_method_automatic_luks_password_entry, @weak partition_method_automatic_disk_error_label, @weak partition_method_automatic_luks_error_label, @weak bottom_next_button, @weak partition_method_automatic_luks_buffer => move |_| {
if partition_method_automatic_luks_checkbutton.is_active() == true {
partition_method_automatic_luks_password_entry.set_sensitive(true);
if partition_method_automatic_luks_password_entry.text().to_string().is_empty() {
partition_method_automatic_luks_error_label.set_visible(true);
bottom_next_button.set_sensitive(false);
} else {
partition_method_automatic_luks_error_label.set_visible(false);
if partition_method_automatic_disk_error_label.get_visible() {
//
partition_method_automatic_luks_password_entry.connect_changed(clone!(@weak partition_method_automatic_luks_error2_label,@weak partition_method_automatic_luks_checkbutton, @weak partition_method_automatic_luks_password_confirm_entry, @weak partition_method_automatic_luks_password_entry, @weak partition_method_automatic_disk_error_label, @weak partition_method_automatic_luks_error_label, @weak bottom_next_button, @weak partition_method_automatic_target_buffer, @weak partition_method_automatic_luks_buffer => move |_| {
if partition_method_automatic_luks_checkbutton.is_active() == true {
partition_method_automatic_luks_password_entry.set_sensitive(true);
if partition_method_automatic_luks_password_entry.text() != partition_method_automatic_luks_password_confirm_entry.text() {
partition_method_automatic_luks_error2_label.set_visible(true)
} else {
partition_method_automatic_luks_buffer.set_text(&partition_method_automatic_luks_password_entry.text().to_string());
partition_method_automatic_luks_error2_label.set_visible(false)
}
if partition_method_automatic_luks_password_entry.text().to_string().is_empty() {
partition_method_automatic_luks_error_label.set_visible(true);
bottom_next_button.set_sensitive(false);
} else {
partition_method_automatic_luks_error_label.set_visible(false);
if !partition_method_automatic_disk_error_label.get_visible() && !partition_method_automatic_luks_error_label.get_visible() && !partition_method_automatic_luks_error2_label.get_visible() {
bottom_next_button.set_sensitive(true);
} else {
bottom_next_button.set_sensitive(false);
}
}
} else {
partition_method_automatic_luks_password_entry.set_sensitive(false);
partition_method_automatic_luks_error_label.set_visible(false);
partition_method_automatic_luks_error2_label.set_visible(false);
if !partition_method_automatic_disk_error_label.get_visible() && !partition_method_automatic_luks_error_label.get_visible() && !partition_method_automatic_luks_error2_label.get_visible() {
bottom_next_button.set_sensitive(true);
} else {
bottom_next_button.set_sensitive(false);
}
}
} else {
partition_method_automatic_luks_password_entry.set_sensitive(false);
partition_method_automatic_luks_error_label.set_visible(false);
if partition_method_automatic_disk_error_label.get_visible() {
//
}));
partition_method_automatic_luks_password_confirm_entry.connect_changed(clone!(@weak partition_method_automatic_luks_error2_label,@weak partition_method_automatic_luks_checkbutton, @weak partition_method_automatic_luks_password_confirm_entry, @weak partition_method_automatic_luks_password_entry, @weak partition_method_automatic_disk_error_label, @weak partition_method_automatic_luks_error_label, @weak bottom_next_button, @weak partition_method_automatic_target_buffer, @weak partition_method_automatic_luks_buffer => move |_| {
if partition_method_automatic_luks_checkbutton.is_active() == true {
partition_method_automatic_luks_password_entry.set_sensitive(true);
if partition_method_automatic_luks_password_entry.text() != partition_method_automatic_luks_password_confirm_entry.text() {
partition_method_automatic_luks_error2_label.set_visible(true)
} else {
partition_method_automatic_luks_error2_label.set_visible(false)
}
if partition_method_automatic_luks_password_entry.text().to_string().is_empty() {
partition_method_automatic_luks_error_label.set_visible(true);
bottom_next_button.set_sensitive(false);
} else {
partition_method_automatic_luks_error_label.set_visible(false);
if !partition_method_automatic_disk_error_label.get_visible() && !partition_method_automatic_luks_error_label.get_visible() && !partition_method_automatic_luks_error2_label.get_visible() {
bottom_next_button.set_sensitive(true);
} else {
bottom_next_button.set_sensitive(false);
}
}
} else {
partition_method_automatic_luks_buffer.set_text(&partition_method_automatic_luks_password_entry.text().to_string());
bottom_next_button.set_sensitive(true);
partition_method_automatic_luks_password_entry.set_sensitive(false);
partition_method_automatic_luks_error_label.set_visible(false);
partition_method_automatic_luks_error2_label.set_visible(false);
if !partition_method_automatic_disk_error_label.get_visible() && !partition_method_automatic_luks_error_label.get_visible() && !partition_method_automatic_luks_error2_label.get_visible() {
bottom_next_button.set_sensitive(true);
} else {
bottom_next_button.set_sensitive(false);
}
}
}
}));
}));
partition_method_automatic_luks_listbox.append(&partition_method_automatic_luks_password_entry);
partition_method_automatic_luks_listbox
.append(&partition_method_automatic_luks_password_confirm_entry);
partition_method_automatic_luks_box.append(&partition_method_automatic_luks_checkbutton);
partition_method_automatic_luks_box.append(&partition_method_automatic_luks_listbox);
partition_method_automatic_header_box.append(&partition_method_automatic_header_text);
@ -270,6 +337,7 @@ pub fn automatic_partitioning(
partition_method_automatic_main_box.append(&devices_selection_expander_row_viewport_listbox);
partition_method_automatic_main_box.append(&partition_method_automatic_luks_box);
partition_method_automatic_main_box.append(&partition_method_automatic_luks_error_label);
partition_method_automatic_main_box.append(&partition_method_automatic_luks_error2_label);
partition_method_automatic_main_box.append(&partition_method_automatic_disk_error_label);
partitioning_stack.add_titled(

View File

@ -6,7 +6,7 @@ use glib::*;
/// Use all libadwaita libraries (libadwaita -> adw because cargo)
use gtk::*;
use gettextrs::{gettext};
use gettextrs::gettext;
use std::path::Path;
@ -128,7 +128,11 @@ pub fn build_ui(app: &adw::Application) {
partitioning_page(&done_main_box, &install_main_box, &content_stack, &window);
//// Add the install_main_box as page: install_page, Give it nice title
content_stack.add_titled(&install_main_box, Some("install_page"), &gettext("installation"));
content_stack.add_titled(
&install_main_box,
Some("install_page"),
&gettext("installation"),
);
// Add done_page.rs as a page for content_stack
content_stack.add_titled(&done_main_box, Some("done_page"), &gettext("done"));

View File

@ -6,16 +6,13 @@ use glib::*;
/// Use all libadwaita libraries (libadwaita -> adw because cargo)
use gtk::*;
use crate::config::{DISTRO_ICON};
use gettextrs::{gettext};
use crate::config::DISTRO_ICON;
use gettextrs::gettext;
use std::path::Path;
use std::process::Command;
pub fn done_page(
done_main_box: &gtk::Box,
window: &adw::ApplicationWindow,
) {
pub fn done_page(done_main_box: &gtk::Box, window: &adw::ApplicationWindow) {
// the header box for the installation_successful page
let done_header_box = gtk::Box::builder()
.orientation(Orientation::Horizontal)

View File

@ -1,14 +1,10 @@
use std::{
cell::{RefCell},
rc::Rc,
sync::OnceLock,
};
use std::{cell::RefCell, rc::Rc, sync::OnceLock};
use adw::{prelude::*, subclass::prelude::*, *};
use glib::{clone, subclass::Signal, Properties};
use gtk::{glib, Orientation::Horizontal};
use gettextrs::{gettext};
use gettextrs::gettext;
// ANCHOR: custom_button
// Object holding the state

View File

@ -6,7 +6,7 @@ use glib::*;
/// Use all libadwaita libraries (libadwaita -> adw because cargo)
use gtk::*;
use gettextrs::{gettext};
use gettextrs::gettext;
pub fn efi_error_page(window: &adw::ApplicationWindow, content_stack: &gtk::Stack) {
// the header box for the efi_error page

View File

@ -6,7 +6,7 @@ use glib::*;
/// Use all libadwaita libraries (libadwaita -> adw because cargo)
use gtk::*;
use gettextrs::{gettext};
use gettextrs::gettext;
pub fn eula_page(content_stack: &gtk::Stack) {
// create the bottom box for next and back buttons

View File

@ -10,7 +10,7 @@ use gtk::*;
use vte::prelude::*;
use vte::*;
use gettextrs::{gettext};
use gettextrs::gettext;
use crate::done_page::done_page;
@ -21,8 +21,8 @@ use std::path::Path;
use std::rc::Rc;
use crate::manual_partitioning::DriveMount;
use serde::*;
use duct::*;
use serde::*;
#[derive(PartialEq, Debug, Eq, Hash, Clone, Serialize, Deserialize)]
struct CrypttabEntry {
@ -40,7 +40,9 @@ pub fn install_page(
let mut _iter_count = 0;
_iter_count = 0;
let mut unlocked_array: Vec<String> = Default::default();
manual_drive_mount_array.borrow_mut().sort_by_key(|p| p.clone().mountpoint);
manual_drive_mount_array
.borrow_mut()
.sort_by_key(|p| p.clone().mountpoint);
for partitions in manual_drive_mount_array.borrow_mut().iter() {
let new_crypt = if partitions.mountpoint != "/"
&& !unlocked_array.contains(&partitions.partition)
@ -78,8 +80,7 @@ pub fn install_page(
)
.build();
crypttab_dialog.add_response("crypttab_dialog_boot", &gettext("unlock_boot_manually"));
crypttab_dialog
.add_response("crypttab_dialog_auto", &gettext("unlock_boot_manual"));
crypttab_dialog.add_response("crypttab_dialog_auto", &gettext("unlock_boot_manual"));
crypttab_dialog.set_response_enabled("crypttab_dialog_auto", false);
crypttab_password.connect_apply(clone!(@weak crypttab_password, @strong partitions, @weak crypttab_dialog => move |_| {
let (luks_manual_password_sender, luks_manual_password_receiver) = async_channel::unbounded();
@ -269,14 +270,15 @@ pub fn install_page(
"/dev/".to_owned()
+ &partitions.partition
+ &gettext("mounted_on_detail")
+ &partitions.mountpoint
+ &partitions.mountpoint,
)
.build();
install_confirm_details_boxed_list.append(&confirm_row);
}
} else {
let install_confirm_detail_target =
adw::ActionRow::builder().title(gettext("install_target_detail")).build();
let install_confirm_detail_target = adw::ActionRow::builder()
.title(gettext("install_target_detail"))
.build();
install_confirm_detail_target.set_subtitle(
&fs::read_to_string("/tmp/pika-installer-gtk4-target-auto.txt")
.expect("Unable to read file"),
@ -338,7 +340,8 @@ pub fn install_page(
} else {
_p1_row_text =
"512 MB ".to_owned() + target_block_device + "1" + " as fat32" + " on /boot/efi";
_p2_row_text = "1 GB ".to_owned() + target_block_device + "2" + " as ext4" + " on /boot";
_p2_row_text =
"1 GB ".to_owned() + target_block_device + "2" + " as ext4" + " on /boot";
_p3_row_text = pretty_bytes::converter::convert(_target_p3_size)
+ " "
+ target_block_device
@ -352,10 +355,18 @@ pub fn install_page(
+ " as btrfs"
+ " on /home";
}
let install_confirm_p1 = adw::ActionRow::builder().title(_p1_row_text.clone()).build();
let install_confirm_p2 = adw::ActionRow::builder().title(_p2_row_text.clone()).build();
let install_confirm_p3 = adw::ActionRow::builder().title(_p3_row_text.clone()).build();
let install_confirm_p4 = adw::ActionRow::builder().title(_p4_row_text.clone()).build();
let install_confirm_p1 = adw::ActionRow::builder()
.title(_p1_row_text.clone())
.build();
let install_confirm_p2 = adw::ActionRow::builder()
.title(_p2_row_text.clone())
.build();
let install_confirm_p3 = adw::ActionRow::builder()
.title(_p3_row_text.clone())
.build();
let install_confirm_p4 = adw::ActionRow::builder()
.title(_p4_row_text.clone())
.build();
// / install_confirm_selection_box appends
//// add live and install media button to install page selections
install_confirm_details_boxed_list.append(&install_confirm_detail_language);

View File

@ -6,7 +6,7 @@ use glib::*;
/// Use all libadwaita libraries (libadwaita -> adw because cargo)
use gtk::*;
use gettextrs::{gettext};
use gettextrs::gettext;
use std::io::BufRead;
use std::io::BufReader;
@ -242,7 +242,11 @@ pub fn keyboard_page(content_stack: &gtk::Stack) {
// / Content stack appends
//// Add the keyboard_main_box as page: keyboard_page, Give it nice title
content_stack.add_titled(&keyboard_main_box, Some("keyboard_page"), &gettext("keyboard"));
content_stack.add_titled(
&keyboard_main_box,
Some("keyboard_page"),
&gettext("keyboard"),
);
let keyboard_data_buffer_clone = keyboard_data_buffer.clone();

View File

@ -8,8 +8,8 @@ use gdk::Display;
use gtk::*;
mod config;
use config::{APP_ID, GETTEXT_PACKAGE, LOCALEDIR};
use gettextrs::{gettext, LocaleCategory};
use config::{GETTEXT_PACKAGE, LOCALEDIR, APP_ID};
mod automatic_partitioning;
mod build_ui;
@ -28,10 +28,7 @@ mod welcome_page;
/// main function
fn main() {
let application = adw::Application::new(
Some(APP_ID),
Default::default(),
);
let application = adw::Application::new(Some(APP_ID), Default::default());
application.connect_startup(|app| {
// The CSS "magic" happens here.
let provider = CssProvider::new();
@ -45,7 +42,8 @@ fn main() {
);
// Prepare i18n
gettextrs::setlocale(LocaleCategory::LcAll, "");
gettextrs::bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR).expect("Unable to bind the text domain");
gettextrs::bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR)
.expect("Unable to bind the text domain");
gettextrs::textdomain(GETTEXT_PACKAGE).expect("Unable to switch to the text domain");
// Fallback if no translation present
if gettext("pikaos_installer") == "pikaos_installer" {
@ -57,4 +55,4 @@ fn main() {
});
application.run();
}
}

View File

@ -7,19 +7,18 @@ use glib::*;
use gtk::*;
use std::thread;
use gettextrs::{gettext};
use gettextrs::gettext;
use std::cell::{RefCell};
use std::cell::RefCell;
use std::rc::Rc;
use duct::cmd;
use std::{
collections::HashSet,
hash::Hash,
io::{BufRead, BufReader},
process::{Command},
time::{Duration},
process::Command,
time::Duration,
};
use crate::drive_mount_row::DriveMountRow;
@ -132,7 +131,7 @@ pub fn manual_partitioning(
partitioning_stack: &gtk::Stack,
bottom_next_button: &gtk::Button,
manual_drive_mount_array: &Rc<RefCell<Vec<DriveMount>>>,
) {
) -> gtk::Button {
let part_table_array: Rc<RefCell<Vec<String>>> = Default::default();
let check_part_unique = Rc::new(RefCell::new(true));
@ -216,14 +215,14 @@ pub fn manual_partitioning(
.build();
let partition_method_manual_selection_text = gtk::Label::builder()
.label(gettext("manual_part_note"))
.halign(gtk::Align::Center)
.hexpand(true)
.margin_top(15)
.margin_bottom(15)
.margin_start(15)
.margin_end(15)
.build();
.label(gettext("manual_part_note"))
.halign(gtk::Align::Center)
.hexpand(true)
.margin_top(15)
.margin_bottom(15)
.margin_start(15)
.margin_end(15)
.build();
partition_method_manual_selection_text.add_css_class("medium_sized_text");
let partition_refresh_button = gtk::Button::builder()
@ -257,7 +256,6 @@ pub fn manual_partitioning(
.valign(Align::End)
.vexpand(true)
.visible(false)
.label(gettext("fstab_status_valid"))
.build();
partition_method_manual_valid_label.add_css_class("small_valid_text");
@ -291,7 +289,12 @@ pub fn manual_partitioning(
partition_err_check(&partition_method_manual_error_label, &partition_method_manual_valid_label, &manual_drive_mount_array);
}));
partition_refresh_button.connect_clicked(clone!(@weak drive_mounts_adw_listbox,@strong part_table_array, @strong manual_drive_mount_array => move |_| {
partition_refresh_button.connect_clicked(clone!(@weak partition_method_manual_error_label, @weak partition_method_manual_valid_label,@weak drive_mounts_adw_listbox,@strong part_table_array, @strong manual_drive_mount_array => move |_| {
partition_method_manual_error_label.set_label("");
partition_method_manual_error_label.set_widget_name("");
partition_method_manual_error_label.set_visible(false);
partition_method_manual_valid_label.set_label("");
partition_method_manual_valid_label.set_visible(false);
while let Some(row) = drive_mounts_adw_listbox.last_child() {
if row.widget_name() == "DriveMountRow" {
drive_mounts_adw_listbox.remove(&row);
@ -423,7 +426,7 @@ pub fn manual_partitioning(
"partition_method_manual_page",
);
//return(partition_method_manual_target_buffer, partition_method_manual_luks_buffer, partition_method_manual_luks_password_entry)
return partition_refresh_button;
}
fn partition_err_check(
@ -459,9 +462,7 @@ fn partition_err_check(
}
if empty_mountpoint == false {
if &partition_method_manual_error_label.widget_name()
== "err1"
{
if &partition_method_manual_error_label.widget_name() == "err1" {
partition_method_manual_error_label.set_visible(false);
}
if manual_drive_mount_array_ref.len()
@ -485,8 +486,7 @@ fn partition_err_check(
}
} else {
if !partition_method_manual_error_label.is_visible() {
partition_method_manual_error_label
.set_label(&gettext("fstab_no_mountpoint_err"));
partition_method_manual_error_label.set_label(&gettext("fstab_no_mountpoint_err"));
partition_method_manual_error_label.set_widget_name("err1");
partition_method_manual_error_label.set_visible(true);
}
@ -494,14 +494,12 @@ fn partition_err_check(
if empty_partition == true {
if !partition_method_manual_error_label.is_visible() {
partition_method_manual_error_label
.set_label(&gettext("fstab_no_partition_err"));
partition_method_manual_error_label.set_label(&gettext("fstab_no_partition_err"));
partition_method_manual_error_label.set_widget_name("err2");
partition_method_manual_error_label.set_visible(true);
}
} else {
if partition_method_manual_error_label.widget_name() == "err2"
{
if partition_method_manual_error_label.widget_name() == "err2" {
partition_method_manual_error_label.set_visible(false);
}
}
@ -614,7 +612,11 @@ fn partition_err_check(
partition_method_manual_error_label.set_visible(false);
}
}
if partition_fs == "vfat" || partition_fs == "ntfs" || partition_fs == "swap" || partition_fs == "exfat" {
if partition_fs == "vfat"
|| partition_fs == "ntfs"
|| partition_fs == "swap"
|| partition_fs == "exfat"
{
if !partition_method_manual_error_label.is_visible() {
partition_method_manual_error_label.set_label(
&(gettext("fstab_badfs")
@ -646,7 +648,11 @@ fn partition_err_check(
partition_method_manual_error_label.set_visible(false);
}
}
if partition_fs == "vfat" || partition_fs == "ntfs" || partition_fs == "swap" || partition_fs == "exfat" {
if partition_fs == "vfat"
|| partition_fs == "ntfs"
|| partition_fs == "swap"
|| partition_fs == "exfat"
{
if !partition_method_manual_error_label.is_visible() {
partition_method_manual_error_label.set_label(
&(gettext("fstab_badfs")
@ -699,6 +705,7 @@ fn partition_err_check(
}
}
if !partition_method_manual_error_label.is_visible() {
partition_method_manual_valid_label.set_label(&gettext("fstab_status_valid"));
partition_method_manual_valid_label.set_visible(true)
} else {
partition_method_manual_valid_label.set_visible(false)

View File

@ -7,7 +7,7 @@ use glob::glob;
/// Use all libadwaita libraries (libadwaita -> adw because cargo)
use gtk::*;
use gettextrs::{gettext};
use gettextrs::gettext;
use crate::automatic_partitioning::automatic_partitioning;
use crate::install_page::install_page;
@ -21,7 +21,7 @@ use std::rc::Rc;
use duct::*;
use crate::{manual_partitioning};
use crate::manual_partitioning;
use manual_partitioning::DriveMount;
@ -216,7 +216,7 @@ pub fn partitioning_page(
);
let partitioning_page_automatic_partitioning =
automatic_partitioning(&partitioning_stack, &bottom_next_button);
let _partitioning_page_manual_partitioning = manual_partitioning(
let partitioning_page_manual_partitioning = manual_partitioning(
&partitioning_stack,
&bottom_next_button,
&manual_drive_mount_array,
@ -250,6 +250,7 @@ pub fn partitioning_page(
content_stack.set_visible_child_name("keyboard_page");
partitioning_stack.set_visible_child_name("partition_method_select_page");
bottom_next_button.set_sensitive(false);
partitioning_page_manual_partitioning.emit_clicked();
}));
bottom_next_button.connect_clicked(clone!(@weak content_stack, @weak partitioning_stack, @weak install_main_box, @weak window, @weak done_main_box => move |_| {

View File

@ -6,7 +6,7 @@ use glib::*;
/// Use all libadwaita libraries (libadwaita -> adw because cargo)
use gtk::*;
use gettextrs::{gettext};
use gettextrs::gettext;
use std::io::BufRead;
use std::io::BufReader;
@ -213,7 +213,11 @@ pub fn timezone_page(content_stack: &gtk::Stack) {
// / Content stack appends
//// Add the timezone_main_box as page: timezone_page, Give it nice title
content_stack.add_titled(&timezone_main_box, Some("timezone_page"), &gettext("timezone"));
content_stack.add_titled(
&timezone_main_box,
Some("timezone_page"),
&gettext("timezone"),
);
let timezone_data_buffer_clone = timezone_data_buffer.clone();

View File

@ -7,7 +7,7 @@ use glib::*;
/// Use all libadwaita libraries (libadwaita -> adw because cargo)
use gtk::*;
use gettextrs::{gettext};
use gettextrs::gettext;
pub fn welcome_page(window: &adw::ApplicationWindow, content_stack: &gtk::Stack) {
// the header box for the welcome page