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:
Oleksii Filonenko
2019-08-14 14:34:46 +03:00
committed by Roey Darwish Dror
parent 7ac46d311e
commit 37bcb05f36
2 changed files with 13 additions and 4 deletions

View File

@@ -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);
}
}