Skip to content

Commit

Permalink
Merge pull request #379 from stuartcampbell/add-nobaralinux
Browse files Browse the repository at this point in the history
Add support for Nobara Linux
  • Loading branch information
stanislav-tkach authored Mar 28, 2024
2 parents 0838f81 + f313946 commit 5890843
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 0 deletions.
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

0 comments on commit 5890843

Please sign in to comment.