From 125b539f6763ebc1338e6d4ea89596ea79510cc7 Mon Sep 17 00:00:00 2001 From: Tomaz Zaman Date: Wed, 12 Aug 2026 09:55:57 +0200 Subject: [PATCH 48/59] mono-update-check: prefer the gzipped sysupgrade image Take "sysupgrade_gz"/"sha256_gz" from the verified manifest when both are present - the ~10x smaller download; this firmware verifies and decompresses it before flashing - and fall back to the legacy "sysupgrade"/"sha256" pair otherwise, which also covers future manifests where the gzipped image is the only one published. URL and hash always come from the same pair, never mixed. Co-Authored-By: Claude Opus 4.8 --- package/mono/mono-update-check/Makefile | 2 +- .../mono/mono-update-check/files/mono-update-check | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/package/mono/mono-update-check/Makefile b/package/mono/mono-update-check/Makefile index 4799a4e010..2c99492f2f 100644 --- a/package/mono/mono-update-check/Makefile +++ b/package/mono/mono-update-check/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mono-update-check PKG_VERSION:=1.0 -PKG_RELEASE:=4 +PKG_RELEASE:=5 PKG_LICENSE:=GPL-2.0 include $(INCLUDE_DIR)/package.mk diff --git a/package/mono/mono-update-check/files/mono-update-check b/package/mono/mono-update-check/files/mono-update-check index bacb56c1e7..428f0e6663 100644 --- a/package/mono/mono-update-check/files/mono-update-check +++ b/package/mono/mono-update-check/files/mono-update-check @@ -106,8 +106,18 @@ JSON=$(cat "$TMP/latest.json") FMT=$(echo "$JSON" | jsonfilter -e '@.format_version' 2>/dev/null) [ "$FMT" = "1" ] || { say "unsupported manifest format_version '$FMT' - refusing"; exit 1; } TAG=$(echo "$JSON" | jsonfilter -e '@.tag') -SYSUPGRADE_URL=$(echo "$JSON" | jsonfilter -e "@.devices['$BOARD'].sysupgrade") -WANT=$(echo "$JSON" | jsonfilter -e "@.devices['$BOARD'].sha256") +# Prefer the gzip-compressed image (~10x smaller download); this firmware +# decompresses and verifies it before flashing. The plain "sysupgrade" keys +# stay pointed at an image the OLDEST deployed flasher can install, so +# pre-gzip devices (which only know those keys) always have a workable +# upgrade path. Take the _gz pair only when both keys are present - never +# mix a URL from one pair with a hash from the other. +SYSUPGRADE_URL=$(echo "$JSON" | jsonfilter -e "@.devices['$BOARD'].sysupgrade_gz") +WANT=$(echo "$JSON" | jsonfilter -e "@.devices['$BOARD'].sha256_gz") +if [ -z "$SYSUPGRADE_URL" ] || [ -z "$WANT" ]; then + SYSUPGRADE_URL=$(echo "$JSON" | jsonfilter -e "@.devices['$BOARD'].sysupgrade") + WANT=$(echo "$JSON" | jsonfilter -e "@.devices['$BOARD'].sha256") +fi [ -n "$TAG" ] || { say "malformed manifest (no tag)"; exit 1; } [ -n "$SYSUPGRADE_URL" ] || { say "no image for board $BOARD in latest.json"; exit 0; } -- 2.47.3