30 lines
764 B
Bash
30 lines
764 B
Bash
#!/bin/bash
|
|
# Update script for Matrix64 LED Display
|
|
# Pulls latest changes from git and restarts service if updated
|
|
|
|
INSTALL_DIR="/opt/matrix64"
|
|
LOGFILE="/var/log/matrix64-update.log"
|
|
|
|
cd "$INSTALL_DIR" || exit 1
|
|
|
|
# Fetch latest changes
|
|
git fetch origin
|
|
|
|
# Check if there are updates
|
|
LOCAL=$(git rev-parse HEAD)
|
|
REMOTE=$(git rev-parse origin/master)
|
|
|
|
if [ "$LOCAL" != "$REMOTE" ]; then
|
|
echo "$(date): Updates found, pulling changes..." >> "$LOGFILE"
|
|
git pull origin master >> "$LOGFILE" 2>&1
|
|
|
|
# Install any new dependencies
|
|
pip3 install -r requirements.txt >> "$LOGFILE" 2>&1
|
|
|
|
# Restart the service
|
|
systemctl restart matrix64
|
|
echo "$(date): Service restarted" >> "$LOGFILE"
|
|
else
|
|
echo "$(date): No updates" >> "$LOGFILE"
|
|
fi
|