Fix default hostname and unakite config

axtloss/rework-partitioning
UsernameSwift 2 years ago
parent f6aa0650b9
commit c26a5c5af5

@ -126,6 +126,9 @@ pub struct UnakiteArgs {
/// device of boot device
#[clap(long)]
pub bootdev: String,
/// name of kernel to use
#[clap(long)]
pub kernel: String,
}
#[derive(Debug)]

@ -9,7 +9,7 @@ pub fn install_base_packages(kernel: String) {
std::fs::create_dir_all("/mnt/etc").unwrap();
files::copy_file("/etc/pacman.conf", "/mnt/etc/pacman.conf");
if kernel.is_empty() {
kernel_to_install = "linux".to_string
kernel_to_install = "linux".to_string();
} else {
match kernel.as_str() {
"linux" => kernel_to_install = "linux".to_string(),

@ -141,10 +141,10 @@ pub fn remount(root: &str, oldroot: &str, efi: bool, efidir: &str, bootdev: &str
}
}
pub fn setup_unakite(root: &str, oldroot: &str, efi: bool, efidir: &str, bootdev: &str) {
pub fn setup_unakite(root: &str, oldroot: &str, efi: bool, efidir: &str, bootdev: &str, kernel: &str) {
log::debug!("Setting up Unakite");
remount(root, oldroot, efi, efidir, bootdev, true);
base::install_base_packages();
base::install_base_packages(kernel.to_string());
base::genfstab();
locale::set_locale("en_US.UTF-8 UTF-8".to_string());
locale::set_timezone("Europe/Berlin"); // TODO: get the proper timezone

@ -62,6 +62,7 @@ struct Unakite {
oldroot: String,
efidir: String,
bootdev: String,
kernel: String,
}
pub fn read_config(configpath: PathBuf) {
@ -107,7 +108,8 @@ pub fn read_config(configpath: PathBuf) {
&mut partitions,
config.unakite.enable
);
base::install_base_packages(kernel);
let kerneltype = config.unakite.kernel.clone(); // Implemented because the borrow checker doesn't allow passing the value itself to the function
base::install_base_packages(kerneltype);
base::genfstab();
println!();
log::info!("Installing bootloader : {}", config.bootloader.r#type);
@ -184,18 +186,18 @@ pub fn read_config(configpath: PathBuf) {
log::info!("Setup unakite");
if config.partition.mode == PartitionMode::Auto && !config.partition.efi && config.unakite.enable && !config.partition.device.to_string().contains("nvme") {
let root = PathBuf::from("/dev/").join(config.partition.device.as_str());
unakite::setup_unakite(format!("{}2",root.to_str().unwrap()).as_str(), format!("{}3",root.to_str().unwrap()).as_str(), config.partition.efi, "/boot", format!("{}1",root.to_str().unwrap()).as_str())
unakite::setup_unakite(format!("{}2",root.to_str().unwrap()).as_str(), format!("{}3",root.to_str().unwrap()).as_str(), config.partition.efi, "/boot", format!("{}1",root.to_str().unwrap()).as_str(), &config.unakite.kernel)
} else if config.partition.mode == PartitionMode::Auto && config.partition.efi && config.unakite.enable && !config.partition.device.to_string().contains("nvme") {
let root = PathBuf::from("/dev/").join(config.partition.device.as_str());
unakite::setup_unakite(format!("{}2",root.to_str().unwrap()).as_str(), format!("{}3",root.to_str().unwrap()).as_str(), config.partition.efi, "/boot/efi", format!("{}1",root.to_str().unwrap()).as_str())
unakite::setup_unakite(format!("{}2",root.to_str().unwrap()).as_str(), format!("{}3",root.to_str().unwrap()).as_str(), config.partition.efi, "/boot/efi", format!("{}1",root.to_str().unwrap()).as_str(), &config.unakite.kernel)
} else if config.unakite.enable {
unakite::setup_unakite(&config.unakite.root, &config.unakite.oldroot, config.partition.efi, &config.unakite.efidir, &config.unakite.bootdev);
unakite::setup_unakite(&config.unakite.root, &config.unakite.oldroot, config.partition.efi, &config.unakite.efidir, &config.unakite.bootdev, &config.unakite.kernel);
} else if config.partition.mode == PartitionMode::Auto && config.partition.efi && config.unakite.enable && config.partition.device.to_string().contains("nvme") {
let root = PathBuf::from("/dev/").join(config.partition.device.as_str());
unakite::setup_unakite(format!("{}p2",root.to_str().unwrap()).as_str(), format!("{}p3",root.to_str().unwrap()).as_str(), config.partition.efi, "/boot/efi", format!("{}p1",root.to_str().unwrap()).as_str())
unakite::setup_unakite(format!("{}p2",root.to_str().unwrap()).as_str(), format!("{}p3",root.to_str().unwrap()).as_str(), config.partition.efi, "/boot/efi", format!("{}p1",root.to_str().unwrap()).as_str(), &config.unakite.kernel)
} else if config.partition.mode == PartitionMode::Auto && !config.partition.efi && config.unakite.enable && config.partition.device.to_string().contains("nvme") {
let root = PathBuf::from("/dev/").join(config.partition.device.as_str());
unakite::setup_unakite(format!("{}p2",root.to_str().unwrap()).as_str(), format!("{}p3",root.to_str().unwrap()).as_str(), config.partition.efi, "/boot", format!("{}p1",root.to_str().unwrap()).as_str())
unakite::setup_unakite(format!("{}p2",root.to_str().unwrap()).as_str(), format!("{}p3",root.to_str().unwrap()).as_str(), config.partition.efi, "/boot", format!("{}p1",root.to_str().unwrap()).as_str(), &config.unakite.kernel)
} else {
log::info!("Unakite disabled");
}

@ -68,6 +68,7 @@ fn main() {
args.efi,
&args.efidir,
&args.bootdev,
&args.kernel,
);
},
Command::Config { config } => {

Loading…
Cancel
Save