diff --git a/src/install/mod.rs b/src/install/mod.rs index 9b518ae..8a53a2b 100644 --- a/src/install/mod.rs +++ b/src/install/mod.rs @@ -51,7 +51,7 @@ pub mod zram; use crate::{ config::InstallConfig, - pkg::{self, install_pkgs, pacstrap_at}, + pkg::{self, install_pkgs, pacstrap_at, setup_kernel}, print_status, }; @@ -129,7 +129,8 @@ pub fn install(mut conf: InstallConfig, bare: bool) { pub fn install_mnt(conf: InstallConfig, bare: bool) { // Base Install - pacstrap_at("/mnt", conf.pkg.kernel.as_ref(), &conf.pkg.pkg); + pacstrap_at("/mnt", &conf.pkg.pkg); + setup_kernel(conf.pkg.kernel.clone()); genfstab(); // Configuration diff --git a/src/main.rs b/src/main.rs index 3a48efa..57f03c4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -67,7 +67,7 @@ fn main() { ensure_root(); let dir: &String = tar_options.get_one("dir").unwrap(); print_status("Pacstrapping root fs"); - pacstrap_at(&dir, None, &[]); + pacstrap_at(&dir, &[]); setup_navos(dir.as_str()); } Some(("create-img", install_args)) => { diff --git a/src/pkg.rs b/src/pkg.rs index 15732a3..e490346 100644 --- a/src/pkg.rs +++ b/src/pkg.rs @@ -36,18 +36,20 @@ pub fn install_pkgs(pkg: &[&str]) { arch_chroot(&cmd, None, true); } +pub fn setup_kernel(kernel: Option) { + let linux_kernel = "linux".to_string(); + let kernel = kernel.unwrap_or(linux_kernel); + let headers = format!("{kernel}-headers"); + install_pkgs(&[kernel.as_str(), headers.as_str()]); +} + // PACSTRAP /// Initial system pacstrap -pub fn pacstrap_at(dir: &str, kernel: Option<&String>, pkg: &[String]) { +pub fn pacstrap_at(dir: &str, pkg: &[String]) { // TODO : rearrange pkgs + minify let mut cmd: Vec<&str> = vec!["pacstrap", "-K", dir, "base"]; - let linux_kernel = "linux".to_string(); - let kernel = kernel.unwrap_or(&linux_kernel); - let headers = format!("{kernel}-headers"); - cmd.extend(&[kernel.as_str(), headers.as_str()]); - #[cfg(target_arch = "aarch64")] { cmd.extend(&["archlinuxarm-keyring"]);