Skip to content

Commit 091eb13

Browse files
committed
fix(updater): decide "no update needed" before deleting or downloading
The check exists already, but it sits after the pull, and the pull needs the room that deleting the standby slot frees - so an update that turns out to be unnecessary had already discarded the system this one would roll back to, and on an ARMv6 board had spent half an hour doing it. Asking the registry first costs one round trip. The digest has to come from "buildx imagetools", which reports the manifest list's digest, the one docker records in RepoDigests after a pull and the one /etc/image holds; "docker manifest inspect" reports the per-platform digests and would compare the wrong values. Advisory: an empty answer falls through to the pull. Signed-off-by: Simon Walz <contact@simonwalz.de>
1 parent 3f93dd9 commit 091eb13

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

‎updater/perform_update.sh‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,30 @@ CONTAINER_ROOTFS_FS="${TARGET_ROOT}/system-${SLOT}"
110110
# Consumed by the install-kernel-*.sh scripts inside the new rootfs:
111111
export CONTAINER_ROOTFS="@os/system-${SLOT}"
112112

113+
# Ask the registry whether there is anything new, before anything is downloaded
114+
# or deleted. The check below at "No OS update available" is the same question,
115+
# but it can only be asked once the image has been pulled - and the pull needs
116+
# the room that deleting the standby slot frees, so by then the slot this system
117+
# would roll back to is already gone. On a small ARM board that costs half an
118+
# hour and the rollback target for an update that turns out to be unnecessary.
119+
#
120+
# imagetools reports the digest of the manifest *list*, which is what docker
121+
# records in RepoDigests after a pull and therefore what /etc/image holds.
122+
# "docker manifest inspect -v" is not a substitute: it reports the digests of
123+
# the individual platform manifests, which are different values (measured on a
124+
# board, 2026-09-06).
125+
#
126+
# Advisory only. An empty answer - no buildx, an unreachable or a
127+
# non-conforming registry - falls through to the pull and changes nothing.
128+
if [[ "${INSTALLIMAGE}" != "true" ]]; then
129+
REMOTE_DIGEST="$(docker buildx imagetools inspect \
130+
--format '{{.Manifest.Digest}}' "${IMAGE}" 2>/dev/null)"
131+
if [[ -n "${REMOTE_DIGEST}" \
132+
&& "${IMAGE}@${REMOTE_DIGEST}" == "$(cat /etc/image 2>/dev/null)" ]]; then
133+
raise_info 102 "No OS update available"
134+
fi
135+
fi
136+
113137
# Remove old slot:
114138
OLD_IMAGE_PATH="$(grep -oE '^[^@]+' "${CONTAINER_ROOTFS_FS}/etc/image" 2>/dev/null)"
115139
if [[ -d "${CONTAINER_ROOTFS_FS}" ]]; then

0 commit comments

Comments
 (0)