0382450f8b
Validate and Test / validate-patches (push) Failing after 12s
- .githooks/pre-push: validate Pd patches via python3 pd-validator - .githooks/post-merge: auto-restart services when systemd/scripts change - install.sh: configure core.hooksPath at install time - justfile deploy: set hooksPath after git pull
30 lines
1.0 KiB
Bash
Executable File
30 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# post-merge: auto-detect changes and reinstall/restart services on the board
|
|
set -euo pipefail
|
|
|
|
REPO="$(cd "$(dirname "$0")/.." && pwd)"
|
|
CHANGED=$(git diff HEAD@{1} --name-only 2>/dev/null || echo "")
|
|
|
|
if [ -z "$CHANGED" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
SYSTEMD_CHANGED=$(echo "$CHANGED" | grep -c "^system/" || true)
|
|
SCRIPT_CHANGED=$(echo "$CHANGED" | grep -c "^scripts/" || true)
|
|
|
|
# Reinstall systemd units if any changed
|
|
if [ "$SYSTEMD_CHANGED" -gt 0 ]; then
|
|
echo "[githook:post-merge] Systemd units changed — reinstalling..."
|
|
sudo systemctl daemon-reload
|
|
fi
|
|
|
|
# Restart services if scripts or systemd changed
|
|
if [ "$SYSTEMD_CHANGED" -gt 0 ] || [ "$SCRIPT_CHANGED" -gt 0 ]; then
|
|
echo "[githook:post-merge] Scripts/services changed — restarting..."
|
|
sudo chmod +x "$REPO/scripts/"*.py "$REPO/scripts/"*.sh 2>/dev/null || true
|
|
for svc in midi-bridge pd-synth-onboard led-matrix-viz prometheus-exporter; do
|
|
sudo systemctl restart "$svc" 2>/dev/null || true
|
|
done
|
|
echo "[githook:post-merge] Services restarted"
|
|
fi
|