Release highlights: - API key authentication (X-API-Key header) - TLS with self-signed certificates - CLI tools: compress, rotate, convert - jpegtran lossless JPEG rotation - AUR packages: stegasoo-cli-git, stegasoo-api-git - Bug fixes: DCT rotation, jpegtran -trim, CLI output format Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
4.4 KiB
Stegasoo Pi Image Build Workflow
Note: This guide is for developers building custom Pi images. End users: Just download the pre-built
.img.zstfrom Releases, flash it, and boot. No build process needed.
Quick reference for building a distributable SD card image.
Step 1: Flash Fresh Raspbian
Use rpi-imager with these settings:
- OS: Raspberry Pi OS Lite (64-bit)
- Hostname:
stegasoo - Enable SSH: Yes (password auth)
- Username:
admin - Password:
stegasoo - WiFi: Configure for your network (sanitize script removes it later)
Step 2: Boot & SSH In
# Wait for Pi to boot (~60 seconds), then:
ssh admin@stegasoo.local
# or use IP from router DHCP list
Step 3: Pre-Setup
# Take ownership of /opt
sudo chown admin:admin /opt
# Install git (not included in Lite image)
sudo apt-get update && sudo apt-get install -y git
Step 4: Clone Repo
cd /opt
git clone -b 4.2 https://github.com/adlee-was-taken/stegasoo.git stegasoo
Step 5: Run Setup
cd /opt/stegasoo
./rpi/setup.sh
The setup script:
- Verifies Python 3.11+ (system Python, no pyenv needed)
- Installs dependencies via apt and pip
- jpeglib installs cleanly (no ARM patching like jpegio)
- Creates and enables systemd service
Install time: 5-10 minutes (from source)
Pre-built Venv (optional)
For faster installs, you can provide a pre-built venv tarball:
# On your host machine:
scp rpi/stegasoo-rpi-venv-arm64.tar.zst admin@stegasoo.local:/opt/stegasoo/rpi/
# Then on Pi:
cd /opt/stegasoo && ./rpi/setup.sh # Detects local tarball, skips pip build
Install time with pre-built: ~2 minutes
Step 6: Test It Works
sudo systemctl start stegasoo
curl -k https://localhost:5000
# Should return HTML
Step 7: Sanitize for Distribution
# Full sanitize (for final image - removes WiFi, shuts down)
sudo /opt/stegasoo/rpi/sanitize-for-image.sh
# Or soft reset (for testing - keeps WiFi, reboots)
sudo /opt/stegasoo/rpi/sanitize-for-image.sh --soft
This removes:
- WiFi credentials (unless
--soft) - SSH host keys (regenerate on boot)
- SSH authorized keys
- Bash history
- Stegasoo auth database
- Logs and temp files
The script validates all cleanup steps before finishing.
Step 8: Pull the Image
Remove SD card, insert into your Linux machine:
# Find the SD card device (CAREFUL!)
lsblk
# Pull image (auto-resizes to 16GB, compresses with zstd)
sudo ./rpi/pull-image.sh /dev/sdX stegasoo-rpi-4.2.1.img.zst
The script automatically resizes rootfs to 16GB (for smaller download), preserves auto-expand, and compresses.
Step 9: Distribute
Upload .img.zst to GitHub Releases.
Users can flash with:
# Option 1: rpi-imager CLI (supports .zst.zip directly)
sudo rpi-imager --cli --disable-verify stegasoo-rpi-*.img.zst.zip /dev/sdX
# Option 2: flash-image.sh (auto-detects SD card, shows progress)
sudo ./rpi/flash-image.sh stegasoo-rpi-*.img.zst.zip
# Option 3: Manual dd
zstdcat stegasoo-rpi-*.img.zst | sudo dd of=/dev/sdX bs=4M status=progress
Creating the Pre-built Venv Tarball
After a successful from-source build, create the pre-built tarball for future installs:
# On the Pi after successful setup:
cd /opt/stegasoo
# Strip caches and tests from venv (saves ~100MB)
find venv/ -type d -name '__pycache__' -exec rm -rf {} + 2>/dev/null
find venv/ -type d -name 'tests' -exec rm -rf {} + 2>/dev/null
find venv/ -type d -name 'test' -exec rm -rf {} + 2>/dev/null
# Create venv tarball
tar -cf - venv/ | zstd -19 -T0 > /tmp/stegasoo-rpi-venv-arm64.tar.zst
# Check size (should be ~40-50MB)
ls -lh /tmp/stegasoo-rpi-venv-arm64.tar.zst
Pull to host and upload to GitHub releases:
# On host:
scp admin@stegasoo.local:/tmp/stegasoo-rpi-venv-arm64.tar.zst ./rpi/
# Upload to GitHub releases as stegasoo-rpi-venv-arm64.tar.zst
Quick Command Summary
# On Pi (after SSH):
sudo chown admin:admin /opt
sudo apt-get update && sudo apt-get install -y git
cd /opt && git clone -b 4.2 https://github.com/adlee-was-taken/stegasoo.git stegasoo
# Run setup:
cd /opt/stegasoo && ./rpi/setup.sh
sudo systemctl start stegasoo
curl -k https://localhost:5000
sudo /opt/stegasoo/rpi/sanitize-for-image.sh
# On host (pull image - auto-resizes to 16GB):
sudo ./rpi/pull-image.sh /dev/sdX stegasoo-rpi-4.2.1.img.zst