diff --git a/src/common.rs b/src/common.rs index f29c6d3f..64f53670 100644 --- a/src/common.rs +++ b/src/common.rs @@ -452,7 +452,13 @@ pub fn get_platform(args: &ArgMatches) -> Result> { if os == "linux" { let dist = detect_platform()?; if let (Some(distro), Some(version)) = (dist.distro, dist.version) { - os = format!("linux-{}-{}", distro, version); + // Amazon Linux 2023 is RHEL 9-compatible; the r-hub API + // doesn't know about amzn so we resolve against rhel-9. + if distro == "amzn" && version == "2023" { + os = "linux-rhel-9".to_string(); + } else { + os = format!("linux-{}-{}", distro, version); + } } } } diff --git a/src/data/repos.json b/src/data/repos.json index 64bf22a1..c826bf76 100644 --- a/src/data/repos.json +++ b/src/data/repos.json @@ -261,6 +261,18 @@ "x86_64", "aarch64" ] + }, + { + "name": "P3M", + "url": "https://packagemanager.posit.co/cran/__linux__/manylinux_2_28/latest", + "platforms": [ + "*-linux-gnu-amzn-*" + ], + "archs": [ + "x86_64", + "aarch64" + ], + "enabled": true } ] }, diff --git a/src/linux.rs b/src/linux.rs index 81a904ec..6a91827f 100644 --- a/src/linux.rs +++ b/src/linux.rs @@ -171,6 +171,14 @@ fn select_linux_tools(platform: &OsVersion) -> Result is_installed: strvec!["rpm", "-q", "{}"], delete: strvec!["zypper", "remove", "-y", "{}"], }) + } else if platform.distro.as_deref() == Some("amzn") { + Ok(LinuxTools { + package_name: "R-{}".to_string(), + install: vec![strvec!["dnf", "install", "-y", "{}"]], + get_package_name: strvec!["rpm", "-q", "--qf", "%{NAME}", "-p", "{}"], + is_installed: strvec!["rpm", "-q", "{}"], + delete: strvec!["dnf", "remove", "-y", "{}"], + }) } else if platform.distro.as_deref() == Some("fedora") { Ok(LinuxTools { package_name: "R-{}".to_string(),