Files
stegasoo/rpi/pull-image.sh
Aaron D. Lee eb16eb1db2 v4.1.5: Accordion UI, webcam QR scanning, Pi image fix
Encode/Decode UI:
- New accordion layout with 3 steps (encode) / 2 steps (decode)
- Gold step numbers with checkmarks on completion
- Dynamic right-aligned summaries as fields are filled
- Subtle gradient highlight on active accordion step

Webcam QR Scanning:
- Camera button for RSA key QR codes on encode/decode pages
- Camera button for channel key scanning
- 3-2-1 countdown capture for dense QR codes
- Proper scanner stop/restart on retry
- Backend decompression for STEGASOO-Z: compressed keys

RSA Key Print:
- Removed identifying text from QR print output
- Now prints plain QR code for discretion

Pi Image Script:
- Fixed 16GB resize to detect expand vs shrink
- Fresh images now properly EXPAND to 16GB
- Already-expanded images properly SHRINK to 16GB

UI Polish:
- Removed PIN helper text for compactness
- Fixed QR drop zone centering
- Fixed decode page element IDs for JS

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-06 21:31:11 -05:00

77 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
# Pull Raspberry Pi image from SD card (after setup)
# Only pulls the actual used partition space, not the entire SD card
#
# Usage: ./pull-image.sh <device> <output.img.zst>
# Example: ./pull-image.sh /dev/sdb stegasoo-rpi-4.1.5.img.zst
set -e
if [ $# -ne 2 ]; then
echo "Usage: $0 <device> <output.img.zst>"
echo "Example: $0 /dev/sdb stegasoo-rpi-4.1.5.img.zst"
exit 1
fi
DEVICE="$1"
OUTPUT="$2"
if [ ! -b "$DEVICE" ]; then
echo "Error: Device not found: $DEVICE"
exit 1
fi
echo "Device info:"
lsblk "$DEVICE"
echo
# Get partition info
echo "Partition table:"
sudo parted -s "$DEVICE" unit s print
echo
# Get the end of the last partition (partition 2 = rootfs)
END_SECTOR=$(sudo parted -s "$DEVICE" unit s print | grep "^ 2" | awk '{print $3}' | tr -d 's')
if [ -z "$END_SECTOR" ]; then
echo "Error: Could not determine partition 2 end sector"
exit 1
fi
# Add a small buffer (1MB = 2048 sectors) for safety
TOTAL_SECTORS=$((END_SECTOR + 2048))
TOTAL_BYTES=$((TOTAL_SECTORS * 512))
TOTAL_GB=$(echo "scale=2; $TOTAL_BYTES / 1073741824" | bc)
echo "Image will be approximately ${TOTAL_GB}GB (${TOTAL_SECTORS} sectors)"
echo "Output file: $OUTPUT"
echo
read -p "Proceed with image pull? [Y/n] " confirm
if [[ "$confirm" =~ ^[Nn]$ ]]; then
echo "Aborted."
exit 1
fi
echo "Pulling image..."
echo
# Use pv if available for progress, otherwise fallback to dd status
if command -v pv &> /dev/null; then
sudo dd if="$DEVICE" bs=512 count=$TOTAL_SECTORS 2>/dev/null | \
pv -s $TOTAL_BYTES | \
zstd -T0 -3 > "$OUTPUT"
else
sudo dd if="$DEVICE" bs=512 count=$TOTAL_SECTORS status=progress | \
zstd -T0 -3 > "$OUTPUT"
fi
echo
echo "Done! Image saved to: $OUTPUT"
ls -lh "$OUTPUT"
# Show verification info
echo
echo "To verify, you can check the image with:"
echo " zstdcat $OUTPUT | fdisk -l /dev/stdin"