Skip to content

Commit

Permalink
feat(os): support NI Linux Real-Time's opkg package manager (#870)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rtzoeller authored Jul 21, 2024
1 parent cbc5fc9 commit f3b6530
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/steps/os/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub enum Distribution {
FedoraImmutable,
Debian,
Gentoo,
NILRT,
OpenMandriva,
OpenSuseTumbleweed,
PCLinuxOS,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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),
}
}

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
}
8 changes: 8 additions & 0 deletions src/steps/os/os_release/nilrt
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit f3b6530

Please sign in to comment.