allow different kernels for installation

axtloss/rework-partitioning
axtlos 2 years ago
parent d336460d20
commit b78301cb32

@ -1,8 +1,8 @@
# Maintainer: Matt C <mdc028[at]bucknell[dot]edu>
pkgname=jade
pkgver=1.0.4
pkgrel=2
pkgver=1.0.5
pkgrel=1
pkgdesc="Scriptable backend & TUI Installer for Crystal Linux"
arch=('x86_64')
url="https://git.tar.black/crystal/programs/jade"

@ -18,9 +18,9 @@ pub enum Command {
#[clap(name = "partition")]
Partition(PartitionArgs),
/// Install base packages
/// Install base packages, optionally define a different kernel
#[clap(name = "install-base")]
InstallBase,
InstallBase(InstallBaseArgs),
/// Generate fstab file for mounting partitions
#[clap(name = "genfstab")]
@ -103,6 +103,12 @@ pub struct PartitionArgs {
pub partitions: Vec<Partition>,
}
#[derive(Debug, Args)]
pub struct InstallBaseArgs {
#[clap(long)]
pub kernel: String,
}
#[derive(Debug, Args)]
pub struct UnakiteArgs {
/// root device of unakite

@ -2,13 +2,29 @@ use crate::internal::exec::*;
use crate::internal::*;
use crate::internal::files::append_file;
use std::path::PathBuf;
use log::warn;
pub fn install_base_packages() {
pub fn install_base_packages(kernel: String) {
let mut kernel_to_install: String = String::new();
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
} else {
match kernel.as_str() {
"linux" => kernel_to_install = "linux".to_string(),
"linux-lts" => kernel_to_install = "linux-lts".to_string(),
"linux-zen" => kernel_to_install = "linux-zen".to_string(),
"linux-hardened" => kernel_to_install = "linux-hardened".to_string(),
_ => {
warn!("Unknown kernel: {}, using default instead", kernel);
kernel_to_install = "linux".to_string();
}
}
}
install::install(vec![
"base",
"linux",
kernel_to_install.as_str(),
"linux-firmware",
"systemd-sysvcompat",
"networkmanager",

@ -7,6 +7,7 @@ use std::path::PathBuf;
#[derive(Serialize, Deserialize)]
struct Config {
kernel: String,
partition: Partition,
bootloader: Bootloader,
locale: Locale,
@ -106,7 +107,7 @@ pub fn read_config(configpath: PathBuf) {
&mut partitions,
config.unakite.enable
);
base::install_base_packages();
base::install_base_packages(kernel);
base::genfstab();
println!();
log::info!("Installing bootloader : {}", config.bootloader.r#type);

@ -16,8 +16,10 @@ fn main() {
let mut partitions = args.partitions;
partition::partition(args.device, args.mode, args.efi, &mut partitions, args.unakite);
}
Command::InstallBase => {
base::install_base_packages();
Command::InstallBase(args) => {
base::install_base_packages(
args.kernel,
);
}
Command::GenFstab => {
base::genfstab();

Loading…
Cancel
Save