Add config file support and help to RPi scripts

- Add stegasoo.conf.example with all configurable options
- setup.sh: Add -h/--help, load config from /etc and ~/.config
- setup.sh: Support STEGASOO_BRANCH for non-main branches
- sanitize-for-image.sh: Add -h/--help with usage examples

Config files are loaded in order:
1. /etc/stegasoo.conf (system-wide)
2. ~/.config/stegasoo/stegasoo.conf (per-user)
3. Environment variables (highest priority)

🤖 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-04 15:45:31 -05:00
parent 298f387c9a
commit f3d5699e15
3 changed files with 109 additions and 7 deletions

View File

@@ -29,10 +29,36 @@ GRAY='\033[0;90m'
BOLD='\033[1m'
NC='\033[0m'
# Show help
show_help() {
echo "Stegasoo Sanitize Script - Prepare Pi for SD Card Imaging"
echo ""
echo "Usage: sudo $0 [options]"
echo ""
echo "Options:"
echo " -h, --help Show this help message"
echo " -s, --soft Soft reset (keeps WiFi for testing)"
echo " -r, --reboot Auto-reboot/shutdown when done"
echo ""
echo "Examples:"
echo " sudo $0 # Full sanitize, prompts for shutdown"
echo " sudo $0 --soft # Keep WiFi, reset everything else"
echo " sudo $0 --soft --reboot # Soft reset, auto-reboot"
echo " sudo $0 --reboot # Full sanitize, auto-shutdown"
echo ""
echo "Config override:"
echo " Set STEGASOO_DIR to specify a custom install location:"
echo " export STEGASOO_DIR=\"/home/pi/stegasoo\""
echo " sudo -E $0"
echo ""
exit 0
}
SOFT_RESET=false
AUTO_REBOOT=false
for arg in "$@"; do
case $arg in
-h|--help) show_help ;;
--soft|-s) SOFT_RESET=true ;;
--reboot|-r) AUTO_REBOOT=true ;;
esac

View File

@@ -29,12 +29,56 @@ GRAY='\033[0;90m'
BOLD='\033[1m'
NC='\033[0m' # No Color
# Configuration
INSTALL_DIR="/opt/stegasoo"
PYTHON_VERSION="3.12"
STEGASOO_REPO="https://github.com/adlee-was-taken/stegasoo.git"
# Show help
show_help() {
echo "Stegasoo Raspberry Pi Setup Script"
echo ""
echo "Usage: $0 [options]"
echo ""
echo "Options:"
echo " -h, --help Show this help message"
echo ""
echo "Configuration:"
echo " Config files are loaded in order (later overrides earlier):"
echo " 1. /etc/stegasoo.conf"
echo " 2. ~/.config/stegasoo/stegasoo.conf"
echo " 3. Environment variables"
echo ""
echo " Available variables:"
echo " INSTALL_DIR Install location (default: /opt/stegasoo)"
echo " PYTHON_VERSION Python version (default: 3.12)"
echo " STEGASOO_REPO Git repo URL"
echo " STEGASOO_BRANCH Git branch (default: main)"
echo ""
echo " Example:"
echo " export INSTALL_DIR=\"/home/pi/stegasoo\""
echo " ./setup.sh"
echo ""
exit 0
}
# Parse args
for arg in "$@"; do
case $arg in
-h|--help) show_help ;;
esac
done
# Default configuration
INSTALL_DIR="${INSTALL_DIR:-/opt/stegasoo}"
PYTHON_VERSION="${PYTHON_VERSION:-3.12}"
STEGASOO_REPO="${STEGASOO_REPO:-https://github.com/adlee-was-taken/stegasoo.git}"
STEGASOO_BRANCH="${STEGASOO_BRANCH:-main}"
JPEGIO_REPO="https://github.com/dwgoon/jpegio.git"
# Load config files (system, then user - user overrides system)
for config_file in "/etc/stegasoo.conf" "$HOME/.config/stegasoo/stegasoo.conf"; do
if [ -f "$config_file" ]; then
# shellcheck source=/dev/null
source "$config_file"
fi
done
clear
echo ""
echo -e "${GRAY} . · . · . · . · . · . · . · . · . · . · . · . · . · . · . · . · .${NC}"
@@ -183,12 +227,14 @@ rm -rf "$JPEGIO_DIR"
echo -e "${GREEN}[5/7]${NC} Installing Stegasoo..."
# Clone Stegasoo
if [ -d "$INSTALL_DIR" ]; then
if [ -d "$INSTALL_DIR/.git" ]; then
echo "Stegasoo directory exists, updating..."
cd "$INSTALL_DIR"
git pull
git fetch origin
git checkout "$STEGASOO_BRANCH"
git pull origin "$STEGASOO_BRANCH"
else
git clone "$STEGASOO_REPO" "$INSTALL_DIR"
git clone -b "$STEGASOO_BRANCH" "$STEGASOO_REPO" "$INSTALL_DIR"
cd "$INSTALL_DIR"
fi

30
rpi/stegasoo.conf.example Normal file
View File

@@ -0,0 +1,30 @@
# Stegasoo Raspberry Pi Configuration
# Copy this file to /etc/stegasoo.conf or ~/.config/stegasoo/stegasoo.conf
#
# You can also override these by exporting environment variables:
# export STEGASOO_INSTALL_DIR="/custom/path"
# ./setup.sh
# Installation directory (default: /opt/stegasoo)
#INSTALL_DIR="/opt/stegasoo"
# Python version to install via pyenv (default: 3.12)
#PYTHON_VERSION="3.12"
# Git repository URL
#STEGASOO_REPO="https://github.com/adlee-was-taken/stegasoo.git"
# Git branch to checkout (default: main)
#STEGASOO_BRANCH="main"
# Web UI port (default: 5000)
#STEGASOO_PORT="5000"
# Enable HTTPS (default: false, configured via wizard)
#STEGASOO_HTTPS_ENABLED="false"
# Enable authentication (default: true)
#STEGASOO_AUTH_ENABLED="true"
# Channel key for private channels (default: none)
#STEGASOO_CHANNEL_KEY=""