begin terminal page
This commit is contained in:
parent
8e34fd3bcf
commit
8741225d1b
@ -27,7 +27,7 @@
|
|||||||
"keyboard_page_title": "Keyboard",
|
"keyboard_page_title": "Keyboard",
|
||||||
"crypttab_dialog_response_crypttab_dialog_boot": "Unlock on Boot Manually",
|
"crypttab_dialog_response_crypttab_dialog_boot": "Unlock on Boot Manually",
|
||||||
"crypttab_dialog_response_crypttab_dialog_auto": "Unlock Automatically with Root Unlock",
|
"crypttab_dialog_response_crypttab_dialog_auto": "Unlock Automatically with Root Unlock",
|
||||||
"view_logs": "View Logs",
|
"progress_log_button_content_tooltip": "View Logs",
|
||||||
"parting_status_text": "Partitioning The Target Drives.",
|
"parting_status_text": "Partitioning The Target Drives.",
|
||||||
"image_status_text": "Writing Image to target.",
|
"image_status_text": "Writing Image to target.",
|
||||||
"flag1_status_text": "Enabling BLS_BOOT flag on /boot.",
|
"flag1_status_text": "Enabling BLS_BOOT flag on /boot.",
|
||||||
|
@ -193,5 +193,7 @@ pub fn build_ui(app: &adw::Application) {
|
|||||||
&partition_method_manual_crypttab_entry_array_refcell,
|
&partition_method_manual_crypttab_entry_array_refcell,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
installation_progress_page::installation_progress_page(&carousel, &language_changed_action);
|
||||||
|
|
||||||
window.present()
|
window.present()
|
||||||
}
|
}
|
||||||
|
@ -1,436 +1,121 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
build_ui::{BlockDevice, CrypttabEntry, FstabEntry, PikaKeymap, PikaLocale},
|
build_ui::{BlockDevice, CrypttabEntry, FstabEntry, PikaKeymap, PikaLocale},
|
||||||
config::{MINIMUM_BOOT_BYTE_SIZE, MINIMUM_EFI_BYTE_SIZE},
|
config::{MINIMUM_BOOT_BYTE_SIZE, MINIMUM_EFI_BYTE_SIZE, DISTRO_ICON},
|
||||||
installer_stack_page,
|
installer_stack_page,
|
||||||
|
installation_progress_page,
|
||||||
};
|
};
|
||||||
use adw::prelude::*;
|
use adw::prelude::*;
|
||||||
use glib::{clone, closure_local};
|
use glib::{clone, closure_local, GString};
|
||||||
use gtk::{gio, glib};
|
use gtk::{gio, glib};
|
||||||
use std::{cell::RefCell, fs, ops::Deref, path::Path, process::Command, rc::Rc};
|
use std::{cell::RefCell, fs, ops::Deref, path::Path, process::Command, rc::Rc};
|
||||||
|
|
||||||
mod auto_basic;
|
/// DEBUG
|
||||||
mod auto_btrfs;
|
use std::io::{self, Write};
|
||||||
mod auto_ext4;
|
use duct::cmd;
|
||||||
mod auto_xfs;
|
/// DEBUG END
|
||||||
mod manual_basic;
|
|
||||||
|
|
||||||
pub const standard_installation_prog: &str = r###"#! /bin/bash
|
pub fn installation_progress_page(
|
||||||
set -e
|
main_carousel: &adw::Carousel,
|
||||||
|
language_changed_action: &gio::SimpleAction,
|
||||||
|
) {
|
||||||
|
let installation_progress_box = gtk::Box::builder()
|
||||||
|
.orientation(gtk::Orientation::Vertical)
|
||||||
|
.build();
|
||||||
|
|
||||||
SOCKET_PATH="/tmp/pikainstall-status.sock"
|
let installation_progress_log_stack = gtk::Stack::builder()
|
||||||
|
.transition_type(gtk::StackTransitionType::SlideUpDown)
|
||||||
|
.margin_start(15)
|
||||||
|
.margin_end(15)
|
||||||
|
.build();
|
||||||
|
|
||||||
rm -rf /tmp/pika-installer-gtk4-swaplist
|
let installation_progress_log_terminal_buffer = gtk::TextBuffer::builder().build();
|
||||||
rm -rf /tmp/PIKA_CRYPT
|
|
||||||
|
|
||||||
PIKA_INSTALL_CHROOT_PATH='{CHROOT_PATH}'
|
let installation_progress_log_terminal = gtk::TextView::builder()
|
||||||
PIKA_INSTALL_LOCALE='{LOCALE}.UTF-8'
|
.vexpand(true)
|
||||||
PIKA_INSTALL_KEYMAP_BASE='{KEYMAP_BASE}'
|
.hexpand(true)
|
||||||
PIKA_INSTALL_KEYMAP_VARIANT='{KEYMAP_VARIANT}'
|
.editable(false)
|
||||||
PIKA_INSTALL_TIMEZONE='{TIMEZONE}'
|
.buffer(&installation_progress_log_terminal_buffer)
|
||||||
"###;
|
.build();
|
||||||
|
|
||||||
pub fn create_installation_script(
|
let placeholder_icon = gtk::Image::builder()
|
||||||
language_selection_text_refcell: &Rc<RefCell<PikaLocale>>,
|
.icon_name(DISTRO_ICON)
|
||||||
keymap_selection_text_refcell: &Rc<RefCell<PikaKeymap>>,
|
.halign(gtk::Align::Center)
|
||||||
timezone_selection_text_refcell: &Rc<RefCell<String>>,
|
.valign(gtk::Align::Center)
|
||||||
partition_method_type_refcell: &Rc<RefCell<String>>,
|
.hexpand(true)
|
||||||
partition_method_automatic_target_refcell: &Rc<RefCell<BlockDevice>>,
|
.vexpand(true)
|
||||||
partition_method_automatic_target_fs_refcell: &Rc<RefCell<String>>,
|
.pixel_size(256)
|
||||||
partition_method_automatic_luks_enabled_refcell: &Rc<RefCell<bool>>,
|
.margin_top(5)
|
||||||
partition_method_automatic_luks_refcell: &Rc<RefCell<String>>,
|
.margin_bottom(5)
|
||||||
partition_method_automatic_ratio_refcell: &Rc<RefCell<f64>>,
|
.margin_start(5)
|
||||||
partition_method_automatic_seperation_refcell: &Rc<RefCell<String>>,
|
.margin_end(5)
|
||||||
partition_method_manual_fstab_entry_array_refcell: &Rc<RefCell<Vec<FstabEntry>>>,
|
.build();
|
||||||
partition_method_manual_luks_enabled_refcell: &Rc<RefCell<bool>>,
|
|
||||||
partition_method_manual_crypttab_entry_array_refcell: &Rc<RefCell<Vec<CrypttabEntry>>>,
|
|
||||||
) -> String {
|
|
||||||
let mut final_script = String::new();
|
|
||||||
|
|
||||||
let variant = match keymap_selection_text_refcell.borrow().clone().variant {
|
let progress_bar_box = gtk::Box::builder()
|
||||||
Some(t) => {
|
.orientation(gtk::Orientation::Horizontal)
|
||||||
t.replace("'", r###"'"'"'"###)
|
.margin_start(10)
|
||||||
}
|
.margin_end(15)
|
||||||
None => "".to_string(),
|
.build();
|
||||||
};
|
|
||||||
|
|
||||||
let standard_installation_format = strfmt::strfmt(
|
let installation_progress_bar = gtk::ProgressBar::builder()
|
||||||
standard_installation_prog,
|
.hexpand(true)
|
||||||
&std::collections::HashMap::from([
|
.margin_end(5)
|
||||||
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
|
.margin_top(5)
|
||||||
(
|
.margin_bottom(5)
|
||||||
"LOCALE".to_string(),
|
.show_text(true)
|
||||||
language_selection_text_refcell.borrow().name.replace("'", r###"'"'"'"###).as_str(),
|
.build();
|
||||||
),
|
installation_progress_bar.add_css_class("small_fg_text");
|
||||||
(
|
|
||||||
"KEYMAP_BASE".to_string(),
|
|
||||||
keymap_selection_text_refcell.borrow().name.replace("'", r###"'"'"'"###).as_str(),
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"KEYMAP_VARIANT".to_string(),
|
|
||||||
variant.as_str()
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"TIMEZONE".to_string(),
|
|
||||||
timezone_selection_text_refcell.borrow().replace("'", r###"'"'"'"###).as_str(),
|
|
||||||
),
|
|
||||||
]),
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
final_script.push_str(&standard_installation_format);
|
let progress_log_button = gtk::Button::builder()
|
||||||
|
.icon_name("terminal-symbolic")
|
||||||
|
.halign(gtk::Align::End)
|
||||||
|
.margin_start(5)
|
||||||
|
.margin_top(5)
|
||||||
|
.margin_bottom(5)
|
||||||
|
.build();
|
||||||
|
|
||||||
match &*partition_method_type_refcell.borrow().as_str() {
|
progress_bar_box.append(&installation_progress_bar);
|
||||||
"automatic" => {
|
progress_bar_box.append(&progress_log_button);
|
||||||
let is_encrypted = *partition_method_automatic_luks_enabled_refcell.borrow();
|
|
||||||
//
|
|
||||||
let automatic_standard_installation_format = strfmt::strfmt(
|
|
||||||
auto_basic::automatic_standard_installation_prog,
|
|
||||||
&std::collections::HashMap::from([
|
|
||||||
(
|
|
||||||
"AUTO_INSTALL_TARGET_DISK".to_string(),
|
|
||||||
partition_method_automatic_target_refcell.borrow().block_name.replace("'", r###"'"'"'"###).as_str(),
|
|
||||||
),
|
|
||||||
]),
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
final_script.push_str(&automatic_standard_installation_format);
|
installation_progress_log_stack.add_titled(
|
||||||
|
&placeholder_icon,
|
||||||
//
|
Some("slideshow_page"),
|
||||||
match &*partition_method_automatic_target_fs_refcell.borrow().as_str().to_lowercase() {
|
"slideshow_page",
|
||||||
"btrfs" => {
|
);
|
||||||
match &*partition_method_automatic_seperation_refcell.borrow().as_str() {
|
installation_progress_log_stack.add_titled(
|
||||||
"subvol" => {
|
&installation_progress_log_terminal,
|
||||||
if is_encrypted {
|
Some("terminal_log_page"),
|
||||||
final_script.push_str(&strfmt::strfmt(
|
"terminal_log_page",
|
||||||
auto_btrfs::automatic_home_subvol_btrfs_locked_installation_prog,
|
|
||||||
&std::collections::HashMap::from([
|
|
||||||
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
|
|
||||||
(
|
|
||||||
"AUTO_LUKS_PASSWORD".to_string(),
|
|
||||||
partition_method_automatic_luks_refcell.borrow().replace("'", r###"'"'"'"###).as_str(),
|
|
||||||
)
|
|
||||||
]),
|
|
||||||
)
|
|
||||||
.unwrap());
|
|
||||||
} else {
|
|
||||||
final_script.push_str(&strfmt::strfmt(
|
|
||||||
auto_btrfs::automatic_home_subvol_btrfs_open_installation_prog,
|
|
||||||
&std::collections::HashMap::from([
|
|
||||||
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
|
|
||||||
]),
|
|
||||||
)
|
|
||||||
.unwrap());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"partition" => {
|
|
||||||
if is_encrypted {
|
|
||||||
final_script.push_str(&strfmt::strfmt(
|
|
||||||
auto_btrfs::automatic_home_part_btrfs_locked_installation_prog,
|
|
||||||
&std::collections::HashMap::from([
|
|
||||||
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
|
|
||||||
(
|
|
||||||
"AUTO_LUKS_PASSWORD".to_string(),
|
|
||||||
partition_method_automatic_luks_refcell.borrow().replace("'", r###"'"'"'"###).as_str(),
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"ROOT_PART_SIZE_AS_I64_MIB".to_string(),
|
|
||||||
(partition_method_automatic_ratio_refcell.borrow().round() as i64 / 1048576).to_string().replace("'", r###"'"'"'"###).as_str(),
|
|
||||||
)
|
|
||||||
]),
|
|
||||||
)
|
|
||||||
.unwrap());
|
|
||||||
} else {
|
|
||||||
final_script.push_str(&strfmt::strfmt(
|
|
||||||
auto_btrfs::automatic_home_part_btrfs_open_installation_prog,
|
|
||||||
&std::collections::HashMap::from([
|
|
||||||
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
|
|
||||||
(
|
|
||||||
"ROOT_PART_SIZE_AS_I64_MIB".to_string(),
|
|
||||||
(partition_method_automatic_ratio_refcell.borrow().round() as i64 / 1048576).to_string().replace("'", r###"'"'"'"###).as_str(),
|
|
||||||
)
|
|
||||||
]),
|
|
||||||
)
|
|
||||||
.unwrap());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"none" => {
|
|
||||||
if is_encrypted {
|
|
||||||
final_script.push_str(&strfmt::strfmt(
|
|
||||||
auto_btrfs::automatic_home_none_btrfs_locked_installation_prog,
|
|
||||||
&std::collections::HashMap::from([
|
|
||||||
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
|
|
||||||
(
|
|
||||||
"AUTO_LUKS_PASSWORD".to_string(),
|
|
||||||
partition_method_automatic_luks_refcell.borrow().replace("'", r###"'"'"'"###).as_str(),
|
|
||||||
)
|
|
||||||
]),
|
|
||||||
)
|
|
||||||
.unwrap());
|
|
||||||
} else {
|
|
||||||
final_script.push_str(&strfmt::strfmt(
|
|
||||||
auto_btrfs::automatic_home_none_btrfs_open_installation_prog,
|
|
||||||
&std::collections::HashMap::from([
|
|
||||||
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
|
|
||||||
]),
|
|
||||||
)
|
|
||||||
.unwrap());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => panic!()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"ext4" => {
|
|
||||||
match &*partition_method_automatic_seperation_refcell.borrow().as_str() {
|
|
||||||
"partition" => {
|
|
||||||
if is_encrypted {
|
|
||||||
final_script.push_str(&strfmt::strfmt(
|
|
||||||
auto_ext4::automatic_home_part_ext4_locked_installation_prog,
|
|
||||||
&std::collections::HashMap::from([
|
|
||||||
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
|
|
||||||
(
|
|
||||||
"AUTO_LUKS_PASSWORD".to_string(),
|
|
||||||
partition_method_automatic_luks_refcell.borrow().replace("'", r###"'"'"'"###).as_str(),
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"ROOT_PART_SIZE_AS_I64_MIB".to_string(),
|
|
||||||
(partition_method_automatic_ratio_refcell.borrow().round() as i64 / 1048576).to_string().replace("'", r###"'"'"'"###).as_str(),
|
|
||||||
)
|
|
||||||
]),
|
|
||||||
)
|
|
||||||
.unwrap());
|
|
||||||
} else {
|
|
||||||
final_script.push_str(&strfmt::strfmt(
|
|
||||||
auto_ext4::automatic_home_part_ext4_open_installation_prog,
|
|
||||||
&std::collections::HashMap::from([
|
|
||||||
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
|
|
||||||
(
|
|
||||||
"ROOT_PART_SIZE_AS_I64_MIB".to_string(),
|
|
||||||
(partition_method_automatic_ratio_refcell.borrow().round() as i64 / 1048576).to_string().replace("'", r###"'"'"'"###).as_str(),
|
|
||||||
)
|
|
||||||
]),
|
|
||||||
)
|
|
||||||
.unwrap());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"none" => {
|
|
||||||
if is_encrypted {
|
|
||||||
final_script.push_str(&strfmt::strfmt(
|
|
||||||
auto_ext4::automatic_home_none_ext4_locked_installation_prog,
|
|
||||||
&std::collections::HashMap::from([
|
|
||||||
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
|
|
||||||
(
|
|
||||||
"AUTO_LUKS_PASSWORD".to_string(),
|
|
||||||
partition_method_automatic_luks_refcell.borrow().replace("'", r###"'"'"'"###).as_str(),
|
|
||||||
)
|
|
||||||
]),
|
|
||||||
)
|
|
||||||
.unwrap());
|
|
||||||
} else {
|
|
||||||
final_script.push_str(&strfmt::strfmt(
|
|
||||||
auto_ext4::automatic_home_none_ext4_open_installation_prog,
|
|
||||||
&std::collections::HashMap::from([
|
|
||||||
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
|
|
||||||
]),
|
|
||||||
)
|
|
||||||
.unwrap());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => panic!()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"xfs" => {
|
|
||||||
match &*partition_method_automatic_seperation_refcell.borrow().as_str() {
|
|
||||||
"partition" => {
|
|
||||||
if is_encrypted {
|
|
||||||
final_script.push_str(&strfmt::strfmt(
|
|
||||||
auto_xfs::automatic_home_part_xfs_locked_installation_prog,
|
|
||||||
&std::collections::HashMap::from([
|
|
||||||
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
|
|
||||||
(
|
|
||||||
"AUTO_LUKS_PASSWORD".to_string(),
|
|
||||||
partition_method_automatic_luks_refcell.borrow().replace("'", r###"'"'"'"###).as_str(),
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"ROOT_PART_SIZE_AS_I64_MIB".to_string(),
|
|
||||||
(partition_method_automatic_ratio_refcell.borrow().round() as i64 / 1048576).to_string().replace("'", r###"'"'"'"###).as_str(),
|
|
||||||
)
|
|
||||||
]),
|
|
||||||
)
|
|
||||||
.unwrap());
|
|
||||||
} else {
|
|
||||||
final_script.push_str(&strfmt::strfmt(
|
|
||||||
auto_xfs::automatic_home_part_xfs_open_installation_prog,
|
|
||||||
&std::collections::HashMap::from([
|
|
||||||
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
|
|
||||||
(
|
|
||||||
"ROOT_PART_SIZE_AS_I64_MIB".to_string(),
|
|
||||||
(partition_method_automatic_ratio_refcell.borrow().round() as i64 / 1048576).to_string().replace("'", r###"'"'"'"###).as_str(),
|
|
||||||
)
|
|
||||||
]),
|
|
||||||
)
|
|
||||||
.unwrap());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"none" => {
|
|
||||||
if is_encrypted {
|
|
||||||
final_script.push_str(&strfmt::strfmt(
|
|
||||||
auto_xfs::automatic_home_none_xfs_locked_installation_prog,
|
|
||||||
&std::collections::HashMap::from([
|
|
||||||
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
|
|
||||||
(
|
|
||||||
"AUTO_LUKS_PASSWORD".to_string(),
|
|
||||||
partition_method_automatic_luks_refcell.borrow().replace("'", r###"'"'"'"###).as_str(),
|
|
||||||
)
|
|
||||||
]),
|
|
||||||
)
|
|
||||||
.unwrap());
|
|
||||||
} else {
|
|
||||||
final_script.push_str(&strfmt::strfmt(
|
|
||||||
auto_xfs::automatic_home_none_xfs_open_installation_prog,
|
|
||||||
&std::collections::HashMap::from([
|
|
||||||
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
|
|
||||||
]),
|
|
||||||
)
|
|
||||||
.unwrap());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => panic!()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => panic!()
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if is_encrypted {
|
|
||||||
final_script.push_str(auto_basic::automatic_locked_part_pikainstall_prog);
|
|
||||||
} else {
|
|
||||||
final_script.push_str(auto_basic::automatic_open_part_pikainstall_prog);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"manual" => {
|
|
||||||
let is_encrypted = *partition_method_manual_luks_enabled_refcell.borrow();
|
|
||||||
|
|
||||||
if is_encrypted {
|
|
||||||
final_script.push_str(
|
|
||||||
r###"
|
|
||||||
|
|
||||||
mkdir -p /tmp/PIKA_CRYPT/
|
|
||||||
touch /tmp/PIKA_CRYPT/crypttab
|
|
||||||
|
|
||||||
"###
|
|
||||||
);
|
);
|
||||||
|
|
||||||
for crypt_entry in partition_method_manual_crypttab_entry_array_refcell.borrow().iter() {
|
installation_progress_box.append(&installation_progress_log_stack);
|
||||||
match &crypt_entry.password {
|
installation_progress_box.append(&progress_bar_box);
|
||||||
Some(p) => {
|
|
||||||
final_script.push_str(&strfmt::strfmt(
|
//
|
||||||
manual_basic::manual_crypt_entry_with_keyfile,
|
|
||||||
&std::collections::HashMap::from([
|
progress_log_button.connect_clicked(
|
||||||
(
|
clone!(
|
||||||
"MAP".to_string(),
|
#[weak]
|
||||||
crypt_entry.map.replace("'", r###"'"'"'"###).as_str()
|
installation_progress_log_stack,
|
||||||
),
|
move |_|
|
||||||
(
|
{
|
||||||
"UUID".to_string(),
|
if installation_progress_log_stack.visible_child_name() == Some(GString::from_string_unchecked("slideshow_page".into())) {
|
||||||
crypt_entry.uuid.replace("'", r###"'"'"'"###).as_str()
|
installation_progress_log_stack.set_visible_child_name("terminal_log_page");
|
||||||
),
|
} else {
|
||||||
(
|
installation_progress_log_stack.set_visible_child_name("slideshow_page");
|
||||||
"LUKS_PASSWD".to_string(),
|
|
||||||
p.replace("'", r###"'"'"'"###).as_str()
|
|
||||||
)
|
|
||||||
]),
|
|
||||||
)
|
|
||||||
.unwrap());
|
|
||||||
}
|
|
||||||
None => {
|
|
||||||
final_script.push_str(&strfmt::strfmt(
|
|
||||||
manual_basic::manual_crypt_entry,
|
|
||||||
&std::collections::HashMap::from([
|
|
||||||
(
|
|
||||||
"MAP".to_string(),
|
|
||||||
crypt_entry.map.replace("'", r###"'"'"'"###).as_str()
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"UUID".to_string(),
|
|
||||||
crypt_entry.uuid.replace("'", r###"'"'"'"###).as_str()
|
|
||||||
)
|
|
||||||
]),
|
|
||||||
)
|
|
||||||
.unwrap());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
)
|
||||||
}
|
|
||||||
|
|
||||||
let mut did_make_swap_list = false;
|
|
||||||
|
|
||||||
for fstab_entry in partition_method_manual_fstab_entry_array_refcell.borrow().iter() {
|
|
||||||
if fstab_entry.mountpoint == "[SWAP]" {
|
|
||||||
if !did_make_swap_list {
|
|
||||||
final_script.push_str(
|
|
||||||
r###"
|
|
||||||
|
|
||||||
touch /tmp/pika-installer-gtk4-swaplist
|
|
||||||
|
|
||||||
"###
|
|
||||||
);
|
);
|
||||||
did_make_swap_list = true
|
|
||||||
}
|
|
||||||
final_script.push_str(&strfmt::strfmt(
|
|
||||||
manual_basic::manual_swap_mount_prog,
|
|
||||||
&std::collections::HashMap::from([
|
|
||||||
(
|
|
||||||
"PART".to_string(),
|
|
||||||
fstab_entry.partition.part_name.replace("'", r###"'"'"'"###).as_str()
|
|
||||||
),
|
|
||||||
]),
|
|
||||||
)
|
|
||||||
.unwrap());
|
|
||||||
} else if !fstab_entry.mountopts.is_empty() {
|
|
||||||
final_script.push_str(&strfmt::strfmt(
|
|
||||||
manual_basic::manual_partition_mount_with_opts_prog,
|
|
||||||
&std::collections::HashMap::from([
|
|
||||||
(
|
|
||||||
"PART".to_string(),
|
|
||||||
fstab_entry.partition.part_name.replace("'", r###"'"'"'"###).as_str()
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"MOUNTPOINT".to_string(),
|
|
||||||
fstab_entry.mountpoint.replace("'", r###"'"'"'"###).as_str()
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"OPTS".to_string(),
|
|
||||||
fstab_entry.mountopts.replace("'", r###"'"'"'"###).as_str()
|
|
||||||
),
|
|
||||||
]),
|
|
||||||
)
|
|
||||||
.unwrap());
|
|
||||||
} else {
|
|
||||||
final_script.push_str(&strfmt::strfmt(
|
|
||||||
manual_basic::manual_partition_mount_prog,
|
|
||||||
&std::collections::HashMap::from([
|
|
||||||
(
|
|
||||||
"PART".to_string(),
|
|
||||||
fstab_entry.partition.part_name.replace("'", r###"'"'"'"###).as_str()
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"MOUNTPOINT".to_string(),
|
|
||||||
fstab_entry.mountpoint.replace("'", r###"'"'"'"###).as_str()
|
|
||||||
),
|
|
||||||
]),
|
|
||||||
)
|
|
||||||
.unwrap());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if is_encrypted {
|
//
|
||||||
final_script.push_str(manual_basic::manual_locked_part_pikainstall_prog);
|
|
||||||
} else {
|
|
||||||
final_script.push_str(manual_basic::manual_open_part_pikainstall_prog);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => panic!()
|
|
||||||
}
|
|
||||||
|
|
||||||
final_script
|
language_changed_action.connect_activate(clone!(
|
||||||
|
#[weak]
|
||||||
|
progress_log_button,
|
||||||
|
move |_, _| {
|
||||||
|
progress_log_button.set_tooltip_text(Some(&t!("progress_log_button_content_tooltip")));
|
||||||
|
}
|
||||||
|
));
|
||||||
|
|
||||||
|
main_carousel.append(&installation_progress_box);
|
||||||
}
|
}
|
@ -9,6 +9,8 @@ use glib::{clone, closure_local};
|
|||||||
use gtk::{gio, glib};
|
use gtk::{gio, glib};
|
||||||
use std::{cell::RefCell, fs, ops::Deref, path::Path, process::Command, rc::Rc};
|
use std::{cell::RefCell, fs, ops::Deref, path::Path, process::Command, rc::Rc};
|
||||||
|
|
||||||
|
mod script_gen;
|
||||||
|
|
||||||
/// DEBUG
|
/// DEBUG
|
||||||
use std::io::{self, Write};
|
use std::io::{self, Write};
|
||||||
use duct::cmd;
|
use duct::cmd;
|
||||||
@ -79,6 +81,8 @@ pub fn installation_summary_page(
|
|||||||
//
|
//
|
||||||
|
|
||||||
install_confirm_button.connect_clicked(clone!(
|
install_confirm_button.connect_clicked(clone!(
|
||||||
|
#[weak]
|
||||||
|
main_carousel,
|
||||||
#[strong]
|
#[strong]
|
||||||
language_selection_text_refcell,
|
language_selection_text_refcell,
|
||||||
#[strong]
|
#[strong]
|
||||||
@ -108,7 +112,7 @@ pub fn installation_summary_page(
|
|||||||
move |_|
|
move |_|
|
||||||
{
|
{
|
||||||
std::io::stdout().flush().unwrap();
|
std::io::stdout().flush().unwrap();
|
||||||
let cmd = installation_progress_page::create_installation_script(
|
let cmd = script_gen::create_installation_script(
|
||||||
&language_selection_text_refcell,
|
&language_selection_text_refcell,
|
||||||
&keymap_selection_text_refcell,
|
&keymap_selection_text_refcell,
|
||||||
&timezone_selection_text_refcell,
|
&timezone_selection_text_refcell,
|
||||||
@ -126,7 +130,8 @@ pub fn installation_summary_page(
|
|||||||
let big_cmd = cmd!("sudo", "bash", "-c",
|
let big_cmd = cmd!("sudo", "bash", "-c",
|
||||||
cmd
|
cmd
|
||||||
);
|
);
|
||||||
assert!(big_cmd.run().is_ok());
|
//assert!(big_cmd.run().is_ok());
|
||||||
|
main_carousel.scroll_to(&main_carousel.nth_page(7), true);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
436
src/installation_summary_page/script_gen/mod.rs
Normal file
436
src/installation_summary_page/script_gen/mod.rs
Normal file
@ -0,0 +1,436 @@
|
|||||||
|
use crate::{
|
||||||
|
build_ui::{BlockDevice, CrypttabEntry, FstabEntry, PikaKeymap, PikaLocale},
|
||||||
|
config::{MINIMUM_BOOT_BYTE_SIZE, MINIMUM_EFI_BYTE_SIZE},
|
||||||
|
installer_stack_page,
|
||||||
|
};
|
||||||
|
use adw::prelude::*;
|
||||||
|
use glib::{clone, closure_local};
|
||||||
|
use gtk::{gio, glib};
|
||||||
|
use std::{cell::RefCell, fs, ops::Deref, path::Path, process::Command, rc::Rc};
|
||||||
|
|
||||||
|
mod auto_basic;
|
||||||
|
mod auto_btrfs;
|
||||||
|
mod auto_ext4;
|
||||||
|
mod auto_xfs;
|
||||||
|
mod manual_basic;
|
||||||
|
|
||||||
|
pub const standard_installation_prog: &str = r###"#! /bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
SOCKET_PATH="/tmp/pikainstall-status.sock"
|
||||||
|
|
||||||
|
rm -rf /tmp/pika-installer-gtk4-swaplist
|
||||||
|
rm -rf /tmp/PIKA_CRYPT
|
||||||
|
|
||||||
|
PIKA_INSTALL_CHROOT_PATH='{CHROOT_PATH}'
|
||||||
|
PIKA_INSTALL_LOCALE='{LOCALE}.UTF-8'
|
||||||
|
PIKA_INSTALL_KEYMAP_BASE='{KEYMAP_BASE}'
|
||||||
|
PIKA_INSTALL_KEYMAP_VARIANT='{KEYMAP_VARIANT}'
|
||||||
|
PIKA_INSTALL_TIMEZONE='{TIMEZONE}'
|
||||||
|
"###;
|
||||||
|
|
||||||
|
pub fn create_installation_script(
|
||||||
|
language_selection_text_refcell: &Rc<RefCell<PikaLocale>>,
|
||||||
|
keymap_selection_text_refcell: &Rc<RefCell<PikaKeymap>>,
|
||||||
|
timezone_selection_text_refcell: &Rc<RefCell<String>>,
|
||||||
|
partition_method_type_refcell: &Rc<RefCell<String>>,
|
||||||
|
partition_method_automatic_target_refcell: &Rc<RefCell<BlockDevice>>,
|
||||||
|
partition_method_automatic_target_fs_refcell: &Rc<RefCell<String>>,
|
||||||
|
partition_method_automatic_luks_enabled_refcell: &Rc<RefCell<bool>>,
|
||||||
|
partition_method_automatic_luks_refcell: &Rc<RefCell<String>>,
|
||||||
|
partition_method_automatic_ratio_refcell: &Rc<RefCell<f64>>,
|
||||||
|
partition_method_automatic_seperation_refcell: &Rc<RefCell<String>>,
|
||||||
|
partition_method_manual_fstab_entry_array_refcell: &Rc<RefCell<Vec<FstabEntry>>>,
|
||||||
|
partition_method_manual_luks_enabled_refcell: &Rc<RefCell<bool>>,
|
||||||
|
partition_method_manual_crypttab_entry_array_refcell: &Rc<RefCell<Vec<CrypttabEntry>>>,
|
||||||
|
) -> String {
|
||||||
|
let mut final_script = String::new();
|
||||||
|
|
||||||
|
let variant = match keymap_selection_text_refcell.borrow().clone().variant {
|
||||||
|
Some(t) => {
|
||||||
|
t.replace("'", r###"'"'"'"###)
|
||||||
|
}
|
||||||
|
None => "".to_string(),
|
||||||
|
};
|
||||||
|
|
||||||
|
let standard_installation_format = strfmt::strfmt(
|
||||||
|
standard_installation_prog,
|
||||||
|
&std::collections::HashMap::from([
|
||||||
|
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
|
||||||
|
(
|
||||||
|
"LOCALE".to_string(),
|
||||||
|
language_selection_text_refcell.borrow().name.replace("'", r###"'"'"'"###).as_str(),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"KEYMAP_BASE".to_string(),
|
||||||
|
keymap_selection_text_refcell.borrow().name.replace("'", r###"'"'"'"###).as_str(),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"KEYMAP_VARIANT".to_string(),
|
||||||
|
variant.as_str()
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"TIMEZONE".to_string(),
|
||||||
|
timezone_selection_text_refcell.borrow().replace("'", r###"'"'"'"###).as_str(),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
final_script.push_str(&standard_installation_format);
|
||||||
|
|
||||||
|
match &*partition_method_type_refcell.borrow().as_str() {
|
||||||
|
"automatic" => {
|
||||||
|
let is_encrypted = *partition_method_automatic_luks_enabled_refcell.borrow();
|
||||||
|
//
|
||||||
|
let automatic_standard_installation_format = strfmt::strfmt(
|
||||||
|
auto_basic::automatic_standard_installation_prog,
|
||||||
|
&std::collections::HashMap::from([
|
||||||
|
(
|
||||||
|
"AUTO_INSTALL_TARGET_DISK".to_string(),
|
||||||
|
partition_method_automatic_target_refcell.borrow().block_name.replace("'", r###"'"'"'"###).as_str(),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
final_script.push_str(&automatic_standard_installation_format);
|
||||||
|
|
||||||
|
//
|
||||||
|
match &*partition_method_automatic_target_fs_refcell.borrow().as_str().to_lowercase() {
|
||||||
|
"btrfs" => {
|
||||||
|
match &*partition_method_automatic_seperation_refcell.borrow().as_str() {
|
||||||
|
"subvol" => {
|
||||||
|
if is_encrypted {
|
||||||
|
final_script.push_str(&strfmt::strfmt(
|
||||||
|
auto_btrfs::automatic_home_subvol_btrfs_locked_installation_prog,
|
||||||
|
&std::collections::HashMap::from([
|
||||||
|
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
|
||||||
|
(
|
||||||
|
"AUTO_LUKS_PASSWORD".to_string(),
|
||||||
|
partition_method_automatic_luks_refcell.borrow().replace("'", r###"'"'"'"###).as_str(),
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
.unwrap());
|
||||||
|
} else {
|
||||||
|
final_script.push_str(&strfmt::strfmt(
|
||||||
|
auto_btrfs::automatic_home_subvol_btrfs_open_installation_prog,
|
||||||
|
&std::collections::HashMap::from([
|
||||||
|
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
.unwrap());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"partition" => {
|
||||||
|
if is_encrypted {
|
||||||
|
final_script.push_str(&strfmt::strfmt(
|
||||||
|
auto_btrfs::automatic_home_part_btrfs_locked_installation_prog,
|
||||||
|
&std::collections::HashMap::from([
|
||||||
|
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
|
||||||
|
(
|
||||||
|
"AUTO_LUKS_PASSWORD".to_string(),
|
||||||
|
partition_method_automatic_luks_refcell.borrow().replace("'", r###"'"'"'"###).as_str(),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"ROOT_PART_SIZE_AS_I64_MIB".to_string(),
|
||||||
|
(partition_method_automatic_ratio_refcell.borrow().round() as i64 / 1048576).to_string().replace("'", r###"'"'"'"###).as_str(),
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
.unwrap());
|
||||||
|
} else {
|
||||||
|
final_script.push_str(&strfmt::strfmt(
|
||||||
|
auto_btrfs::automatic_home_part_btrfs_open_installation_prog,
|
||||||
|
&std::collections::HashMap::from([
|
||||||
|
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
|
||||||
|
(
|
||||||
|
"ROOT_PART_SIZE_AS_I64_MIB".to_string(),
|
||||||
|
(partition_method_automatic_ratio_refcell.borrow().round() as i64 / 1048576).to_string().replace("'", r###"'"'"'"###).as_str(),
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
.unwrap());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"none" => {
|
||||||
|
if is_encrypted {
|
||||||
|
final_script.push_str(&strfmt::strfmt(
|
||||||
|
auto_btrfs::automatic_home_none_btrfs_locked_installation_prog,
|
||||||
|
&std::collections::HashMap::from([
|
||||||
|
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
|
||||||
|
(
|
||||||
|
"AUTO_LUKS_PASSWORD".to_string(),
|
||||||
|
partition_method_automatic_luks_refcell.borrow().replace("'", r###"'"'"'"###).as_str(),
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
.unwrap());
|
||||||
|
} else {
|
||||||
|
final_script.push_str(&strfmt::strfmt(
|
||||||
|
auto_btrfs::automatic_home_none_btrfs_open_installation_prog,
|
||||||
|
&std::collections::HashMap::from([
|
||||||
|
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
.unwrap());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => panic!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"ext4" => {
|
||||||
|
match &*partition_method_automatic_seperation_refcell.borrow().as_str() {
|
||||||
|
"partition" => {
|
||||||
|
if is_encrypted {
|
||||||
|
final_script.push_str(&strfmt::strfmt(
|
||||||
|
auto_ext4::automatic_home_part_ext4_locked_installation_prog,
|
||||||
|
&std::collections::HashMap::from([
|
||||||
|
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
|
||||||
|
(
|
||||||
|
"AUTO_LUKS_PASSWORD".to_string(),
|
||||||
|
partition_method_automatic_luks_refcell.borrow().replace("'", r###"'"'"'"###).as_str(),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"ROOT_PART_SIZE_AS_I64_MIB".to_string(),
|
||||||
|
(partition_method_automatic_ratio_refcell.borrow().round() as i64 / 1048576).to_string().replace("'", r###"'"'"'"###).as_str(),
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
.unwrap());
|
||||||
|
} else {
|
||||||
|
final_script.push_str(&strfmt::strfmt(
|
||||||
|
auto_ext4::automatic_home_part_ext4_open_installation_prog,
|
||||||
|
&std::collections::HashMap::from([
|
||||||
|
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
|
||||||
|
(
|
||||||
|
"ROOT_PART_SIZE_AS_I64_MIB".to_string(),
|
||||||
|
(partition_method_automatic_ratio_refcell.borrow().round() as i64 / 1048576).to_string().replace("'", r###"'"'"'"###).as_str(),
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
.unwrap());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"none" => {
|
||||||
|
if is_encrypted {
|
||||||
|
final_script.push_str(&strfmt::strfmt(
|
||||||
|
auto_ext4::automatic_home_none_ext4_locked_installation_prog,
|
||||||
|
&std::collections::HashMap::from([
|
||||||
|
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
|
||||||
|
(
|
||||||
|
"AUTO_LUKS_PASSWORD".to_string(),
|
||||||
|
partition_method_automatic_luks_refcell.borrow().replace("'", r###"'"'"'"###).as_str(),
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
.unwrap());
|
||||||
|
} else {
|
||||||
|
final_script.push_str(&strfmt::strfmt(
|
||||||
|
auto_ext4::automatic_home_none_ext4_open_installation_prog,
|
||||||
|
&std::collections::HashMap::from([
|
||||||
|
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
.unwrap());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => panic!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"xfs" => {
|
||||||
|
match &*partition_method_automatic_seperation_refcell.borrow().as_str() {
|
||||||
|
"partition" => {
|
||||||
|
if is_encrypted {
|
||||||
|
final_script.push_str(&strfmt::strfmt(
|
||||||
|
auto_xfs::automatic_home_part_xfs_locked_installation_prog,
|
||||||
|
&std::collections::HashMap::from([
|
||||||
|
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
|
||||||
|
(
|
||||||
|
"AUTO_LUKS_PASSWORD".to_string(),
|
||||||
|
partition_method_automatic_luks_refcell.borrow().replace("'", r###"'"'"'"###).as_str(),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"ROOT_PART_SIZE_AS_I64_MIB".to_string(),
|
||||||
|
(partition_method_automatic_ratio_refcell.borrow().round() as i64 / 1048576).to_string().replace("'", r###"'"'"'"###).as_str(),
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
.unwrap());
|
||||||
|
} else {
|
||||||
|
final_script.push_str(&strfmt::strfmt(
|
||||||
|
auto_xfs::automatic_home_part_xfs_open_installation_prog,
|
||||||
|
&std::collections::HashMap::from([
|
||||||
|
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
|
||||||
|
(
|
||||||
|
"ROOT_PART_SIZE_AS_I64_MIB".to_string(),
|
||||||
|
(partition_method_automatic_ratio_refcell.borrow().round() as i64 / 1048576).to_string().replace("'", r###"'"'"'"###).as_str(),
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
.unwrap());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"none" => {
|
||||||
|
if is_encrypted {
|
||||||
|
final_script.push_str(&strfmt::strfmt(
|
||||||
|
auto_xfs::automatic_home_none_xfs_locked_installation_prog,
|
||||||
|
&std::collections::HashMap::from([
|
||||||
|
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
|
||||||
|
(
|
||||||
|
"AUTO_LUKS_PASSWORD".to_string(),
|
||||||
|
partition_method_automatic_luks_refcell.borrow().replace("'", r###"'"'"'"###).as_str(),
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
.unwrap());
|
||||||
|
} else {
|
||||||
|
final_script.push_str(&strfmt::strfmt(
|
||||||
|
auto_xfs::automatic_home_none_xfs_open_installation_prog,
|
||||||
|
&std::collections::HashMap::from([
|
||||||
|
("CHROOT_PATH".to_string(), "/media/pikaos/installation"),
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
.unwrap());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => panic!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => panic!()
|
||||||
|
}
|
||||||
|
//
|
||||||
|
if is_encrypted {
|
||||||
|
final_script.push_str(auto_basic::automatic_locked_part_pikainstall_prog);
|
||||||
|
} else {
|
||||||
|
final_script.push_str(auto_basic::automatic_open_part_pikainstall_prog);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"manual" => {
|
||||||
|
let is_encrypted = *partition_method_manual_luks_enabled_refcell.borrow();
|
||||||
|
|
||||||
|
if is_encrypted {
|
||||||
|
final_script.push_str(
|
||||||
|
r###"
|
||||||
|
|
||||||
|
mkdir -p /tmp/PIKA_CRYPT/
|
||||||
|
touch /tmp/PIKA_CRYPT/crypttab
|
||||||
|
|
||||||
|
"###
|
||||||
|
);
|
||||||
|
|
||||||
|
for crypt_entry in partition_method_manual_crypttab_entry_array_refcell.borrow().iter() {
|
||||||
|
match &crypt_entry.password {
|
||||||
|
Some(p) => {
|
||||||
|
final_script.push_str(&strfmt::strfmt(
|
||||||
|
manual_basic::manual_crypt_entry_with_keyfile,
|
||||||
|
&std::collections::HashMap::from([
|
||||||
|
(
|
||||||
|
"MAP".to_string(),
|
||||||
|
crypt_entry.map.replace("'", r###"'"'"'"###).as_str()
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"UUID".to_string(),
|
||||||
|
crypt_entry.uuid.replace("'", r###"'"'"'"###).as_str()
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"LUKS_PASSWD".to_string(),
|
||||||
|
p.replace("'", r###"'"'"'"###).as_str()
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
.unwrap());
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
final_script.push_str(&strfmt::strfmt(
|
||||||
|
manual_basic::manual_crypt_entry,
|
||||||
|
&std::collections::HashMap::from([
|
||||||
|
(
|
||||||
|
"MAP".to_string(),
|
||||||
|
crypt_entry.map.replace("'", r###"'"'"'"###).as_str()
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"UUID".to_string(),
|
||||||
|
crypt_entry.uuid.replace("'", r###"'"'"'"###).as_str()
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
.unwrap());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut did_make_swap_list = false;
|
||||||
|
|
||||||
|
for fstab_entry in partition_method_manual_fstab_entry_array_refcell.borrow().iter() {
|
||||||
|
if fstab_entry.mountpoint == "[SWAP]" {
|
||||||
|
if !did_make_swap_list {
|
||||||
|
final_script.push_str(
|
||||||
|
r###"
|
||||||
|
|
||||||
|
touch /tmp/pika-installer-gtk4-swaplist
|
||||||
|
|
||||||
|
"###
|
||||||
|
);
|
||||||
|
did_make_swap_list = true
|
||||||
|
}
|
||||||
|
final_script.push_str(&strfmt::strfmt(
|
||||||
|
manual_basic::manual_swap_mount_prog,
|
||||||
|
&std::collections::HashMap::from([
|
||||||
|
(
|
||||||
|
"PART".to_string(),
|
||||||
|
fstab_entry.partition.part_name.replace("'", r###"'"'"'"###).as_str()
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
.unwrap());
|
||||||
|
} else if !fstab_entry.mountopts.is_empty() {
|
||||||
|
final_script.push_str(&strfmt::strfmt(
|
||||||
|
manual_basic::manual_partition_mount_with_opts_prog,
|
||||||
|
&std::collections::HashMap::from([
|
||||||
|
(
|
||||||
|
"PART".to_string(),
|
||||||
|
fstab_entry.partition.part_name.replace("'", r###"'"'"'"###).as_str()
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"MOUNTPOINT".to_string(),
|
||||||
|
fstab_entry.mountpoint.replace("'", r###"'"'"'"###).as_str()
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"OPTS".to_string(),
|
||||||
|
fstab_entry.mountopts.replace("'", r###"'"'"'"###).as_str()
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
.unwrap());
|
||||||
|
} else {
|
||||||
|
final_script.push_str(&strfmt::strfmt(
|
||||||
|
manual_basic::manual_partition_mount_prog,
|
||||||
|
&std::collections::HashMap::from([
|
||||||
|
(
|
||||||
|
"PART".to_string(),
|
||||||
|
fstab_entry.partition.part_name.replace("'", r###"'"'"'"###).as_str()
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"MOUNTPOINT".to_string(),
|
||||||
|
fstab_entry.mountpoint.replace("'", r###"'"'"'"###).as_str()
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
.unwrap());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_encrypted {
|
||||||
|
final_script.push_str(manual_basic::manual_locked_part_pikainstall_prog);
|
||||||
|
} else {
|
||||||
|
final_script.push_str(manual_basic::manual_open_part_pikainstall_prog);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => panic!()
|
||||||
|
}
|
||||||
|
|
||||||
|
final_script
|
||||||
|
}
|
@ -19,8 +19,8 @@ mod automatic_partitioning_page;
|
|||||||
mod manual_partitioning_page;
|
mod manual_partitioning_page;
|
||||||
mod partitioning_page;
|
mod partitioning_page;
|
||||||
//
|
//
|
||||||
mod installation_progress_page;
|
|
||||||
mod installation_summary_page;
|
mod installation_summary_page;
|
||||||
|
mod installation_progress_page;
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate rust_i18n;
|
extern crate rust_i18n;
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.small_fg_text {
|
.small_fg_text {
|
||||||
font-size: 48px;
|
font-size: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.big_error_text {
|
.big_error_text {
|
||||||
|
Loading…
Reference in New Issue
Block a user