reorg linux os check, add ID_LIKE=fedora, add tests (#432)
This commit is contained in:
@@ -43,18 +43,6 @@ impl Distribution {
|
||||
let id = section.get("ID");
|
||||
let id_like: Option<Vec<&str>> = section.get("ID_LIKE").map(|s| s.split_whitespace().collect());
|
||||
|
||||
if let Some(id_like) = id_like {
|
||||
if id_like.contains(&"debian") || id_like.contains(&"ubuntu") {
|
||||
return Ok(Distribution::Debian);
|
||||
} else if id_like.contains(&"centos") {
|
||||
return Ok(Distribution::CentOS);
|
||||
} else if id_like.contains(&"suse") {
|
||||
return Ok(Distribution::Suse);
|
||||
} else if id_like.contains(&"arch") || id_like.contains(&"archlinux") {
|
||||
return Ok(Distribution::Arch);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(match id {
|
||||
Some("centos") | Some("rhel") | Some("ol") => Distribution::CentOS,
|
||||
Some("clear-linux-os") => Distribution::ClearLinux,
|
||||
@@ -66,7 +54,22 @@ impl Distribution {
|
||||
Some("gentoo") => Distribution::Gentoo,
|
||||
Some("exherbo") => Distribution::Exherbo,
|
||||
Some("nixos") => Distribution::NixOS,
|
||||
_ => return Err(TopgradeError::UnknownLinuxDistribution.into()),
|
||||
_ => {
|
||||
if let Some(id_like) = id_like {
|
||||
if id_like.contains(&"debian") || id_like.contains(&"ubuntu") {
|
||||
return Ok(Distribution::Debian);
|
||||
} else if id_like.contains(&"centos") {
|
||||
return Ok(Distribution::CentOS);
|
||||
} else if id_like.contains(&"suse") {
|
||||
return Ok(Distribution::Suse);
|
||||
} else if id_like.contains(&"arch") || id_like.contains(&"archlinux") {
|
||||
return Ok(Distribution::Arch);
|
||||
} else if id_like.contains(&"fedora") {
|
||||
return Ok(Distribution::Fedora);
|
||||
}
|
||||
}
|
||||
return Err(TopgradeError::UnknownLinuxDistribution.into());
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -600,4 +603,14 @@ mod tests {
|
||||
fn test_nixos() {
|
||||
test_template(&include_str!("os_release/nixos"), Distribution::NixOS);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_fedoraremixonwsl() {
|
||||
test_template(&include_str!("os_release/fedoraremixforwsl"), Distribution::Fedora);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_pengwinonwsl() {
|
||||
test_template(&include_str!("os_release/pengwinonwsl"), Distribution::Debian);
|
||||
}
|
||||
}
|
||||
|
||||
14
src/steps/os/os_release/fedoraremixforwsl
Executable file
14
src/steps/os/os_release/fedoraremixforwsl
Executable file
@@ -0,0 +1,14 @@
|
||||
NAME="Fedora Remix for WSL"
|
||||
VERSION="31"
|
||||
ID=fedoraremixforwsl
|
||||
ID_LIKE=fedora
|
||||
VERSION_ID=31
|
||||
PLATFORM_ID="platform:f31"
|
||||
PRETTY_NAME="Fedora Remix for WSL"
|
||||
ANSI_COLOR="0;34"
|
||||
CPE_NAME="cpe:/o:fedoraproject:fedora:31"
|
||||
HOME_URL="https://github.com/WhitewaterFoundry/Fedora-Remix-for-WSL"
|
||||
SUPPORT_URL="https://github.com/WhitewaterFoundry/Fedora-Remix-for-WSL"
|
||||
BUG_REPORT_URL="https://github.com/WhitewaterFoundry/Fedora-Remix-for-WSL/issues"
|
||||
PRIVACY_POLICY_URL="https://github.com/WhitewaterFoundry/Fedora-Remix-for-WSL/blob/master/PRIVACY.md"
|
||||
FEDORA_REMIX_VERSION=31.5.0
|
||||
11
src/steps/os/os_release/pengwinonwsl
Executable file
11
src/steps/os/os_release/pengwinonwsl
Executable file
@@ -0,0 +1,11 @@
|
||||
PRETTY_NAME="Pengwin"
|
||||
NAME="Pengwin"
|
||||
VERSION_ID="11"
|
||||
VERSION="11 (bullseye)"
|
||||
ID=debian
|
||||
ID_LIKE=debian
|
||||
HOME_URL="https://github.com/whitewaterfoundry/Pengwin"
|
||||
SUPPORT_URL="https://github.com/WhitewaterFoundry/Pengwin/issues"
|
||||
BUG_REPORT_URL="https://github.com/WhitewaterFoundry/Pengwin/issues"
|
||||
VERSION_CODENAME=bullseye
|
||||
PENGWIN_VERSION="20.6.3"
|
||||
Reference in New Issue
Block a user