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

feat:add support for CachyOS Linux #386

Merged
merged 1 commit into from
Oct 29, 2024
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 @@ -6,6 +6,7 @@ aosc
archarm
artix
bitness
cachyos
centos
clippy
clearos
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 @@ -216,6 +216,7 @@ mod tests {
Type::Android,
Type::Arch,
Type::Artix,
Type::CachyOS,
Type::CentOS,
Type::Debian,
Type::Emscripten,
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 @@ -99,6 +99,7 @@
"arch" => Some(Type::Arch),
"archarm" => Some(Type::Arch),
"artix" => Some(Type::Artix),
"cachyos" => Some(Type::CachyOS),
"centos" => Some(Type::CentOS),
//"clear-linux-os" => ClearLinuxOS
//"clearos" => ClearOS
Expand Down Expand Up @@ -659,6 +660,17 @@
assert_eq!(info.codename, None);
}

#[test]
fn cachy_os_release() {

Check warning on line 664 in os_info/src/linux/file_release.rs

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (cachy)
let root = "src/linux/tests/CachyOS";

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

#[test]
fn release_info_debug() {
dbg!("{:?}", &DISTRIBUTIONS[0]);
Expand Down
16 changes: 16 additions & 0 deletions os_info/src/linux/lsb_release.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub fn get() -> Option<Info> {
Some("Amazon") | Some("AmazonAMI") => Type::Amazon,
Some("Arch") => Type::Arch,
Some("Artix") => Type::Artix,
Some("cachyos") => Type::CachyOS,
Some("CentOS") => Type::CentOS,
Some("Debian") => Type::Debian,
Some("EndeavourOS") => Type::EndeavourOS,
Expand Down Expand Up @@ -357,6 +358,13 @@ mod tests {
assert_eq!(parse_results.codename, None);
}

#[test]
fn cachyos() {
let parse_results = parse(&cachyos_file());
assert_eq!(parse_results.distribution, Some("cachyos".to_string()));
assert_eq!(parse_results.version, Some("rolling".to_string()));
}

fn file() -> &'static str {
"\nDistributor ID: Debian\n\
Description: Debian GNU/Linux 7.8 (wheezy)\n\
Expand Down Expand Up @@ -606,4 +614,12 @@ mod tests {
Codename: n/a\n\
"
}

fn cachyos_file() -> &'static str {
"Distributor ID: cachyos\n\
Description: CachyOS\n\
Release: rolling\n\
Codename: n/a\n\
"
}
}
1 change: 1 addition & 0 deletions os_info/src/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ mod tests {
| Type::Amazon
| Type::Arch
| Type::Artix
| Type::CachyOS
| Type::CentOS
| Type::Debian
| Type::EndeavourOS
Expand Down
13 changes: 13 additions & 0 deletions os_info/src/linux/tests/CachyOS/etc/os-release
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
NAME="CachyOS Linux"
PRETTY_NAME="CachyOS"
ID=cachyos
ID_LIKE=arch
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://cachyos.org/"
DOCUMENTATION_URL="https://wiki.cachyos.org/"
SUPPORT_URL="https://forum.cachyos.org/"
BUG_REPORT_URL="https://github.com/cachyos"
LOGO=cachyos
IMAGE_ID=cachyos
IMAGE_VERSION=2023.04.23
4 changes: 4 additions & 0 deletions os_info/src/os_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ pub enum Type {
Arch,
/// Artix Linux (<https://en.wikipedia.org/wiki/Artix_Linux>).
Artix,
/// CachyOS (<https://en.wikipedia.org/wiki/Arch_Linux#Derivatives>).
CachyOS,
/// CentOS (<https://en.wikipedia.org/wiki/CentOS>).
CentOS,
/// Debian (<https://en.wikipedia.org/wiki/Debian>).
Expand Down Expand Up @@ -120,6 +122,7 @@ impl Display for Type {
Type::AlmaLinux => write!(f, "AlmaLinux"),
Type::Amazon => write!(f, "Amazon Linux AMI"),
Type::Arch => write!(f, "Arch Linux"),
Type::CachyOS => write!(f, "CachyOS Linux"),
Type::Artix => write!(f, "Artix Linux"),
Type::DragonFly => write!(f, "DragonFly BSD"),
Type::Garuda => write!(f, "Garuda Linux"),
Expand Down Expand Up @@ -166,6 +169,7 @@ mod tests {
(Type::Android, "Android"),
(Type::Arch, "Arch Linux"),
(Type::Artix, "Artix Linux"),
(Type::CachyOS, "CachyOS Linux"),
(Type::CentOS, "CentOS"),
(Type::Debian, "Debian"),
(Type::DragonFly, "DragonFly BSD"),
Expand Down
Loading