Switch image scripts to zstd compression

- pull-image.sh now uses zstd -19 instead of xz -9 (much faster, similar ratio)
- flash-image.sh supports .zst, .xz, and .gz formats
- Default output is now .img.zst

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Aaron D. Lee
2026-01-03 00:56:41 -05:00
parent c6f816d61f
commit 45b99d2c5e
2 changed files with 23 additions and 14 deletions

View File

@@ -4,7 +4,7 @@
# Auto-detects SD card, copies with progress, shrinks, and compresses
#
# Usage: ./pull-image.sh [output-name]
# Output will be: stegasoo-rpi-YYYYMMDD.img.xz (or custom name)
# Output will be: stegasoo-rpi-YYYYMMDD.img.zst (or custom name)
#
set -e
@@ -17,7 +17,7 @@ BOLD='\033[1m'
NC='\033[0m'
# Check for required tools
for cmd in dd pv xz lsblk; do
for cmd in dd pv zstd lsblk; do
if ! command -v $cmd &> /dev/null; then
echo -e "${RED}Error: $cmd is required but not installed.${NC}"
exit 1
@@ -34,14 +34,14 @@ fi
if [ -n "$1" ]; then
OUTPUT="$1"
else
OUTPUT="stegasoo-rpi-$(date +%Y%m%d).img.xz"
OUTPUT="stegasoo-rpi-$(date +%Y%m%d).img.zst"
fi
# Remove .xz extension for intermediate file
IMG_FILE="${OUTPUT%.xz}"
# Remove .zst extension for intermediate file
IMG_FILE="${OUTPUT%.zst}"
if [[ "$IMG_FILE" == "$OUTPUT" ]]; then
IMG_FILE="${OUTPUT}.img"
OUTPUT="${OUTPUT}.img.xz"
OUTPUT="${OUTPUT}.img.zst"
fi
echo -e "${BLUE}"
@@ -167,8 +167,8 @@ else
fi
echo ""
echo -e "${GREEN}[3/3]${NC} Compressing with xz..."
pv "$IMG_FILE" | xz -9 -T0 > "$OUTPUT"
echo -e "${GREEN}[3/3]${NC} Compressing with zstd..."
pv "$IMG_FILE" | zstd -19 -T0 -q > "$OUTPUT"
rm -f "$IMG_FILE"
echo ""