Captures everything needed to redeploy the two-display clock (hour on I2C 0x61, minute on I2C 0x63) on a fresh Pi: - Both systemd units (matrix0x61.service, matrix0x63.service) - Deployed Pimoroni script tree, including the local %I (12-hour) clock customization - Vendored upstream sources (ltp305-python, breakout-garden) so restore is fully offline-capable - Boot config snippet enabling I2C - install.sh that wires it all back up idempotently - Inventory doc cross-referencing every live-system path Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
40 lines
1.3 KiB
Bash
Executable File
40 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Restore the LTP-305G matrix clock setup on a fresh Pi.
|
|
# Run as root (or with sudo). Idempotent.
|
|
|
|
set -euo pipefail
|
|
|
|
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
TARGET_USER="${TARGET_USER:-dissimulo}"
|
|
TARGET_HOME="$(getent passwd "$TARGET_USER" | cut -d: -f6)"
|
|
|
|
if [[ -z "$TARGET_HOME" ]]; then
|
|
echo "User '$TARGET_USER' not found. Create it first or set TARGET_USER." >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [[ $EUID -ne 0 ]]; then
|
|
echo "Run as root (sudo)." >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "==> Installing ltp305 Python package from vendored source"
|
|
pip3 install --break-system-packages "$REPO_DIR/vendor/ltp305-python/library"
|
|
|
|
echo "==> Deploying script tree to $TARGET_HOME/Pimoroni/ltp305"
|
|
mkdir -p "$TARGET_HOME/Pimoroni"
|
|
cp -r "$REPO_DIR/deployed/home/dissimulo/Pimoroni/ltp305" "$TARGET_HOME/Pimoroni/"
|
|
chown -R "$TARGET_USER:$TARGET_USER" "$TARGET_HOME/Pimoroni"
|
|
|
|
echo "==> Installing systemd units"
|
|
install -m 0644 "$REPO_DIR/systemd/matrix0x61.service" /etc/systemd/system/matrix0x61.service
|
|
install -m 0644 "$REPO_DIR/systemd/matrix0x63.service" /etc/systemd/system/matrix0x63.service
|
|
|
|
echo "==> Reloading systemd and enabling units"
|
|
systemctl daemon-reload
|
|
systemctl enable --now matrix0x61.service matrix0x63.service
|
|
|
|
echo
|
|
echo "Done. Status:"
|
|
systemctl --no-pager status matrix0x61.service matrix0x63.service || true
|