diff --git a/scripts/extract-archive.sh b/scripts/extract-archive.sh index b436bc9..3519f4b 100755 --- a/scripts/extract-archive.sh +++ b/scripts/extract-archive.sh @@ -4,6 +4,10 @@ # Example: ./scripts/extract-archive.sh platform.1 # # Available versions: see `.archive/*.tar.zst` +# +# If the archive is an LFS pointer (small file, ~130B) rather than the real +# tarball, this script will git-lfs-pull it on demand so a fresh clone with +# GIT_LFS_SKIP_SMUDGE=1 doesn't need to pre-fetch 34G of archives. set -euo pipefail @@ -39,6 +43,16 @@ if [ ! -f "$ARCHIVE" ]; then usage fi +# If the file is tiny, it's an LFS pointer — fetch the real blob. +size=$(stat -c %s "$ARCHIVE" 2>/dev/null || stat -f %z "$ARCHIVE") +if [ "$size" -lt 1024 ]; then + echo "archive is an LFS pointer (${size}B); fetching real blob via git lfs pull..." + (cd "$REPO_ROOT" && git lfs pull --include=".archive/${VERSION}.tar.zst") || { + echo "error: git lfs pull failed. Is the LFS remote configured?" >&2 + exit 1 + } +fi + if [ -d "$DEST" ]; then echo "destination exists: $DEST" read -rp "remove and re-extract? [y/N] " ans