From 84dad2bcaaad52ab89372201039c22ce2685696a Mon Sep 17 00:00:00 2001 From: JMARyA Date: Tue, 15 Apr 2025 00:16:46 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9A=97=EF=B8=8F=20automated=20testing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/min.toml | 15 +++++++++++++++ test/test.sh | 22 ++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 test/min.toml create mode 100644 test/test.sh 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%.*}" +} From 8382174219f5aed73fa02bccf6638db4fb84fc71 Mon Sep 17 00:00:00 2001 From: JMARyA Date: Tue, 15 Apr 2025 00:16:53 +0200 Subject: [PATCH 2/2] =?UTF-8?q?=E2=9C=A8=20custom=20kernel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- installs/full.toml | 3 +++ src/config.rs | 2 ++ src/pkg.rs | 7 +++++-- 3 files changed, 10 insertions(+), 2 deletions(-) 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"]);