Fix bazzite os detection
This commit is contained in:
parent
25ae2005c5
commit
4c02cf33ab
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -827,6 +827,7 @@ dependencies = [
|
||||
"glob",
|
||||
"globset",
|
||||
"libmacchina",
|
||||
"os-release",
|
||||
"pfetch-extractor",
|
||||
"pfetch-logo-parser",
|
||||
"which",
|
||||
|
||||
@ -23,6 +23,7 @@ glob = "0.3.1"
|
||||
which = "4.4.0"
|
||||
libmacchina = "7.2.1"
|
||||
crossterm = "0.27.0"
|
||||
os-release = "0.1.0"
|
||||
|
||||
[profile.release]
|
||||
strip = true
|
||||
|
||||
21
src/lib.rs
21
src/lib.rs
@ -202,13 +202,22 @@ pub fn os(general_readout: &GeneralReadout) -> Option<String> {
|
||||
.unwrap_or_default()
|
||||
.contains("/bedrock/cross/")
|
||||
{
|
||||
Some("Bedrock Linux".to_string())
|
||||
} else {
|
||||
match general_readout.distribution() {
|
||||
Ok(distribution) => Some(distribution.replace(" TEMPLATE_VERSION_ID", "")),
|
||||
Err(_) => None,
|
||||
}
|
||||
return Some("Bedrock Linux".to_string());
|
||||
}
|
||||
let content = os_release::OsRelease::new().ok()?;
|
||||
let version = if !content.version.is_empty() {
|
||||
content.version
|
||||
} else {
|
||||
content.version_id
|
||||
};
|
||||
// check for Bazzite
|
||||
if content.pretty_name.contains("Bazzite") {
|
||||
return Some(format!("Bazzite {version}"));
|
||||
}
|
||||
if !version.is_empty() {
|
||||
return Some(format!("{} {}", content.name, version));
|
||||
}
|
||||
Some(content.name)
|
||||
}
|
||||
_ => Some(general_readout.os_name().ok()?.replace("Unknown", "")),
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user