Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Nobara Linux #379

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cspell-dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ msvc
musl
netbsd
nixos
nobara
openbsd
opencloudos
openeuler
Expand Down
1 change: 1 addition & 0 deletions os_info/src/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ mod tests {
Type::Manjaro,
Type::Mariner,
Type::NixOS,
Type::Nobara,
Type::OpenCloudOS,
Type::openEuler,
Type::openSUSE,
Expand Down
12 changes: 12 additions & 0 deletions os_info/src/linux/file_release.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ static DISTRIBUTIONS: [ReleaseInfo; 6] = [
"mariner" => Some(Type::Mariner),
//"nexus" => Nexus
"nixos" => Some(Type::NixOS),
"nobara" => Some(Type::Nobara),
"opencloudos" => Some(Type::OpenCloudOS),
"openEuler" => Some(Type::openEuler),
"ol" => Some(Type::OracleLinux),
Expand Down Expand Up @@ -457,6 +458,17 @@ mod tests {
assert_eq!(info.codename, None);
}

#[test]
fn nobara_os_release() {
let root = "src/linux/tests/Nobara";

let info = retrieve(&DISTRIBUTIONS, root).unwrap();
assert_eq!(info.os_type(), Type::Nobara);
assert_eq!(info.version, Version::Semantic(39, 0, 0));
assert_eq!(info.edition, None);
assert_eq!(info.codename, None);
}

#[test]
fn none_invalid_os_release() {
let root = "src/linux/tests/none_invalid_os_release";
Expand Down
21 changes: 21 additions & 0 deletions os_info/src/linux/lsb_release.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ pub fn get() -> Option<Info> {
Some("ManjaroLinux") => Type::Manjaro,
Some("Mariner") => Type::Mariner,
Some("NixOS") => Type::NixOS,
Some("NobaraLinux") => Type::Nobara,
Some("OpenCloudOS") => Type::OpenCloudOS,
Some("openEuler") => Type::openEuler,
Some("openSUSE") => Type::openSUSE,
Expand Down Expand Up @@ -183,6 +184,17 @@ mod tests {
assert_eq!(parse_results.codename, Some("okapi".to_string()));
}

#[test]
fn nobara() {
let parse_results = parse(nobara_file());
assert_eq!(
parse_results.distribution,
Some("NobaraLinux".to_string())
);
assert_eq!(parse_results.version, Some("39".to_string()));
assert_eq!(parse_results.codename, None);
}

#[test]
fn amazon1() {
let parse_results = parse(amazon1_file());
Expand Down Expand Up @@ -407,6 +419,15 @@ mod tests {
Codename: okapi"
}

fn nobara_file() -> &'static str {
"LSB Version: n/a\n\
Distributor ID: NobaraLinux\n\
Description: Nobara Linux 39 (KDE Plasma)\n\
Release: 39\n\
Codename: n/a\n\
"
}

// Amazon Linux 1 uses a separate Distributor ID and Release format from Amazon Linux 2
fn amazon1_file() -> &'static str {
"LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch\n\
Expand Down
1 change: 1 addition & 0 deletions os_info/src/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ mod tests {
| Type::Manjaro
| Type::Mariner
| Type::NixOS
| Type::Nobara
| Type::OpenCloudOS
| Type::openEuler
| Type::openSUSE
Expand Down
23 changes: 23 additions & 0 deletions os_info/src/linux/tests/Nobara/etc/os-release
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
NAME="Nobara Linux"
VERSION="39 (KDE Plasma)"
ID=nobara
ID_LIKE="rhel centos fedora"
VERSION_ID=39
VERSION_CODENAME=""
PLATFORM_ID="platform:f39"
PRETTY_NAME="Nobara Linux 39 (KDE Plasma)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=nobara-logo-icon
CPE_NAME="cpe:/o:nobaraproject:nobara:39"
DEFAULT_HOSTNAME="nobara"
HOME_URL="https://nobaraproject.org/"
DOCUMENTATION_URL="https://www.nobaraproject.org/"
SUPPORT_URL="https://www.nobaraproject.org/"
BUG_REPORT_URL="https://gitlab.com/gloriouseggroll/nobara-images"
REDHAT_BUGZILLA_PRODUCT="Nobara"
REDHAT_BUGZILLA_PRODUCT_VERSION=39
REDHAT_SUPPORT_PRODUCT="Nobara"
REDHAT_SUPPORT_PRODUCT_VERSION=39
SUPPORT_END=2024-05-14
VARIANT="KDE Plasma"
VARIANT_ID=kde
4 changes: 4 additions & 0 deletions os_info/src/os_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ pub enum Type {
NetBSD,
/// NixOS (<https://en.wikipedia.org/wiki/NixOS>).
NixOS,
/// Nobara (<https://nobaraproject.org/>).
Nobara,
/// OpenBSD (<https://en.wikipedia.org/wiki/OpenBSD>).
OpenBSD,
/// OpenCloudOS (<https://www.opencloudos.org>).
Expand Down Expand Up @@ -125,6 +127,7 @@ impl Display for Type {
Type::Macos => write!(f, "Mac OS"),
Type::MidnightBSD => write!(f, "Midnight BSD"),
Type::Mint => write!(f, "Linux Mint"),
Type::Nobara => write!(f, "Nobara Linux"),
Type::openEuler => write!(f, "EulerOS"),
Type::OracleLinux => write!(f, "Oracle Linux"),
Type::Pop => write!(f, "Pop!_OS"),
Expand Down Expand Up @@ -181,6 +184,7 @@ mod tests {
(Type::Mint, "Linux Mint"),
(Type::NetBSD, "NetBSD"),
(Type::NixOS, "NixOS"),
(Type::Nobara, "Nobara Linux"),
(Type::OpenCloudOS, "OpenCloudOS"),
(Type::OpenBSD, "OpenBSD"),
(Type::openEuler, "EulerOS"),
Expand Down
Loading