diff --git a/rpi/flash-image.sh b/rpi/flash-image.sh index 9578ad0..85f2c83 100755 --- a/rpi/flash-image.sh +++ b/rpi/flash-image.sh @@ -3,10 +3,10 @@ # Flash Stegasoo image to SD card # Auto-detects SD card, decompresses and writes with progress # -# Usage: ./flash-image.sh [device] -# ./flash-image.sh [device] +# Usage: ./flash-image.sh [device] # -# If device is specified, skips auto-detection (useful for large drives) +# Supports: .img, .img.zst, .img.xz, .img.gz, .img.zst.zip (GitHub release format) +# If device is specified, skips auto-detection (useful for NVMe/large drives) # set -e @@ -34,11 +34,14 @@ fi # Check for image argument if [ -z "$1" ]; then - echo -e "${RED}Usage: $0 [device]${NC}" + echo -e "${RED}Usage: $0 [device]${NC}" + echo "" + echo "Supported formats: .img, .img.zst, .img.xz, .img.gz, .img.zst.zip" echo "" echo "Examples:" - echo " $0 stegasoo-rpi-20260103.img.xz # auto-detect SD card" - echo " $0 stegasoo-rpi-20260103.img.xz /dev/sdb # specify device" + echo " $0 stegasoo-rpi-4.1.1.img.zst # auto-detect SD card" + echo " $0 stegasoo-rpi-4.1.1.img.zst.zip # from GitHub release" + echo " $0 stegasoo-rpi-4.1.1.img.zst /dev/sdb # specify device" exit 1 fi @@ -50,6 +53,25 @@ if [ ! -f "$IMAGE" ]; then exit 1 fi +# Handle .zst.zip wrapper (GitHub releases workaround) +if [[ "$IMAGE" == *.zst.zip ]]; then + echo -e "${YELLOW}Extracting .zst from zip wrapper...${NC}" + if ! command -v unzip &> /dev/null; then + echo -e "${RED}Error: unzip is required for .zst.zip files but not installed.${NC}" + exit 1 + fi + TEMP_DIR=$(mktemp -d) + trap "rm -rf $TEMP_DIR" EXIT + unzip -q "$IMAGE" -d "$TEMP_DIR" + IMAGE=$(find "$TEMP_DIR" -name "*.zst" | head -1) + if [ -z "$IMAGE" ]; then + echo -e "${RED}Error: No .zst file found in zip archive${NC}" + exit 1 + fi + echo -e "${GREEN}Found: $(basename "$IMAGE")${NC}" + echo "" +fi + # Detect compression COMPRESSED=false COMP_TYPE=""