From 14db5f1ffb7b842861665c95641a8441a7c2c5ec Mon Sep 17 00:00:00 2001 From: Douglas Teles Date: Wed, 8 Jul 2026 18:28:41 -0300 Subject: [PATCH] archr-update: sanitize the channel and seed the pacman local db Two failures kept every device from ever seeing an update. The ES settings historically stored updates.branch=auto, which pointed the mirrorlist at a repo tag that does not exist, so the metadata sync always failed. And freshly flashed images carry an empty pacman local database, so even with a working mirror there was nothing to compare against and every check reported no updates. Fall back to stable for unknown channels and seed the local db once from the published archr-localdb tarball. Known limitation of the remote seed: it reflects the newest repo state, so the first check after seeding reports the current batch as already installed. Baking the per-image database at build time is the follow-up. --- .../archr/sources/scripts/archr-update | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/projects/ArchR/packages/archr/sources/scripts/archr-update b/projects/ArchR/packages/archr/sources/scripts/archr-update index 850fdf7d65..f9feb80845 100755 --- a/projects/ArchR/packages/archr/sources/scripts/archr-update +++ b/projects/ArchR/packages/archr/sources/scripts/archr-update @@ -18,7 +18,13 @@ . /etc/profile BRANCH="$(get_setting updates.branch 2>/dev/null)" -BRANCH="${BRANCH:-stable}" +# Anything that is not a real channel falls back to stable: the ES +# settings screen historically stored values like "auto" here, which +# would point the mirrorlist at a repo tag that does not exist. +case "${BRANCH}" in + stable|next|dev) ;; + *) BRANCH="stable" ;; +esac # Channel is reflected by a single line in mirrorlist; rewrite it on # the fly so the user can switch channels by changing the setting. @@ -45,8 +51,28 @@ Channel is configured via system.cfg "updates.branch" (stable|next|dev). EOF } +# A freshly flashed image carries no pacman local db, so pacman has no +# installed list to compare against and every check reports "no +# updates". Seed it once from the repo (gen-pacman-repo publishes the +# matching archr-localdb.tar.gz next to the packages). +seed_local_db() { + [ -n "$(pacman -Q 2>/dev/null | head -1)" ] && return 0 + echo "Seeding package database (first update on this install)..." + mkdir -p /var/lib/pacman + if curl -fsSL -o /tmp/archr-localdb.tar.gz \ + "https://github.com/archr-linux/archr-repo/releases/download/repo-${BRANCH}/archr-localdb.tar.gz"; then + tar -xzf /tmp/archr-localdb.tar.gz -C /var/lib/pacman + rm -f /tmp/archr-localdb.tar.gz + echo "Seeded $(pacman -Q 2>/dev/null | wc -l) package entries." + else + echo "Could not download the database seed. Check network." + return 1 + fi +} + cmd_check() { write_mirrorlist + seed_local_db || return 1 pacman -Sy --noconfirm >/dev/null 2>&1 || { echo "Failed to sync repo metadata. Check network." return 1 @@ -62,6 +88,7 @@ cmd_check() { cmd_update() { write_mirrorlist + seed_local_db || return 1 pacman -Syu --noconfirm }