80 lines
2.3 KiB
Bash
Executable File
80 lines
2.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
echo "========================================="
|
|
echo " Spectra - Inky Impression Installer"
|
|
echo "========================================="
|
|
|
|
# --- Inky library (Raspberry Pi only) ---
|
|
if [[ -f /proc/device-tree/model ]] && grep -qi "raspberry pi" /proc/device-tree/model 2>/dev/null; then
|
|
echo ""
|
|
echo "[1/5] Installing Inky library..."
|
|
if python3 -c "import inky" 2>/dev/null; then
|
|
echo " Inky library already installed, skipping."
|
|
else
|
|
echo " Cloning from Pimoroni..."
|
|
cd /tmp
|
|
git clone --depth=1 https://github.com/pimoroni/inky.git
|
|
cd inky
|
|
./install.sh
|
|
cd /
|
|
rm -rf /tmp/inky
|
|
fi
|
|
else
|
|
echo ""
|
|
echo "[1/5] No Raspberry Pi detected — skipping Inky library install."
|
|
echo " Use --simulate to test without a display."
|
|
fi
|
|
|
|
# --- Python dependencies ---
|
|
echo ""
|
|
echo "[2/5] Installing Python dependencies..."
|
|
python3 -m pip install --upgrade pip
|
|
python3 -m pip install -r requirements.txt
|
|
|
|
# --- Package ---
|
|
echo ""
|
|
echo "[3/5] Installing spectra package..."
|
|
python3 -m pip install -e .
|
|
|
|
# --- Display service ---
|
|
echo ""
|
|
echo "[4/5] Setting up display service..."
|
|
sudo mkdir -p /etc/spectra
|
|
if [[ ! -f /etc/spectra/config.yaml ]]; then
|
|
sudo cp config.yaml /etc/spectra/config.yaml
|
|
echo " Default config copied to /etc/spectra/config.yaml"
|
|
fi
|
|
|
|
sudo cp systemd/spectra.service /etc/systemd/system/
|
|
sudo systemctl daemon-reload
|
|
sudo systemctl enable spectra.service
|
|
echo " Display service enabled"
|
|
|
|
# --- Web service ---
|
|
echo ""
|
|
echo "[5/5] Setting up web interface service..."
|
|
sudo cp systemd/spectra-web.service /etc/systemd/system/
|
|
sudo systemctl daemon-reload
|
|
sudo systemctl enable spectra-web.service
|
|
echo " Web interface service enabled"
|
|
|
|
echo ""
|
|
echo "========================================="
|
|
echo " Installation complete!"
|
|
echo ""
|
|
echo " To configure:"
|
|
echo " sudo nano /etc/spectra/config.yaml"
|
|
echo " (add your Unsplash API access key)"
|
|
echo ""
|
|
echo " Display service:"
|
|
echo " sudo systemctl start spectra"
|
|
echo ""
|
|
echo " Web interface:"
|
|
echo " sudo systemctl start spectra-web"
|
|
echo " http://<raspberry-pi-ip>:5000"
|
|
echo ""
|
|
echo " To test without hardware:"
|
|
echo " spectra --simulate --once"
|
|
echo "========================================="
|