diff --git a/rpi/BUILD_IMAGE.md b/rpi/BUILD_IMAGE.md index 9a89a36..1108ffe 100644 --- a/rpi/BUILD_IMAGE.md +++ b/rpi/BUILD_IMAGE.md @@ -98,7 +98,7 @@ This removes: The script validates all cleanup steps before finishing. -## Step 9: Copy the Image +## Step 9: Pull the Image Remove SD card, insert into your Linux machine: @@ -106,23 +106,13 @@ Remove SD card, insert into your Linux machine: # Find the SD card device (CAREFUL!) lsblk -# Copy (replace sdX with actual device, e.g., sda) -sudo dd if=/dev/sdX of=stegasoo-rpi-$(date +%Y%m%d).img bs=4M status=progress +# Pull image (auto-resizes to 16GB, compresses with zstd) +sudo ./rpi/pull-image.sh /dev/sdX stegasoo-rpi-4.1.5.img.zst ``` -## Step 10: Shrink & Compress +The script automatically resizes rootfs to 16GB, disables auto-expand, and compresses. -```bash -# Optional: Shrink image (saves space) -wget https://raw.githubusercontent.com/Drewsif/PiShrink/master/pishrink.sh -chmod +x pishrink.sh -sudo ./pishrink.sh stegasoo-rpi-*.img - -# Compress (zstd is faster than xz with similar ratio) -zstd -19 -T0 stegasoo-rpi-*.img -``` - -## Step 11: Distribute +## Step 10: Distribute Upload `.img.zst` to GitHub Releases. @@ -191,7 +181,6 @@ sudo systemctl start stegasoo curl -k https://localhost:5000 sudo /opt/stegasoo/rpi/sanitize-for-image.sh -# On host (pull image): -sudo dd if=/dev/sdX of=stegasoo-rpi-$(date +%Y%m%d).img bs=4M status=progress -zstd -19 -T0 stegasoo-rpi-*.img +# On host (pull image - auto-resizes to 16GB): +sudo ./rpi/pull-image.sh /dev/sdX stegasoo-rpi-4.1.5.img.zst ``` diff --git a/rpi/README.md b/rpi/README.md index e924faf..5348a3c 100644 --- a/rpi/README.md +++ b/rpi/README.md @@ -32,7 +32,7 @@ cd stegasoo - Raspberry Pi 4 or 5 - Raspberry Pi OS Lite (64-bit) - Bookworm or later - 4GB+ RAM recommended (2GB minimum) -- ~2GB free disk space +- 16GB+ SD card (pre-built images are 16GB) - Internet connection ### Performance @@ -199,18 +199,15 @@ After Pi shuts down, remove SD card and on another Linux machine: # Find SD card device (BE CAREFUL - wrong device = data loss!) lsblk -# Copy (replace sdX with your SD card) -sudo dd if=/dev/sdX of=stegasoo-rpi-$(date +%Y%m%d).img bs=4M status=progress - -# Shrink the image (optional but recommended) -wget https://raw.githubusercontent.com/Drewsif/PiShrink/master/pishrink.sh -chmod +x pishrink.sh -sudo ./pishrink.sh stegasoo-rpi-*.img - -# Compress (zstd is faster than xz with similar compression) -zstd -19 -T0 stegasoo-rpi-*.img +# Pull image (auto-resizes to 16GB, compresses with zstd) +sudo ./rpi/pull-image.sh /dev/sdX stegasoo-rpi-4.1.5.img.zst ``` +The `pull-image.sh` script automatically: +- Resizes rootfs to exactly 16GB (consistent image size) +- Disables Pi OS auto-expand +- Compresses with zstd for fast decompression + ### 6. Distribute Upload the `.img.zst` file to GitHub Releases. diff --git a/rpi/pull-image.sh b/rpi/pull-image.sh index 5d2ba9d..05f6cc1 100755 --- a/rpi/pull-image.sh +++ b/rpi/pull-image.sh @@ -191,6 +191,22 @@ echo echo -e "${GREEN}Done!${NC} Image saved to: $OUTPUT" ls -lh "$OUTPUT" +# ============================================================================ +# Optional: Zip-wrap for GitHub releases +# ============================================================================ echo -echo "To verify:" -echo " zstdcat $OUTPUT | fdisk -l /dev/stdin" +read -p "Create .zst.zip wrapper for GitHub? [y/N] " zip_confirm +if [[ "$zip_confirm" =~ ^[Yy]$ ]]; then + ZIP_OUTPUT="${OUTPUT}.zip" + echo -e "${YELLOW}Creating zip wrapper (store mode, no compression)...${NC}" + zip -0 "$ZIP_OUTPUT" "$OUTPUT" + echo -e "${GREEN}Done!${NC} Upload this to GitHub Releases:" + ls -lh "$ZIP_OUTPUT" + echo + echo "Users can flash with:" + echo " sudo ./rpi/flash-image.sh $ZIP_OUTPUT" +else + echo + echo "To verify:" + echo " zstdcat $OUTPUT | fdisk -l /dev/stdin" +fi