feat: updated coyote installation scripts to detect when gnu is installable

This commit is contained in:
2026-08-28 22:23:31 -06:00
parent 18c2cfeb41
commit 65e6249adb
3 changed files with 175 additions and 113 deletions
+1 -22
View File
@@ -68,30 +68,9 @@ fn normalize_version(requested: Option<String>) -> Option<String> {
}
}
fn host_has_glibc() -> bool {
if process::Command::new("getconf")
.arg("GNU_LIBC_VERSION")
.output()
.is_ok_and(|out| out.status.success())
{
return true;
}
process::Command::new("ldd")
.arg("--version")
.output()
.is_ok_and(|out| {
let combined = format!(
"{}{}",
String::from_utf8_lossy(&out.stdout),
String::from_utf8_lossy(&out.stderr)
);
combined.to_lowercase().contains("glibc")
})
}
fn preferred_update_target() -> Option<&'static str> {
match (env::consts::OS, env::consts::ARCH) {
("linux", "x86_64") if host_has_glibc() => Some("x86_64-unknown-linux-gnu"),
("linux", "x86_64") if cfg!(target_env = "gnu") => Some("x86_64-unknown-linux-gnu"),
("linux", "x86_64") => Some("x86_64-unknown-linux-musl"),
// No aarch64 gnu asset is published; musl is the only option.
("linux", "aarch64") => Some("aarch64-unknown-linux-musl"),