Move default install location to /opt/stegasoo
- setup.sh: Install to /opt/stegasoo with proper permissions - first-boot-wizard.sh: Use /opt/stegasoo - stegasoo-wizard.sh: Check /opt first, fallback to home dirs - sanitize-for-image.sh: Handle both /opt and home locations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -18,7 +18,7 @@ BOLD='\033[1m'
|
||||
NC='\033[0m'
|
||||
|
||||
# Configuration
|
||||
INSTALL_DIR="$HOME/stegasoo"
|
||||
INSTALL_DIR="/opt/stegasoo"
|
||||
FLAG_FILE="/etc/stegasoo-first-boot"
|
||||
PROFILE_HOOK="/etc/profile.d/stegasoo-wizard.sh"
|
||||
|
||||
|
||||
@@ -199,10 +199,13 @@ history -c 2>/dev/null || true
|
||||
# =============================================================================
|
||||
echo -e "${GREEN}[5/10]${NC} Removing Stegasoo user data..."
|
||||
# Remove auth database (users create their own admin on first run)
|
||||
rm -rf /opt/stegasoo/frontends/web/instance/ 2>/dev/null
|
||||
rm -rf /home/*/stegasoo/frontends/web/instance/
|
||||
# Remove SSL certs (will be regenerated)
|
||||
rm -rf /opt/stegasoo/frontends/web/certs/ 2>/dev/null
|
||||
rm -rf /home/*/stegasoo/frontends/web/certs/
|
||||
# Remove any .env files with channel keys
|
||||
rm -f /opt/stegasoo/frontends/web/.env 2>/dev/null
|
||||
rm -f /home/*/stegasoo/frontends/web/.env
|
||||
echo " Stegasoo instance data cleared"
|
||||
|
||||
@@ -211,16 +214,19 @@ echo " Stegasoo instance data cleared"
|
||||
# =============================================================================
|
||||
echo -e "${GREEN}[6/10]${NC} Setting up first-boot wizard..."
|
||||
|
||||
# Find stegasoo install directory
|
||||
# Find stegasoo install directory (prefer /opt/stegasoo)
|
||||
STEGASOO_DIR=""
|
||||
if [ -d /opt/stegasoo ]; then
|
||||
STEGASOO_DIR="/opt/stegasoo"
|
||||
else
|
||||
STEGASOO_DIR=$(ls -d /home/*/stegasoo 2>/dev/null | head -1)
|
||||
fi
|
||||
|
||||
if [ -z "$STEGASOO_DIR" ]; then
|
||||
for dir in /root/stegasoo /opt/stegasoo; do
|
||||
if [ -d "$dir" ]; then
|
||||
STEGASOO_DIR="$dir"
|
||||
break
|
||||
# Last resort fallback
|
||||
if [ -d /root/stegasoo ]; then
|
||||
STEGASOO_DIR="/root/stegasoo"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
STEGASOO_USER=$(stat -c '%U' "$STEGASOO_DIR" 2>/dev/null || echo "pi")
|
||||
@@ -334,7 +340,14 @@ else
|
||||
fi
|
||||
|
||||
# Check Stegasoo instance data removed
|
||||
DB_FOUND=false
|
||||
if ls /opt/stegasoo/frontends/web/instance/*.db 1>/dev/null 2>&1; then
|
||||
DB_FOUND=true
|
||||
fi
|
||||
if ls /home/*/stegasoo/frontends/web/instance/*.db 1>/dev/null 2>&1; then
|
||||
DB_FOUND=true
|
||||
fi
|
||||
if [ "$DB_FOUND" = true ]; then
|
||||
echo -e " ${RED}[FAIL]${NC} Stegasoo database still present"
|
||||
VALIDATION_ERRORS=$((VALIDATION_ERRORS + 1))
|
||||
else
|
||||
|
||||
26
rpi/setup.sh
26
rpi/setup.sh
@@ -30,7 +30,7 @@ BOLD='\033[1m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Configuration
|
||||
INSTALL_DIR="$HOME/stegasoo"
|
||||
INSTALL_DIR="/opt/stegasoo"
|
||||
PYTHON_VERSION="3.12"
|
||||
STEGASOO_REPO="https://github.com/adlee-was-taken/stegasoo.git"
|
||||
JPEGIO_REPO="https://github.com/dwgoon/jpegio.git"
|
||||
@@ -80,7 +80,19 @@ if [ "$TOTAL_MEM" -lt 2000 ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}[1/6]${NC} Installing system dependencies..."
|
||||
# Create /opt/stegasoo with proper permissions
|
||||
echo -e "${GREEN}[1/7]${NC} Setting up install directory..."
|
||||
if [ ! -d "$INSTALL_DIR" ]; then
|
||||
sudo mkdir -p "$INSTALL_DIR"
|
||||
sudo chown "$USER:$USER" "$INSTALL_DIR"
|
||||
echo " Created $INSTALL_DIR"
|
||||
else
|
||||
# Ensure current user owns it
|
||||
sudo chown "$USER:$USER" "$INSTALL_DIR"
|
||||
echo " $INSTALL_DIR exists, updated ownership"
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}[2/7]${NC} Installing system dependencies..."
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
build-essential \
|
||||
@@ -101,7 +113,7 @@ sudo apt-get install -y \
|
||||
libzbar0 \
|
||||
libjpeg-dev
|
||||
|
||||
echo -e "${GREEN}[2/6]${NC} Installing pyenv and Python $PYTHON_VERSION..."
|
||||
echo -e "${GREEN}[3/7]${NC} Installing pyenv and Python $PYTHON_VERSION..."
|
||||
|
||||
# Install pyenv if not present
|
||||
if [ ! -d "$HOME/.pyenv" ]; then
|
||||
@@ -141,7 +153,7 @@ if [ "$INSTALLED_PY" != "$PYTHON_VERSION" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}[3/6]${NC} Building jpegio for ARM..."
|
||||
echo -e "${GREEN}[4/7]${NC} Building jpegio for ARM..."
|
||||
|
||||
# Clone jpegio
|
||||
JPEGIO_DIR="/tmp/jpegio-build"
|
||||
@@ -168,7 +180,7 @@ pip install .
|
||||
cd "$HOME"
|
||||
rm -rf "$JPEGIO_DIR"
|
||||
|
||||
echo -e "${GREEN}[4/6]${NC} Installing Stegasoo..."
|
||||
echo -e "${GREEN}[5/7]${NC} Installing Stegasoo..."
|
||||
|
||||
# Clone Stegasoo
|
||||
if [ -d "$INSTALL_DIR" ]; then
|
||||
@@ -194,7 +206,7 @@ pip install -e ".[web]" || {
|
||||
pip install argon2-cffi cryptography pillow flask gunicorn scipy numpy pyzbar qrcode
|
||||
}
|
||||
|
||||
echo -e "${GREEN}[5/6]${NC} Creating systemd service..."
|
||||
echo -e "${GREEN}[6/7]${NC} Creating systemd service..."
|
||||
|
||||
# Create systemd service file
|
||||
sudo tee /etc/systemd/system/stegasoo.service > /dev/null <<EOF
|
||||
@@ -218,7 +230,7 @@ RestartSec=5
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
echo -e "${GREEN}[6/6]${NC} Enabling service..."
|
||||
echo -e "${GREEN}[7/7]${NC} Enabling service..."
|
||||
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable stegasoo.service
|
||||
|
||||
@@ -2,9 +2,15 @@
|
||||
# Stegasoo First Boot Wizard Trigger
|
||||
# This file goes in /etc/profile.d/ and runs the wizard on first login
|
||||
|
||||
if [ -f /etc/stegasoo-first-boot ] && [ -f /home/*/stegasoo/rpi/first-boot-wizard.sh ]; then
|
||||
# Find the wizard script
|
||||
if [ -f /etc/stegasoo-first-boot ]; then
|
||||
# Find the wizard script (check /opt first, then home dirs)
|
||||
WIZARD=""
|
||||
if [ -f /opt/stegasoo/rpi/first-boot-wizard.sh ]; then
|
||||
WIZARD="/opt/stegasoo/rpi/first-boot-wizard.sh"
|
||||
else
|
||||
WIZARD=$(ls /home/*/stegasoo/rpi/first-boot-wizard.sh 2>/dev/null | head -1)
|
||||
fi
|
||||
|
||||
if [ -n "$WIZARD" ]; then
|
||||
bash "$WIZARD"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user