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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user