mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-08-28 05:06:05 +00:00
fix: improve os detection
This commit is contained in:
parent
c3734a6a3e
commit
3072000ddd
1 changed files with 11 additions and 4 deletions
|
@ -31,7 +31,10 @@ impl LinuxDistro {
|
||||||
match reader.read_line(&mut buf) {
|
match reader.read_line(&mut buf) {
|
||||||
Ok(0) => break,
|
Ok(0) => break,
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
if buf.starts_with("NAME=\"") {
|
if buf.starts_with("NAME=\"")
|
||||||
|
|| buf.starts_with("ID=\"")
|
||||||
|
|| buf.starts_with("ID_LIKE=\"")
|
||||||
|
{
|
||||||
let name = buf
|
let name = buf
|
||||||
.split('=')
|
.split('=')
|
||||||
.last()
|
.last()
|
||||||
|
@ -39,7 +42,10 @@ impl LinuxDistro {
|
||||||
.to_string()
|
.to_string()
|
||||||
.trim_matches('"')
|
.trim_matches('"')
|
||||||
.to_lowercase();
|
.to_lowercase();
|
||||||
return Self::name_matcher(&name);
|
let res = Self::name_matcher(&name);
|
||||||
|
if res.is_some() {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(_) => break,
|
Err(_) => break,
|
||||||
|
@ -62,11 +68,12 @@ impl LinuxDistro {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn name_matcher(s: &str) -> Option<Self> {
|
fn name_matcher(s: &str) -> Option<Self> {
|
||||||
if s.contains("arch linux")
|
if s.contains("arch")
|
||||||
|| s.contains("manjaro")
|
|| s.contains("manjaro")
|
||||||
|| s.contains("steamos")
|
|| s.contains("steamos")
|
||||||
|| s.contains("steam os")
|
|| s.contains("steam os")
|
||||||
|| s.contains("endeavouros")
|
|| s.contains("endeavour")
|
||||||
|
|| s.contains("garuda")
|
||||||
{
|
{
|
||||||
return Some(Self::Arch);
|
return Some(Self::Arch);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue