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

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

@ -2,13 +2,29 @@ use crate::internal::exec::*;
use crate::internal::*; use crate::internal::*;
use crate::internal::files::append_file; use crate::internal::files::append_file;
use std::path::PathBuf; 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(); std::fs::create_dir_all("/mnt/etc").unwrap();
files::copy_file("/etc/pacman.conf", "/mnt/etc/pacman.conf"); 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![ install::install(vec![
"base", "base",
"linux", kernel_to_install.as_str(),
"linux-firmware", "linux-firmware",
"systemd-sysvcompat", "systemd-sysvcompat",
"networkmanager", "networkmanager",

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

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

Loading…
Cancel
Save