NTP-Timeturner/setup.sh
Chris Frankland-Wright c9efb4975c
Update setup.sh
2025-07-07 18:42:53 +01:00

69 lines
3 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
set -e
echo ""
echo "─────────────────────────────────────────────"
echo " Welcome to the NTP TimeTurner Installer"
echo "─────────────────────────────────────────────"
echo ""
echo "\"It's a very complicated piece of magic...\" Hermione Granger"
echo "Preparing the Ministry-grade temporal interface..."
echo ""
# ---------------------------------------------------------
# Step 1: Update and upgrade packages
# ---------------------------------------------------------
echo "Step 1: Updating package lists and upgrading..."
sudo apt update && sudo apt upgrade -y
# ---------------------------------------------------------
# Step 2: Install core tools and Python requirements
# ---------------------------------------------------------
echo "Step 2: Installing tools and Python libraries..."
sudo apt install -y git curl python3 python3-pip build-essential cmake \
arduino-cli teensy-loader-cli python3-serial
echo "Installing Python package: pylibltc"
pip3 install --break-system-packages pylibltc
# ---------------------------------------------------------
# Step 3: Download and apply splash screen
# ---------------------------------------------------------
echo "Step 3: Downloading and applying splash screen..."
cd /home/pi
wget -O splash.png https://raw.githubusercontent.com/cjfranko/NTP-Timeturner/master/splash.png
if [ -f splash.png ]; then
sudo cp splash.png /usr/share/plymouth/themes/pix/splash.png
sudo chmod 644 /usr/share/plymouth/themes/pix/splash.png
echo "✅ Splash screen applied."
else
echo "⚠️ splash.png not found — skipping."
fi
# ---------------------------------------------------------
# Step 4: Download Teensy firmware and flash if available
# ---------------------------------------------------------
echo "Step 4: Downloading firmware..."
cd /home/pi
wget -O ltc_audiohat_lock.ino.hex https://raw.githubusercontent.com/cjfranko/NTP-Timeturner/master/firmware/ltc_audiohat_lock.ino.hex
echo "Checking for connected Teensy 4.0..."
if ls /dev/ttyACM* 1> /dev/null 2>&1; then
echo "✅ Teensy detected. Flashing firmware..."
teensy-loader-cli --mcu=TEENSY40 -w -v ltc_audiohat_lock.ino.hex
echo "✅ Firmware uploaded successfully."
else
echo "⚠️ No Teensy detected on /dev/ttyACM* — firmware not flashed."
fi
# ---------------------------------------------------------
# Final Message
# ---------------------------------------------------------
echo ""
echo "─────────────────────────────────────────────"
echo " Setup Complete — Time magic is in place."
echo "─────────────────────────────────────────────"
echo "Teensy tools are installed, firmware is ready."
echo "Your Raspberry Pi is now ready for testing."
echo ""