From 67037ae196488992e03235657cae1d180ebd6929 Mon Sep 17 00:00:00 2001 From: "Aaron D. Lee" Date: Sun, 11 Jan 2026 10:59:07 -0500 Subject: [PATCH] RPi: Standardize tarball naming to stegasoo-rpi-venv-arm64.tar.zst - Update remote-build-pi.sh to use new naming - Rewrite build-runtime-tarball.sh for pyenv-free world (system Python) - Removed pyenv references, now just tarballs the venv Co-Authored-By: Claude Opus 4.5 --- rpi/build-runtime-tarball.sh | 45 +++++++++++------------------------- rpi/remote-build-pi.sh | 2 +- 2 files changed, 14 insertions(+), 33 deletions(-) diff --git a/rpi/build-runtime-tarball.sh b/rpi/build-runtime-tarball.sh index fdc35d2..b4fb518 100755 --- a/rpi/build-runtime-tarball.sh +++ b/rpi/build-runtime-tarball.sh @@ -1,10 +1,10 @@ #!/bin/bash # -# Build Stegasoo Pi Runtime Environment Tarball +# Build Stegasoo Pi venv Tarball # Run this ON THE PI after a successful from-source build # -# Creates: stegasoo-rpi-runtime-env-arm64.tar.zst (~50-60MB) -# Contains: pyenv + Python 3.12 + venv with all dependencies +# Creates: stegasoo-rpi-venv-arm64.tar.zst (~40-50MB) +# Contains: venv with all dependencies (uses system Python 3.11+) # set -e @@ -16,11 +16,10 @@ YELLOW='\033[1;33m' NC='\033[0m' INSTALL_DIR="${INSTALL_DIR:-/opt/stegasoo}" -OUTPUT_DIR="${OUTPUT_DIR:-/tmp}" -OUTPUT_FILE="$OUTPUT_DIR/stegasoo-rpi-runtime-env-arm64.tar.zst" +OUTPUT_FILE="${1:-$HOME/stegasoo-rpi-venv-arm64.tar.zst}" echo -e "${GREEN}╔═══════════════════════════════════════════════════════════════╗${NC}" -echo -e "${GREEN}║ Stegasoo Pi Runtime Tarball Builder ║${NC}" +echo -e "${GREEN}║ Stegasoo Pi venv Tarball Builder ║${NC}" echo -e "${GREEN}╚═══════════════════════════════════════════════════════════════╝${NC}" echo "" @@ -32,13 +31,6 @@ if [[ "$ARCH" != "aarch64" ]]; then exit 1 fi -# Verify pyenv exists -if [[ ! -d "$HOME/.pyenv" ]]; then - echo -e "${RED}Error: pyenv not found at ~/.pyenv${NC}" - echo "Run a from-source build first: ./rpi/setup.sh --no-prebuilt" - exit 1 -fi - # Verify venv exists if [[ ! -d "$INSTALL_DIR/venv" ]]; then echo -e "${RED}Error: venv not found at $INSTALL_DIR/venv${NC}" @@ -47,33 +39,22 @@ if [[ ! -d "$INSTALL_DIR/venv" ]]; then fi # Step 1: Clean caches from venv -echo -e "${GREEN}[1/4]${NC} Cleaning caches from venv..." +echo -e "${GREEN}[1/2]${NC} Cleaning caches from venv..." VENV_SIZE_BEFORE=$(du -sh "$INSTALL_DIR/venv" | cut -f1) find "$INSTALL_DIR/venv/" -type d -name '__pycache__' -exec rm -rf {} + 2>/dev/null || true find "$INSTALL_DIR/venv/" -type d -name 'tests' -exec rm -rf {} + 2>/dev/null || true find "$INSTALL_DIR/venv/" -type d -name 'test' -exec rm -rf {} + 2>/dev/null || true find "$INSTALL_DIR/venv/" -type f -name '*.pyc' -delete 2>/dev/null || true VENV_SIZE_AFTER=$(du -sh "$INSTALL_DIR/venv" | cut -f1) -echo " venv: $VENV_SIZE_BEFORE → $VENV_SIZE_AFTER" +echo " venv: $VENV_SIZE_BEFORE -> $VENV_SIZE_AFTER" -# Step 2: Create venv tarball -echo -e "${GREEN}[2/4]${NC} Creating venv tarball..." +# Step 2: Create tarball +echo -e "${GREEN}[2/2]${NC} Creating tarball..." cd "$INSTALL_DIR" -tar -cf - venv/ | zstd -19 -T0 > "$HOME/stegasoo-venv.tar.zst" -VENV_TAR_SIZE=$(ls -lh "$HOME/stegasoo-venv.tar.zst" | awk '{print $5}') -echo " Created: ~/stegasoo-venv.tar.zst ($VENV_TAR_SIZE)" +tar -cf - venv/ | zstd -19 -T0 > "$OUTPUT_FILE" -# Step 3: Create combined tarball -echo -e "${GREEN}[3/4]${NC} Creating combined runtime tarball..." -cd "$HOME" -tar -cf - .pyenv stegasoo-venv.tar.zst | zstd -19 -T0 > "$OUTPUT_FILE" - -# Cleanup intermediate file -rm "$HOME/stegasoo-venv.tar.zst" - -# Step 4: Summary +# Summary FINAL_SIZE=$(ls -lh "$OUTPUT_FILE" | awk '{print $5}') -echo -e "${GREEN}[4/4]${NC} Done!" echo "" echo -e "${GREEN}════════════════════════════════════════════════════════════════${NC}" echo -e " Output: ${YELLOW}$OUTPUT_FILE${NC}" @@ -83,7 +64,7 @@ echo "" echo "To pull to your host machine:" echo " scp $(whoami)@$(hostname).local:$OUTPUT_FILE ./" echo "" -echo "To use in setup.sh, copy to:" -echo " rpi/stegasoo-rpi-runtime-env-arm64.tar.zst" +echo "To use in setup.sh, place at:" +echo " rpi/stegasoo-rpi-venv-arm64.tar.zst" echo "" echo "Or upload to GitHub releases for automatic download." diff --git a/rpi/remote-build-pi.sh b/rpi/remote-build-pi.sh index 4b7f6bd..4a6c023 100755 --- a/rpi/remote-build-pi.sh +++ b/rpi/remote-build-pi.sh @@ -105,7 +105,7 @@ echo "" echo -e "${GREEN}[4/6]${NC} Copying pre-built tarball to Pi..." echo "" -TARBALL="$SCRIPT_DIR/stegasoo-rpi-runtime-env-arm64.tar.zst" +TARBALL="$SCRIPT_DIR/stegasoo-rpi-venv-arm64.tar.zst" if [[ -f "$TARBALL" ]]; then scp_to_pi "$TARBALL" "/opt/stegasoo/rpi/" echo -e " ${GREEN}✓${NC} Tarball copied"