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
This commit is contained in:
Lazerbeak12345
2024-07-19 21:04:26 -06:00
committed by GitHub
parent dceb697355
commit cbc5fc94f9
2 changed files with 27 additions and 11 deletions

View File

@@ -76,7 +76,7 @@ impl Distribution {
Some("debian") | Some("pureos") | Some("Deepin") | Some("linuxmint") => Distribution::Debian, Some("debian") | Some("pureos") | Some("Deepin") | Some("linuxmint") => Distribution::Debian,
Some("arch") | Some("manjaro-arm") | Some("garuda") | Some("artix") => Distribution::Arch, Some("arch") | Some("manjaro-arm") | Some("garuda") | Some("artix") => Distribution::Arch,
Some("solus") => Distribution::Solus, Some("solus") => Distribution::Solus,
Some("gentoo") => Distribution::Gentoo, Some("gentoo") | Some("funtoo") => Distribution::Gentoo,
Some("exherbo") => Distribution::Exherbo, Some("exherbo") => Distribution::Exherbo,
Some("nixos") => Distribution::NixOS, Some("nixos") => Distribution::NixOS,
Some("opensuse-microos") => Distribution::SuseMicro, Some("opensuse-microos") => Distribution::SuseMicro,
@@ -452,6 +452,10 @@ fn upgrade_gentoo(ctx: &ExecutionContext) -> Result<()> {
} }
println!("Syncing portage"); println!("Syncing portage");
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 run_type
.execute(sudo) .execute(sudo)
.args(["emerge", "--sync"]) .args(["emerge", "--sync"])
@@ -462,6 +466,7 @@ fn upgrade_gentoo(ctx: &ExecutionContext) -> Result<()> {
.unwrap_or_else(|| vec!["-q"]), .unwrap_or_else(|| vec!["-q"]),
) )
.status_checked()?; .status_checked()?;
}
if let Some(eix_update) = which("eix-update") { if let Some(eix_update) = which("eix-update") {
run_type.execute(sudo).arg(eix_update).status_checked()?; 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_template(include_str!("os_release/gentoo"), Distribution::Gentoo);
} }
#[test]
fn test_funtoo() {
test_template(include_str!("os_release/funtoo"), Distribution::Gentoo);
}
#[test] #[test]
fn test_exherbo() { fn test_exherbo() {
test_template(include_str!("os_release/exherbo"), Distribution::Exherbo); test_template(include_str!("os_release/exherbo"), Distribution::Exherbo);

View File

@@ -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"