Files
matrix64/install.sh
2025-12-31 11:42:15 +01:00

57 lines
1.6 KiB
Bash

#!/bin/bash
# Installation script for Matrix64 LED Display
# Run this once on your Raspberry Pi
set -e
INSTALL_DIR="/opt/matrix64"
REPO_URL="https://gitlab.kingstudio.es/jocaru/matrix64"
echo "=== Matrix64 LED Display Installation ==="
# Clone or update repository
if [ -d "$INSTALL_DIR" ]; then
echo "Directory exists, updating..."
cd "$INSTALL_DIR"
git pull origin master
else
echo "Cloning repository..."
git clone "$REPO_URL" "$INSTALL_DIR"
cd "$INSTALL_DIR"
fi
# Install Python dependencies
echo "Installing Python dependencies..."
pip3 install -r requirements.txt
# Create .env from example if not exists
if [ ! -f "$INSTALL_DIR/.env" ]; then
echo "Creating .env from template..."
cp "$INSTALL_DIR/.env.example" "$INSTALL_DIR/.env"
echo "IMPORTANT: Edit $INSTALL_DIR/.env with your actual values!"
fi
# Install systemd service
echo "Installing systemd service..."
cp "$INSTALL_DIR/matrix64.service" /etc/systemd/system/
systemctl daemon-reload
systemctl enable matrix64
# Make update script executable
chmod +x "$INSTALL_DIR/update.sh"
# Set up cron job for auto-updates (every 5 minutes)
CRON_JOB="*/5 * * * * $INSTALL_DIR/update.sh"
(crontab -l 2>/dev/null | grep -v "matrix64/update.sh"; echo "$CRON_JOB") | crontab -
echo ""
echo "=== Installation Complete ==="
echo ""
echo "Next steps:"
echo "1. Edit /opt/matrix64/.env with your Home Assistant token and URLs"
echo "2. Start the service: sudo systemctl start matrix64"
echo "3. Check status: sudo systemctl status matrix64"
echo "4. View logs: sudo journalctl -u matrix64 -f"
echo ""
echo "Auto-updates are enabled (every 5 minutes via cron)"