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",
|
"glob",
|
||||||
"globset",
|
"globset",
|
||||||
"libmacchina",
|
"libmacchina",
|
||||||
|
"os-release",
|
||||||
"pfetch-extractor",
|
"pfetch-extractor",
|
||||||
"pfetch-logo-parser",
|
"pfetch-logo-parser",
|
||||||
"which",
|
"which",
|
||||||
|
|||||||
@ -23,6 +23,7 @@ glob = "0.3.1"
|
|||||||
which = "4.4.0"
|
which = "4.4.0"
|
||||||
libmacchina = "7.2.1"
|
libmacchina = "7.2.1"
|
||||||
crossterm = "0.27.0"
|
crossterm = "0.27.0"
|
||||||
|
os-release = "0.1.0"
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
strip = true
|
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()
|
.unwrap_or_default()
|
||||||
.contains("/bedrock/cross/")
|
.contains("/bedrock/cross/")
|
||||||
{
|
{
|
||||||
Some("Bedrock Linux".to_string())
|
return Some("Bedrock Linux".to_string());
|
||||||
} else {
|
|
||||||
match general_readout.distribution() {
|
|
||||||
Ok(distribution) => Some(distribution.replace(" TEMPLATE_VERSION_ID", "")),
|
|
||||||
Err(_) => None,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
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", "")),
|
_ => Some(general_readout.os_name().ok()?.replace("Unknown", "")),
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user