From ed4d03f2019fb157a912b1de3eb00f3d006203bc Mon Sep 17 00:00:00 2001 From: Sam & Claude Date: Thu, 25 Jun 2026 09:05:16 +0200 Subject: [PATCH] refactor(build): clearer skip-fetch flag names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rename the fetch-skip flags to a consistent, descriptive scheme: --skip-fetch skip BOTH fetches (packages + memstick) — assemble from cache --skip-fetch-pkg skip only the package + Clawdie-AI fetch (new granular) --skip-fetch-memstick skip only the FreeBSD memstick fetch (was --skip-memstick-fetch) Internals split SKIP_FETCH into SKIP_PKG_FETCH + SKIP_MEMSTICK_FETCH; the umbrella --skip-fetch sets both. The memstick step collapses to a clean skip-or-fetch (the old three-branch form only existed to couple the pkg-skip flag to memstick reuse, which the split removes). No legacy alias kept — the flag names state the current way directly. Co-Authored-By: Claude Opus 4.8 --- build.sh | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/build.sh b/build.sh index 5e0be144..a9ef60e6 100755 --- a/build.sh +++ b/build.sh @@ -7,9 +7,10 @@ # # Usage: # ./build.sh # full build (fetch + assemble) -# ./build.sh --fetch-only # fetch packages/memstick only (no root needed) -# ./build.sh --skip-fetch # assemble only (use cached packages) -# ./build.sh --skip-memstick-fetch # fetch packages, reuse cached FreeBSD memstick +# ./build.sh --fetch-only # fetch packages + memstick only (no root needed) +# ./build.sh --skip-fetch # skip ALL fetches — assemble from cache (pkg + memstick) +# ./build.sh --skip-fetch-pkg # skip only the package + Clawdie-AI fetch +# ./build.sh --skip-fetch-memstick # skip only the FreeBSD memstick fetch # ./build.sh --live-default-password # set live clawdie password to quindecim # ./build.sh --clawdie-password ... # set an explicit live clawdie password # ./build.sh --clawdie-version 1.0.2 # pin Clawdie-AI release tag v1.0.2 @@ -57,7 +58,7 @@ if [ "$(id -u)" -eq 0 ] && [ -z "${BUILD_HOST_USER}" ]; then fi # --- argument parsing --- -SKIP_FETCH=0 +SKIP_PKG_FETCH=0 SKIP_MEMSTICK_FETCH=0 FETCH_ONLY=0 LIVE_DEFAULT_PASSWORD=0 @@ -65,8 +66,9 @@ while [ "$#" -gt 0 ]; do case "$1" in --clawdie-version) CLAWDIE_VERSION="$2"; CLAWDIE_REF="v$2"; shift 2 ;; --clawdie-ref) CLAWDIE_REF="$2"; CLAWDIE_VERSION="$2"; shift 2 ;; - --skip-fetch) SKIP_FETCH=1; shift ;; - --skip-memstick-fetch) SKIP_MEMSTICK_FETCH=1; shift ;; + --skip-fetch) SKIP_PKG_FETCH=1; SKIP_MEMSTICK_FETCH=1; shift ;; + --skip-fetch-pkg) SKIP_PKG_FETCH=1; shift ;; + --skip-fetch-memstick) SKIP_MEMSTICK_FETCH=1; shift ;; --fetch-only) FETCH_ONLY=1; shift ;; --live-default-password) LIVE_DEFAULT_PASSWORD=1; shift ;; --assistant-name) ASSISTANT_NAME="$2"; shift 2 ;; @@ -2154,32 +2156,25 @@ MEMSTICK="${CACHE_DIR}/FreeBSD-${FREEBSD_VERSION}-${FREEBSD_ARCH}-memstick.img" if [ "$SKIP_MEMSTICK_FETCH" -eq 1 ]; then if [ ! -f "$MEMSTICK" ]; then echo "ERROR: cached FreeBSD memstick not found: ${MEMSTICK}" - echo "Rerun without --skip-memstick-fetch to download it." + echo "Rerun without --skip-fetch / --skip-fetch-memstick to download it." exit 1 fi if ! verify_memstick_cache; then echo "ERROR: cached FreeBSD memstick failed checksum verification." - echo "Remove ${MEMSTICK} and rerun without --skip-memstick-fetch." + echo "Remove ${MEMSTICK} and rerun without --skip-fetch / --skip-fetch-memstick." exit 1 fi echo "==> [1/7] FreeBSD memstick cached; fetch skipped." -elif [ "$SKIP_FETCH" -eq 0 ] || [ ! -f "$MEMSTICK" ]; then +else echo "==> [1/7] Fetching FreeBSD memstick..." mkdir -p "$CACHE_DIR" curl -L --progress-bar -o "$MEMSTICK" "$FREEBSD_MEMSTICK_URL" curl -L -o "${MEMSTICK}.SHA256" "$FREEBSD_MEMSTICK_SHA256_URL" verify_memstick_cache || { echo "ERROR: checksum mismatch on memstick"; exit 1; } -else - if ! verify_memstick_cache; then - echo "ERROR: cached FreeBSD memstick failed checksum verification." - echo "Remove ${MEMSTICK} and rerun without --skip-fetch." - exit 1 - fi - echo "==> [1/7] FreeBSD memstick cached." fi # --- step 2: fetch all packages (no root needed) --- -if [ "$SKIP_FETCH" -eq 0 ]; then +if [ "$SKIP_PKG_FETCH" -eq 0 ]; then echo "==> [2/7] Fetching packages to tmp/packages/..." mkdir -p "$PKG_REPO_DIR" @@ -2266,7 +2261,7 @@ if [ -d "$PKG_REPO_DIR/All" ]; then fi echo " Repo metadata written to tmp/packages/" else - echo " WARN: tmp/packages/All/ not found — run without --skip-fetch first" + echo " WARN: tmp/packages/All/ not found — run without --skip-fetch / --skip-fetch-pkg first" fi # --- step 4: fetch + prepare Clawdie-AI tarball (offline-ready) --- @@ -2287,9 +2282,9 @@ CLAWDIE_AI_COMMIT=$(resolve_clawdie_commit "$CLAWDIE_REF" | head -n 1) CLAWDIE_AI_COMMIT="${CLAWDIE_AI_COMMIT:-unknown}" echo " Clawdie commit: ${CLAWDIE_AI_COMMIT}" -if [ "$CLAWDIE_AI_COMMIT" = "unknown" ] && [ "$SKIP_FETCH" -eq 1 ] && ! is_pinned_clawdie_ref "$CLAWDIE_REF"; then - echo "ERROR: cannot safely use --skip-fetch for moving Clawdie-AI ref '${CLAWDIE_REF}' without resolving its commit." - echo " Run without --skip-fetch or pin --clawdie-version / --clawdie-ref to a commit." +if [ "$CLAWDIE_AI_COMMIT" = "unknown" ] && [ "$SKIP_PKG_FETCH" -eq 1 ] && ! is_pinned_clawdie_ref "$CLAWDIE_REF"; then + echo "ERROR: cannot safely skip the fetch for moving Clawdie-AI ref '${CLAWDIE_REF}' without resolving its commit." + echo " Run without --skip-fetch / --skip-fetch-pkg, or pin --clawdie-version / --clawdie-ref to a commit." exit 1 fi @@ -2303,7 +2298,7 @@ fi CLAWDIE_TARBALL="${CACHE_DIR}/clawdie-ai-${CLAWDIE_CACHE_KEY}.tar.gz" CLAWDIE_TARBALL_URL="https://code.smilepowered.org/clawdie/clawdie-ai/archive/${CLAWDIE_ARCHIVE_REF}.tar.gz" -if [ "$SKIP_FETCH" -eq 0 ] || [ ! -f "$CLAWDIE_TARBALL" ]; then +if [ "$SKIP_PKG_FETCH" -eq 0 ] || [ ! -f "$CLAWDIE_TARBALL" ]; then echo "==> [4/7] Fetching Clawdie-AI ${CLAWDIE_REF} (${CLAWDIE_ARCHIVE_REF})..." mkdir -p "$CACHE_DIR" curl -L --progress-bar -o "$CLAWDIE_TARBALL" "$CLAWDIE_TARBALL_URL" @@ -2313,7 +2308,7 @@ fi # Build an ISO-ready tarball that includes node_modules for offline firstboot. CLAWDIE_TARBALL_ISO="${CACHE_DIR}/clawdie-ai-${CLAWDIE_CACHE_KEY}-iso.tar.gz" -if [ "$SKIP_FETCH" -eq 0 ] || [ ! -f "$CLAWDIE_TARBALL_ISO" ]; then +if [ "$SKIP_PKG_FETCH" -eq 0 ] || [ ! -f "$CLAWDIE_TARBALL_ISO" ]; then echo "==> [4/7] Preparing Clawdie-AI offline tarball (node_modules)..." if ! command -v npm >/dev/null 2>&1; then -- 2.45.3