diff --git a/installs/full.toml b/installs/full.toml index d48ea9b..baf7407 100644 --- a/installs/full.toml +++ b/installs/full.toml @@ -57,6 +57,9 @@ pkg = [ "micro" ] +# Custom kernel +kernel = "linux-lts" + # Enable virtualization virtualization = true diff --git a/src/config.rs b/src/config.rs index baf8d33..94b31fe 100644 --- a/src/config.rs +++ b/src/config.rs @@ -59,6 +59,8 @@ pub struct PackageConfig { pub virtualization: Option, /// Enable docker pub docker: Option, + /// Custom kernel package + pub kernel: Option, } #[derive(Debug, Clone, Deserialize)] diff --git a/src/pkg.rs b/src/pkg.rs index d1c023c..4015421 100644 --- a/src/pkg.rs +++ b/src/pkg.rs @@ -48,9 +48,7 @@ pub fn pacstrap(conf: &PackageConfig) { "-K", "/mnt", "base", - "linux", "linux-firmware", - "linux-headers", "git", "networkmanager", "nano", @@ -61,6 +59,11 @@ pub fn pacstrap(conf: &PackageConfig) { "plymouth", ]; + let linux_kernel = "linux".to_string(); + let kernel = conf.kernel.as_ref().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"]); diff --git a/test/min.toml b/test/min.toml new file mode 100644 index 0000000..d1eddbd --- /dev/null +++ b/test/min.toml @@ -0,0 +1,15 @@ +[drive] +disk = "/dev/vda" + +[general] +mode = "Base" +locale = "de_DE.UTF-8" +keyboard_layout = "de" +keyboard_variant = "mac" +timezone = "Europe/Berlin" +hostname = "navos_min" +root_password = "root" +firewall = false + +[pkg] +pkg = [] \ No newline at end of file diff --git a/test/test.sh b/test/test.sh new file mode 100644 index 0000000..e979cb6 --- /dev/null +++ b/test/test.sh @@ -0,0 +1,22 @@ +function test_config() { + echo "Testing $1" + + mkdir "${1%.*}" + cd "${1%.*}" + + echo "Creating ISO" + doas navinstall create-iso --install "../$1" + mv -v *.iso nav.iso + + echo "Starting QEMU" + qemu-img create -f qcow2 disk.qcow2 16G + qemu-system-x86_64 -m 4G \ + -drive file=$(pwd)/disk.qcow2,if=virtio,format=qcow2 \ + -drive file=$(pwd)/nav.iso,media=cdrom,if=virtio,id=raw \ + -boot d -cpu host -enable-kvm -smp 4 -display sdl \ + -bios /usr/share/ovmf/x64/OVMF.4m.fd -machine q35,accel=kvm + + cd .. + echo "Cleaning up test env" + doas rm -rv "${1%.*}" +}