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("fedora"), _) => Distribution::Fedora,
|
||||||
(Some("void"), _) => Distribution::Void,
|
(Some("void"), _) => Distribution::Void,
|
||||||
(Some("solus"), _) => Distribution::Solus,
|
(Some("solus"), _) => Distribution::Solus,
|
||||||
|
(Some("gentoo"), _) => Distribution::Gentoo,
|
||||||
_ => Err(ErrorKind::UnknownLinuxDistribution)?,
|
_ => Err(ErrorKind::UnknownLinuxDistribution)?,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -68,10 +69,6 @@ impl Distribution {
|
|||||||
return Self::parse_os_release(&os_release);
|
return Self::parse_os_release(&os_release);
|
||||||
}
|
}
|
||||||
|
|
||||||
if PathBuf::from("/etc/gentoo-release").exists() {
|
|
||||||
return Ok(Distribution::Gentoo);
|
|
||||||
}
|
|
||||||
|
|
||||||
Err(ErrorKind::UnknownLinuxDistribution)?
|
Err(ErrorKind::UnknownLinuxDistribution)?
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -415,4 +412,9 @@ mod tests {
|
|||||||
fn test_anarchy() {
|
fn test_anarchy() {
|
||||||
test_template(&include_str!("os_release/anarchy"), Distribution::Arch);
|
test_template(&include_str!("os_release/anarchy"), Distribution::Arch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_gentoo() {
|
||||||
|
test_template(&include_str!("os_release/gentoo"), Distribution::Gentoo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
7
src/steps/os/os_release/gentoo
Normal file
7
src/steps/os/os_release/gentoo
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
NAME=Gentoo
|
||||||
|
ID=gentoo
|
||||||
|
PRETTY_NAME="Gentoo/Linux"
|
||||||
|
ANSI_COLOR="1;32"
|
||||||
|
HOME_URL="https://www.gentoo.org/"
|
||||||
|
SUPPORT_URL="https://www.gentoo.org/support/"
|
||||||
|
BUG_REPORT_URL="https://bugs.gentoo.org/"
|
||||||
Reference in New Issue
Block a user