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'
|
NC='\033[0m'
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
INSTALL_DIR="$HOME/stegasoo"
|
INSTALL_DIR="/opt/stegasoo"
|
||||||
FLAG_FILE="/etc/stegasoo-first-boot"
|
FLAG_FILE="/etc/stegasoo-first-boot"
|
||||||
PROFILE_HOOK="/etc/profile.d/stegasoo-wizard.sh"
|
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..."
|
echo -e "${GREEN}[5/10]${NC} Removing Stegasoo user data..."
|
||||||
# Remove auth database (users create their own admin on first run)
|
# 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/
|
rm -rf /home/*/stegasoo/frontends/web/instance/
|
||||||
# Remove SSL certs (will be regenerated)
|
# Remove SSL certs (will be regenerated)
|
||||||
|
rm -rf /opt/stegasoo/frontends/web/certs/ 2>/dev/null
|
||||||
rm -rf /home/*/stegasoo/frontends/web/certs/
|
rm -rf /home/*/stegasoo/frontends/web/certs/
|
||||||
# Remove any .env files with channel keys
|
# Remove any .env files with channel keys
|
||||||
|
rm -f /opt/stegasoo/frontends/web/.env 2>/dev/null
|
||||||
rm -f /home/*/stegasoo/frontends/web/.env
|
rm -f /home/*/stegasoo/frontends/web/.env
|
||||||
echo " Stegasoo instance data cleared"
|
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..."
|
echo -e "${GREEN}[6/10]${NC} Setting up first-boot wizard..."
|
||||||
|
|
||||||
# Find stegasoo install directory
|
# Find stegasoo install directory (prefer /opt/stegasoo)
|
||||||
STEGASOO_DIR=$(ls -d /home/*/stegasoo 2>/dev/null | head -1)
|
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
|
if [ -z "$STEGASOO_DIR" ]; then
|
||||||
for dir in /root/stegasoo /opt/stegasoo; do
|
# Last resort fallback
|
||||||
if [ -d "$dir" ]; then
|
if [ -d /root/stegasoo ]; then
|
||||||
STEGASOO_DIR="$dir"
|
STEGASOO_DIR="/root/stegasoo"
|
||||||
break
|
|
||||||
fi
|
fi
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
STEGASOO_USER=$(stat -c '%U' "$STEGASOO_DIR" 2>/dev/null || echo "pi")
|
STEGASOO_USER=$(stat -c '%U' "$STEGASOO_DIR" 2>/dev/null || echo "pi")
|
||||||
@@ -334,7 +340,14 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Check Stegasoo instance data removed
|
# 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
|
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"
|
echo -e " ${RED}[FAIL]${NC} Stegasoo database still present"
|
||||||
VALIDATION_ERRORS=$((VALIDATION_ERRORS + 1))
|
VALIDATION_ERRORS=$((VALIDATION_ERRORS + 1))
|
||||||
else
|
else
|
||||||
|
|||||||
26
rpi/setup.sh
26
rpi/setup.sh
@@ -30,7 +30,7 @@ BOLD='\033[1m'
|
|||||||
NC='\033[0m' # No Color
|
NC='\033[0m' # No Color
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
INSTALL_DIR="$HOME/stegasoo"
|
INSTALL_DIR="/opt/stegasoo"
|
||||||
PYTHON_VERSION="3.12"
|
PYTHON_VERSION="3.12"
|
||||||
STEGASOO_REPO="https://github.com/adlee-was-taken/stegasoo.git"
|
STEGASOO_REPO="https://github.com/adlee-was-taken/stegasoo.git"
|
||||||
JPEGIO_REPO="https://github.com/dwgoon/jpegio.git"
|
JPEGIO_REPO="https://github.com/dwgoon/jpegio.git"
|
||||||
@@ -80,7 +80,19 @@ if [ "$TOTAL_MEM" -lt 2000 ]; then
|
|||||||
fi
|
fi
|
||||||
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 update
|
||||||
sudo apt-get install -y \
|
sudo apt-get install -y \
|
||||||
build-essential \
|
build-essential \
|
||||||
@@ -101,7 +113,7 @@ sudo apt-get install -y \
|
|||||||
libzbar0 \
|
libzbar0 \
|
||||||
libjpeg-dev
|
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
|
# Install pyenv if not present
|
||||||
if [ ! -d "$HOME/.pyenv" ]; then
|
if [ ! -d "$HOME/.pyenv" ]; then
|
||||||
@@ -141,7 +153,7 @@ if [ "$INSTALLED_PY" != "$PYTHON_VERSION" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "${GREEN}[3/6]${NC} Building jpegio for ARM..."
|
echo -e "${GREEN}[4/7]${NC} Building jpegio for ARM..."
|
||||||
|
|
||||||
# Clone jpegio
|
# Clone jpegio
|
||||||
JPEGIO_DIR="/tmp/jpegio-build"
|
JPEGIO_DIR="/tmp/jpegio-build"
|
||||||
@@ -168,7 +180,7 @@ pip install .
|
|||||||
cd "$HOME"
|
cd "$HOME"
|
||||||
rm -rf "$JPEGIO_DIR"
|
rm -rf "$JPEGIO_DIR"
|
||||||
|
|
||||||
echo -e "${GREEN}[4/6]${NC} Installing Stegasoo..."
|
echo -e "${GREEN}[5/7]${NC} Installing Stegasoo..."
|
||||||
|
|
||||||
# Clone Stegasoo
|
# Clone Stegasoo
|
||||||
if [ -d "$INSTALL_DIR" ]; then
|
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
|
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
|
# Create systemd service file
|
||||||
sudo tee /etc/systemd/system/stegasoo.service > /dev/null <<EOF
|
sudo tee /etc/systemd/system/stegasoo.service > /dev/null <<EOF
|
||||||
@@ -218,7 +230,7 @@ RestartSec=5
|
|||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
echo -e "${GREEN}[6/6]${NC} Enabling service..."
|
echo -e "${GREEN}[7/7]${NC} Enabling service..."
|
||||||
|
|
||||||
sudo systemctl daemon-reload
|
sudo systemctl daemon-reload
|
||||||
sudo systemctl enable stegasoo.service
|
sudo systemctl enable stegasoo.service
|
||||||
|
|||||||
@@ -2,9 +2,15 @@
|
|||||||
# Stegasoo First Boot Wizard Trigger
|
# Stegasoo First Boot Wizard Trigger
|
||||||
# This file goes in /etc/profile.d/ and runs the wizard on first login
|
# 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
|
if [ -f /etc/stegasoo-first-boot ]; then
|
||||||
# Find the wizard script
|
# 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)
|
WIZARD=$(ls /home/*/stegasoo/rpi/first-boot-wizard.sh 2>/dev/null | head -1)
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "$WIZARD" ]; then
|
if [ -n "$WIZARD" ]; then
|
||||||
bash "$WIZARD"
|
bash "$WIZARD"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user