From cbc5fc94f9ba661c998355a86bf7078b6e7e25a7 Mon Sep 17 00:00:00 2001 From: Lazerbeak12345 <22641188+Lazerbeak12345@users.noreply.github.com> Date: Fri, 19 Jul 2024 21:04:26 -0600 Subject: [PATCH] feat(linux.rs): Add support for Funtoo (#868) * feat(linus.rs): Add support for Funtoo * style(linux.rs): fix clippy reccomendations * test(funtoo support): add funtoo test --- src/steps/os/linux.rs | 32 +++++++++++++++++++++----------- src/steps/os/os_release/funtoo | 6 ++++++ 2 files changed, 27 insertions(+), 11 deletions(-) create mode 100644 src/steps/os/os_release/funtoo diff --git a/src/steps/os/linux.rs b/src/steps/os/linux.rs index f08ec71a..3551c6eb 100644 --- a/src/steps/os/linux.rs +++ b/src/steps/os/linux.rs @@ -76,7 +76,7 @@ impl Distribution { Some("debian") | Some("pureos") | Some("Deepin") | Some("linuxmint") => Distribution::Debian, Some("arch") | Some("manjaro-arm") | Some("garuda") | Some("artix") => Distribution::Arch, Some("solus") => Distribution::Solus, - Some("gentoo") => Distribution::Gentoo, + Some("gentoo") | Some("funtoo") => Distribution::Gentoo, Some("exherbo") => Distribution::Exherbo, Some("nixos") => Distribution::NixOS, Some("opensuse-microos") => Distribution::SuseMicro, @@ -452,16 +452,21 @@ fn upgrade_gentoo(ctx: &ExecutionContext) -> Result<()> { } println!("Syncing portage"); - run_type - .execute(sudo) - .args(["emerge", "--sync"]) - .args( - ctx.config() - .emerge_sync_flags() - .map(|s| s.split_whitespace().collect()) - .unwrap_or_else(|| vec!["-q"]), - ) - .status_checked()?; + if let Some(ego) = which("ego") { + // The Funtoo team doesn't reccomend running both ego sync and emerge --sync + run_type.execute(sudo).arg(ego).arg("sync").status_checked()?; + } else { + run_type + .execute(sudo) + .args(["emerge", "--sync"]) + .args( + ctx.config() + .emerge_sync_flags() + .map(|s| s.split_whitespace().collect()) + .unwrap_or_else(|| vec!["-q"]), + ) + .status_checked()?; + } if let Some(eix_update) = which("eix-update") { run_type.execute(sudo).arg(eix_update).status_checked()?; @@ -1185,6 +1190,11 @@ mod tests { test_template(include_str!("os_release/gentoo"), Distribution::Gentoo); } + #[test] + fn test_funtoo() { + test_template(include_str!("os_release/funtoo"), Distribution::Gentoo); + } + #[test] fn test_exherbo() { test_template(include_str!("os_release/exherbo"), Distribution::Exherbo); diff --git a/src/steps/os/os_release/funtoo b/src/steps/os/os_release/funtoo new file mode 100644 index 00000000..f9be5bce --- /dev/null +++ b/src/steps/os/os_release/funtoo @@ -0,0 +1,6 @@ +ID="funtoo" +NAME="Funtoo" +PRETTY_NAME="Funtoo Linux" +ANSI_COLOR="0;34" +HOME_URL="https://www.funtoo.org" +BUG_REPORT_URL="https://bugs.funtoo.org"