From 37bcb05f36569f104645c791b880ad87cfbd4984 Mon Sep 17 00:00:00 2001 From: Oleksii Filonenko Date: Wed, 14 Aug 2019 14:34:46 +0300 Subject: [PATCH] Support ID=gentoo in /etc/os-release (#185) * Support ID=gentoo in /etc/os-release * Add os_release/gentoo for testing --- src/steps/os/linux.rs | 10 ++++++---- src/steps/os/os_release/gentoo | 7 +++++++ 2 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 src/steps/os/os_release/gentoo diff --git a/src/steps/os/linux.rs b/src/steps/os/linux.rs index 60099503..9155dd30 100644 --- a/src/steps/os/linux.rs +++ b/src/steps/os/linux.rs @@ -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); + } } diff --git a/src/steps/os/os_release/gentoo b/src/steps/os/os_release/gentoo new file mode 100644 index 00000000..2a75fec6 --- /dev/null +++ b/src/steps/os/os_release/gentoo @@ -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/"