From f8d0b65b3662bcde3da5be7d219e6edcb1ff461b Mon Sep 17 00:00:00 2001 From: mia26MAjFm Date: Tue, 23 Jun 2026 19:27:48 -0400 Subject: [PATCH] batocera: auto-discover the current build instead of hardcoding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The mirror rotates older builds out — the pinned 43-20260430 went 404 on its own within ~4 weeks. Scrape the `last/` index for whatever batocera-x86_64-*.img.gz is there now (currently 43.1-20260529). VER and BUILD are then derived from the discovered filename so the cache key + log lines remain informative. BATOCERA_URL still wins if set (override path unchanged). --- distros/batocera/build-rootfs.sh | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/distros/batocera/build-rootfs.sh b/distros/batocera/build-rootfs.sh index ecac5c4..dd76233 100755 --- a/distros/batocera/build-rootfs.sh +++ b/distros/batocera/build-rootfs.sh @@ -22,9 +22,28 @@ case "$CHROOT" in /) echo "ERROR: refuse to operate on /"; exit 2 ;; esac # itself lives in a squashfs file (`/boot/batocera`) on the FAT32. # We unsquash, swap our PS5 kernel + modules in, and let the rest # of the standard image-builder flow pack everything onto ext4. -BATOCERA_VER="${BATOCERA_VER:-43}" -BATOCERA_BUILD="${BATOCERA_BUILD:-20260430}" -BATOCERA_URL="${BATOCERA_URL:-https://mirrors.o2switch.fr/batocera/x86_64/stable/last/batocera-x86_64-${BATOCERA_VER}-${BATOCERA_BUILD}.img.gz}" +# `last/` always points at the current build, but the .img.gz filename +# inside it bakes in the version + date (e.g. batocera-x86_64-43.1-20260529.img.gz), +# and the mirror rotates older builds out. Scrape the index to discover +# whatever's there today rather than hardcoding (the previous hardcoded +# 43-20260430 went 404 within ~4 weeks). +BATOCERA_INDEX_URL="${BATOCERA_INDEX_URL:-https://mirrors.o2switch.fr/batocera/x86_64/stable/last/}" +if [ -z "${BATOCERA_URL:-}" ]; then + IMG_NAME=$(wget -qO- "$BATOCERA_INDEX_URL" \ + | grep -oE 'batocera-x86_64-[0-9.]+-[0-9]+\.img\.gz' \ + | head -1) + if [ -z "$IMG_NAME" ]; then + echo "ERROR: couldn't find a batocera-x86_64-*.img.gz link at $BATOCERA_INDEX_URL" + exit 1 + fi + BATOCERA_URL="${BATOCERA_INDEX_URL}${IMG_NAME}" +else + IMG_NAME="$(basename "$BATOCERA_URL")" +fi +# Pull VER + BUILD out of the discovered (or overridden) filename so the +# cache key + log lines stay informative. +BATOCERA_VER=$(echo "$IMG_NAME" | sed -E 's/^batocera-x86_64-([0-9.]+)-[0-9]+\.img\.gz$/\1/') +BATOCERA_BUILD=$(echo "$IMG_NAME" | sed -E 's/^batocera-x86_64-[0-9.]+-([0-9]+)\.img\.gz$/\1/') echo "=== Batocera: locate / download $BATOCERA_VER ($BATOCERA_BUILD) ===" # /build/cache is per-run temp. The workflow symlinks /build/cache/