Update setup.sh

This commit is contained in:
Chris Frankland-Wright 2025-07-07 18:42:53 +01:00 committed by GitHub
parent ef380969f9
commit c9efb4975c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -17,65 +17,53 @@ echo "Step 1: Updating package lists and upgrading..."
sudo apt update && sudo apt upgrade -y sudo apt update && sudo apt upgrade -y
# --------------------------------------------------------- # ---------------------------------------------------------
# Step 2: Install essential development and serial tools # Step 2: Install core tools and Python requirements
# --------------------------------------------------------- # ---------------------------------------------------------
echo "Step 2: Installing core tools and dependencies..." echo "Step 2: Installing tools and Python libraries..."
sudo apt install -y git curl python3 python3-pip build-essential cmake \ sudo apt install -y git curl python3 python3-pip build-essential cmake \
arduino-cli teensy-loader-cli python3-serial arduino-cli teensy-loader-cli python3-serial
# --------------------------------------------------------- echo "Installing Python package: pylibltc"
# Step 3: Download NTP TimeTurner script
# ---------------------------------------------------------
echo "Step 3: Downloading TimeTurner daemon script..."
cd /home/pi
wget -O timeturner.py https://raw.githubusercontent.com/cjfranko/NTP-Timeturner/master/timeturner.py
chmod +x timeturner.py
# ---------------------------------------------------------
# Step 4: Install Python requirements
# ---------------------------------------------------------
echo "Step 4: Installing Python packages..."
pip3 install --break-system-packages pylibltc pip3 install --break-system-packages pylibltc
# --------------------------------------------------------- # ---------------------------------------------------------
# Step 5: Prepare Teensy 4.0 programming # Step 3: Download and apply splash screen
# --------------------------------------------------------- # ---------------------------------------------------------
echo "Step 5: Configuring Teensy programming environment..." echo "Step 3: Downloading and applying splash screen..."
if [ ! -d "$HOME/teensy-firmware" ]; then
git clone https://github.com/cjfranko/ltc-to-serial-teensy.git "$HOME/teensy-firmware"
fi
cd "$HOME/teensy-firmware"
arduino-cli compile --fqbn arduino:avr:teensy40 .
arduino-cli upload -p /dev/ttyACM0 --fqbn arduino:avr:teensy40 .
# ---------------------------------------------------------
# Step 6: Download and apply splash screen
# ---------------------------------------------------------
echo "Step 6: Downloading and applying custom splash screen..."
cd /home/pi cd /home/pi
wget -O splash.png https://raw.githubusercontent.com/cjfranko/NTP-Timeturner/master/splash.png wget -O splash.png https://raw.githubusercontent.com/cjfranko/NTP-Timeturner/master/splash.png
if [ -f splash.png ]; then if [ -f splash.png ]; then
sudo cp splash.png /usr/share/plymouth/themes/pix/splash.png sudo cp splash.png /usr/share/plymouth/themes/pix/splash.png
sudo chmod 644 /usr/share/plymouth/themes/pix/splash.png sudo chmod 644 /usr/share/plymouth/themes/pix/splash.png
echo "✅ Splash screen updated." echo "✅ Splash screen applied."
else else
echo "⚠️ splash.png not found — skipping." echo "⚠️ splash.png not found — skipping."
fi fi
# --------------------------------------------------------- # ---------------------------------------------------------
# Step 7: Enable systemd service # Step 4: Download Teensy firmware and flash if available
# --------------------------------------------------------- # ---------------------------------------------------------
echo "Step 7: Setting up systemd service..." echo "Step 4: Downloading firmware..."
sudo cp timeturner.service /etc/systemd/system/ cd /home/pi
sudo systemctl daemon-reload wget -O ltc_audiohat_lock.ino.hex https://raw.githubusercontent.com/cjfranko/NTP-Timeturner/master/firmware/ltc_audiohat_lock.ino.hex
sudo systemctl enable timeturner.service
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 & Reboot # Final Message
# --------------------------------------------------------- # ---------------------------------------------------------
echo ""
echo "─────────────────────────────────────────────" echo "─────────────────────────────────────────────"
echo " Setup Complete — Temporal alignment achieved." echo " Setup Complete — Time magic is in place."
echo "─────────────────────────────────────────────" echo "─────────────────────────────────────────────"
echo "Rebooting in 15 seconds to apply settings..." echo "Teensy tools are installed, firmware is ready."
sleep 15 echo "Your Raspberry Pi is now ready for testing."
sudo reboot echo ""