From f3b65309691a4d2b23b4358886ee7e1a3f549626 Mon Sep 17 00:00:00 2001 From: Ryan Zoeller Date: Sat, 20 Jul 2024 20:09:36 -0500 Subject: [PATCH] feat(os): support NI Linux Real-Time's opkg package manager (#870) NI Linux Real-Time is a Yocto Linux-based distribution used with NI's embedded and real-time controllers. Related links: - https://www.ni.com/en/shop/linux/introduction-to-ni-linux-real-time.html - https://github.com/ni/nilrt - https://github.com/ni/nilrt-docs --- src/steps/os/linux.rs | 16 ++++++++++++++++ src/steps/os/os_release/nilrt | 8 ++++++++ 2 files changed, 24 insertions(+) create mode 100644 src/steps/os/os_release/nilrt diff --git a/src/steps/os/linux.rs b/src/steps/os/linux.rs index 3551c6eb..fb56d96e 100644 --- a/src/steps/os/linux.rs +++ b/src/steps/os/linux.rs @@ -30,6 +30,7 @@ pub enum Distribution { FedoraImmutable, Debian, Gentoo, + NILRT, OpenMandriva, OpenSuseTumbleweed, PCLinuxOS, @@ -71,6 +72,7 @@ impl Distribution { }; } + Some("nilrt") => Distribution::NILRT, Some("nobara") => Distribution::Nobara, Some("void") => Distribution::Void, Some("debian") | Some("pureos") | Some("Deepin") | Some("linuxmint") => Distribution::Debian, @@ -158,6 +160,7 @@ impl Distribution { Distribution::OpenMandriva => upgrade_openmandriva(ctx), Distribution::PCLinuxOS => upgrade_pclinuxos(ctx), Distribution::Nobara => upgrade_nobara(ctx), + Distribution::NILRT => upgrade_nilrt(ctx), } } @@ -285,6 +288,14 @@ fn upgrade_nobara(ctx: &ExecutionContext) -> Result<()> { Ok(()) } +fn upgrade_nilrt(ctx: &ExecutionContext) -> Result<()> { + let sudo = require_option(ctx.sudo().as_ref(), REQUIRE_SUDO.to_string())?; + let opkg = require("opkg")?; + + ctx.run_type().execute(sudo).arg(&opkg).arg("update").status_checked()?; + ctx.run_type().execute(sudo).arg(&opkg).arg("upgrade").status_checked() +} + fn upgrade_fedora_immutable(ctx: &ExecutionContext) -> Result<()> { let ostree = require("rpm-ostree")?; let mut command = ctx.run_type().execute(ostree); @@ -1254,4 +1265,9 @@ mod tests { fn test_nobara() { test_template(include_str!("os_release/nobara"), Distribution::Nobara); } + + #[test] + fn test_nilrt() { + test_template(include_str!("os_release/nilrt"), Distribution::NILRT); + } } diff --git a/src/steps/os/os_release/nilrt b/src/steps/os/os_release/nilrt new file mode 100644 index 00000000..43db0c7d --- /dev/null +++ b/src/steps/os/os_release/nilrt @@ -0,0 +1,8 @@ +ID=nilrt +NAME="NI Linux Real-Time" +VERSION="10.0 (kirkstone)" +VERSION_ID=10.0 +PRETTY_NAME="NI Linux Real-Time 10.0 (kirkstone)" +DISTRO_CODENAME="kirkstone" +BUILD_ID="23.8.0f153-x64" +VERSION_CODENAME="kirkstone"