From 0755374dd2d011a097cdc2fb99b6de753890213c Mon Sep 17 00:00:00 2001 From: Michael Chus Date: Sat, 28 Mar 2026 10:10:29 +0300 Subject: [PATCH] =?UTF-8?q?perf(iso):=20speed=20up=20builds=20=E2=80=94=20?= =?UTF-8?q?zstd=20squashfs=20+=20preserve=20lb=20chroot=20cache?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Switch squashfs compression from xz to zstd (3-5x faster compression, ~10-15% larger but decompresses faster at boot) - Stop rm -rf BUILD_WORK_DIR on each build; rsync only config changes so lb can reuse its chroot across builds (skips apt install step) - Keep lb-packages cache in CACHE_ROOT as fallback if work dir is wiped Co-Authored-By: Claude Sonnet 4.6 --- iso/builder/auto/config | 1 + iso/builder/build.sh | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/iso/builder/auto/config b/iso/builder/auto/config index 1ce5d3e..060b887 100755 --- a/iso/builder/auto/config +++ b/iso/builder/auto/config @@ -34,4 +34,5 @@ lb config noauto \ --iso-application "EASY-BEE" \ --bootappend-live "boot=live components quiet nomodeset video=1920x1080 console=tty0 console=ttyS0,115200n8 loglevel=3 username=bee user-fullname=Bee modprobe.blacklist=nouveau" \ --apt-recommends false \ + --compression zstd \ "${@}" diff --git a/iso/builder/build.sh b/iso/builder/build.sh index a74f425..354125e 100755 --- a/iso/builder/build.sh +++ b/iso/builder/build.sh @@ -200,17 +200,24 @@ else fi echo "=== preparing staged overlay ===" -# Preserve lb package cache across builds so apt packages are not re-downloaded. +# Sync builder config into work dir, preserving lb cache (chroot + packages). +# We do NOT rm -rf BUILD_WORK_DIR so lb can reuse its chroot on repeat builds. +mkdir -p "${BUILD_WORK_DIR}" "${OVERLAY_STAGE_DIR}" +rsync -a --delete \ + --exclude='cache/' \ + --exclude='chroot/' \ + --exclude='.build/' \ + --exclude='*.iso' \ + --exclude='*.packages' \ + --exclude='*.contents' \ + --exclude='*.files' \ + "${BUILDER_DIR}/" "${BUILD_WORK_DIR}/" +# Also persist package cache to CACHE_ROOT so it survives a manual wipe of BUILD_WORK_DIR. LB_PKG_CACHE="${CACHE_ROOT}/lb-packages" mkdir -p "${LB_PKG_CACHE}" if [ -d "${BUILD_WORK_DIR}/cache/packages.chroot" ]; then rsync -a --delete "${BUILD_WORK_DIR}/cache/packages.chroot/" "${LB_PKG_CACHE}/" -fi -rm -rf "${BUILD_WORK_DIR}" "${OVERLAY_STAGE_DIR}" -mkdir -p "${BUILD_WORK_DIR}" "${OVERLAY_STAGE_DIR}" -rsync -a "${BUILDER_DIR}/" "${BUILD_WORK_DIR}/" -# Restore lb package cache -if [ -d "${LB_PKG_CACHE}" ] && [ "$(ls -A "${LB_PKG_CACHE}" 2>/dev/null)" ]; then +elif [ -d "${LB_PKG_CACHE}" ] && [ "$(ls -A "${LB_PKG_CACHE}" 2>/dev/null)" ]; then mkdir -p "${BUILD_WORK_DIR}/cache/packages.chroot" rsync -a "${LB_PKG_CACHE}/" "${BUILD_WORK_DIR}/cache/packages.chroot/" fi