Support ID=gentoo in /etc/os-release (#185)
* Support ID=gentoo in /etc/os-release * Add os_release/gentoo for testing
This commit is contained in:
committed by
Roey Darwish Dror
parent
7ac46d311e
commit
37bcb05f36
@@ -57,6 +57,7 @@ impl Distribution {
|
||||
(Some("fedora"), _) => Distribution::Fedora,
|
||||
(Some("void"), _) => Distribution::Void,
|
||||
(Some("solus"), _) => Distribution::Solus,
|
||||
(Some("gentoo"), _) => Distribution::Gentoo,
|
||||
_ => Err(ErrorKind::UnknownLinuxDistribution)?,
|
||||
})
|
||||
}
|
||||
@@ -68,10 +69,6 @@ impl Distribution {
|
||||
return Self::parse_os_release(&os_release);
|
||||
}
|
||||
|
||||
if PathBuf::from("/etc/gentoo-release").exists() {
|
||||
return Ok(Distribution::Gentoo);
|
||||
}
|
||||
|
||||
Err(ErrorKind::UnknownLinuxDistribution)?
|
||||
}
|
||||
|
||||
@@ -415,4 +412,9 @@ mod tests {
|
||||
fn test_anarchy() {
|
||||
test_template(&include_str!("os_release/anarchy"), Distribution::Arch);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_gentoo() {
|
||||
test_template(&include_str!("os_release/gentoo"), Distribution::Gentoo);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user