From 71402c4ae734a8c2eba8c987f6be550d43dcba17 Mon Sep 17 00:00:00 2001 From: Ilya Pavlushin Date: Tue, 6 Oct 2026 20:10:14 +0500 Subject: [PATCH] feat: update Docker build for armv7 and refactor architecture detection (#103) --- .github/workflows/probe-build.yml | 4 ++-- probe/src/update.rs | 16 +++++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/probe-build.yml b/.github/workflows/probe-build.yml index d6f1a7f..2dc6682 100644 --- a/.github/workflows/probe-build.yml +++ b/.github/workflows/probe-build.yml @@ -169,7 +169,7 @@ jobs: docker: needs: validate - name: Docker image amd64/arm64 + name: Docker image amd64/arm64/armv7 runs-on: ubuntu-latest permissions: contents: read @@ -242,7 +242,7 @@ jobs: with: context: . file: ./probe/Dockerfile - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64,linux/arm64,linux/arm/v7 push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/probe/src/update.rs b/probe/src/update.rs index ce211f7..a96770f 100644 --- a/probe/src/update.rs +++ b/probe/src/update.rs @@ -227,11 +227,7 @@ fn detect_platform() -> Result<(PackageKind, String, bool)> { .any(|line| line.split_whitespace().next() == Some("luci-app-cheburprobe")); Ok((PackageKind::Opkg, architecture.to_owned(), luci_installed)) } else { - let architecture = match env::consts::ARCH { - "x86_64" => "amd64", - "aarch64" => "arm64", - architecture => bail!("unsupported standalone Linux architecture: {architecture}"), - }; + let architecture = standalone_linux_architecture(env::consts::ARCH)?; Ok((PackageKind::Linux, architecture.to_owned(), false)) } @@ -239,6 +235,16 @@ fn detect_platform() -> Result<(PackageKind, String, bool)> { bail!("updates are not supported on this operating system") } +#[cfg(target_os = "linux")] +fn standalone_linux_architecture(architecture: &str) -> Result<&'static str> { + match architecture { + "x86_64" => Ok("amd64"), + "aarch64" => Ok("arm64"), + "arm" => Ok("armv7"), + architecture => bail!("unsupported standalone Linux architecture: {architecture}"), + } +} + #[cfg(target_os = "linux")] fn openwrt_apk_arch() -> Result { if let Ok(architecture) = std::fs::read_to_string("/etc/apk/arch") {