From 3f99488ea0da6ca8015bd676aeae99c8289067a4 Mon Sep 17 00:00:00 2001 From: Chris Frankland-Wright Date: Tue, 26 Aug 2025 12:09:53 +0100 Subject: [PATCH 01/24] include yaml --- setup.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index eb1be25..030edea 100644 --- a/setup.sh +++ b/setup.sh @@ -212,6 +212,7 @@ sudo ln -sf $INSTALL_DIR/timeturner $BIN_DIR/timeturner echo "✅ Binary and assets installed to $INSTALL_DIR, and binary linked to $BIN_DIR." # 4. Install systemd service file +# Only needed for Linux systems (e.g., Raspberry Pi OS) if [[ "$(uname)" == "Linux" ]]; then echo "⚙️ Installing systemd service for Linux..." sudo cp timeturner.service /etc/systemd/system/ @@ -226,7 +227,13 @@ echo "" echo "--- Setup Complete ---" echo "The TimeTurner daemon is now installed." echo "The working directory is $INSTALL_DIR." -echo "A default 'config.yml' will be created there on first run." +# Copy default config.yml from repo if it exists +if [ -f config.yml ]; then + sudo cp config.yml $INSTALL_DIR/ + echo "Default 'config.yml' installed to $INSTALL_DIR." +else + echo "⚠️ No default 'config.yml' found in repository. Please add one if needed." +fi echo "" if [[ "$(uname)" == "Linux" ]]; then echo "To start the service, run:" From 24c09fa2333fe422f64b9fe4657ccf06c2c61738 Mon Sep 17 00:00:00 2001 From: Chris Frankland-Wright Date: Sat, 30 Aug 2025 21:07:48 +0100 Subject: [PATCH 02/24] updated setup.sh file --- README.md | 35 ++++++++++++++++++----------------- setup.sh | 7 ++++--- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 720560c..ddab858 100644 --- a/README.md +++ b/README.md @@ -50,36 +50,37 @@ When running as a background daemon, TimeTurner provides a web interface for mon ## 🚀 Installation -The `setup.sh` script is provided to compile and install the TimeTurner application and its systemd service on a Debian-based system like Raspberry Pi OS. +The `setup.sh` script compiles and installs the TimeTurner application. You can run it by cloning the repository with `git` or by using the `curl` command below for a git-free installation. ### Prerequisites -- **Rust and Cargo**: The script requires the Rust programming language toolchain. If you don't have it, install it from [rustup.rs](https://rustup.rs/). +- **Internet Connection**: To download dependencies. +- **Curl and Unzip**: The script requires `curl` to download files and `unzip` for the git-free method. The setup script will attempt to install these if they are missing. -### Running the Installer +### Running the Installer (Recommended) -1. First, clone the repository: - ```bash - git clone https://github.com/cjfranko/NTP-Timeturner.git - cd NTP-Timeturner - ``` -2. Make the script executable and run it. The script will use `sudo` for commands that require root privileges, so it may ask for your password. - ```bash - chmod +x setup.sh - ./setup.sh - ``` +This command downloads the latest version, unpacks it, and runs the setup script. Paste it into your Raspberry Pi terminal: + +```bash +curl -L https://github.com/cjfranko/NTP-Timeturner/archive/refs/heads/main.zip -o NTP-Timeturner.zip && \ +unzip NTP-Timeturner.zip && \ +cd NTP-Timeturner-main && \ +chmod +x setup.sh && \ +./setup.sh +``` ### What the Script Does The installation script automates the following steps: -1. **Compiles the Binary**: Runs `cargo build --release` to create an optimised executable. -2. **Creates Directories**: Creates `/opt/timeturner` to store the application files. -3. **Installs Files**: +1. **Installs Dependencies**: Installs `git`, `curl`, `unzip`, and necessary build tools. +2. **Compiles the Binary**: Runs `cargo build --release` to create an optimised executable. +3. **Creates Directories**: Creates `/opt/timeturner` to store the application files. +4. **Installs Files**: - The compiled binary is copied to `/opt/timeturner/timeturner`. - The web interface assets from the `static/` directory are copied to `/opt/timeturner/static`. - A symbolic link is created from `/usr/local/bin/timeturner` to the binary, allowing it to be run from any location. -4. **Sets up Systemd Service**: +5. **Sets up Systemd Service**: - Copies the `timeturner.service` file to `/etc/systemd/system/`. - Enables the service to start automatically on system boot. diff --git a/setup.sh b/setup.sh index 030edea..f2f83ce 100644 --- a/setup.sh +++ b/setup.sh @@ -21,7 +21,8 @@ echo "Detected package manager: $PKG_MANAGER" # --- Update System Packages --- echo "Updating system packages..." if [ "$PKG_MANAGER" == "apt" ]; then - sudo apt update && sudo apt upgrade -y + sudo apt update + sudo DEBIAN_FRONTEND=noninteractive apt upgrade -y -o Dpkg::Options::="--force-confold" elif [ "$PKG_MANAGER" == "dnf" ]; then sudo dnf upgrade -y elif [ "$PKG_MANAGER" == "pacman" ]; then @@ -100,10 +101,10 @@ echo "Removing NTPD (if installed) and installing Chrony, NMTUI, Adjtimex..." if [ "$PKG_MANAGER" == "apt" ]; then sudo apt update sudo apt remove -y ntp || true # Remove ntp if it exists, ignore if not - sudo apt install -y chrony nmtui adjtimex + sudo apt install -y chrony network-manager adjtimex sudo systemctl enable chrony --now elif [ "$PKG_MANAGER" == "dnf" ]; then - sudo dnf remove -y ntp || true + sudo dnf remove -y ntp sudo dnf install -y chrony NetworkManager-tui adjtimex sudo systemctl enable chronyd --now elif [ "$PKG_MANAGER" == "pacman" ]; then From 5eb706601f52055935a6ef68a1512727c8ac889b Mon Sep 17 00:00:00 2001 From: Chris Frankland-Wright Date: Sat, 30 Aug 2025 21:14:09 +0100 Subject: [PATCH 03/24] updated for nodogsplash --- setup.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/setup.sh b/setup.sh index f2f83ce..fb41b30 100644 --- a/setup.sh +++ b/setup.sh @@ -125,6 +125,14 @@ if [ "$PKG_MANAGER" == "apt" ]; then sudo systemctl unmask hostapd sudo systemctl enable hostapd sudo systemctl enable nodogsplash +elif [ "$PKG_MANAGER" == "dnf" ]; then + sudo dnf install -y hostapd dnsmasq nodogsplash + sudo systemctl enable hostapd + sudo systemctl enable nodogsplash +elif [ "$PKG_MANAGER" == "pacman" ]; then + sudo pacman -Sy --noconfirm hostapd dnsmasq nodogsplash + sudo systemctl enable hostapd + sudo systemctl enable nodogsplash fi # Stop services to configure From 762f872e7c047e9073766d593db33cc5e5519fe2 Mon Sep 17 00:00:00 2001 From: Chris Frankland-Wright Date: Sat, 30 Aug 2025 21:17:39 +0100 Subject: [PATCH 04/24] updated to pull directly --- setup.sh | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/setup.sh b/setup.sh index fb41b30..8638ffa 100644 --- a/setup.sh +++ b/setup.sh @@ -121,18 +121,40 @@ echo "NTPD removed (if present). Chrony, NMTUI, and Adjtimex installed and confi echo "📡 Installing and configuring WiFi hotspot and captive portal..." if [ "$PKG_MANAGER" == "apt" ]; then - sudo apt install -y hostapd dnsmasq nodogsplash + # Install dependencies, but handle nodogsplash separately + sudo apt install -y hostapd dnsmasq + + # Check architecture + ARCH=$(dpkg --print-architecture) + if [ "$ARCH" == "armhf" ]; then + NDS_DEB_URL="https://github.com/nodogsplash/nodogsplash/releases/download/v5.0.1/nodogsplash_5.0.1-1_armhf.deb" + elif [ "$ARCH" == "arm64" ]; then + NDS_DEB_URL="https://github.com/nodogsplash/nodogsplash/releases/download/v5.0.1/nodogsplash_5.0.1-1_arm64.deb" + else + echo "Unsupported architecture for nodogsplash deb: $ARCH. Please install manually." + exit 1 + fi + + echo "Downloading nodogsplash for $ARCH..." + curl -L "$NDS_DEB_URL" -o /tmp/nodogsplash.deb + + echo "Installing nodogsplash..." + sudo dpkg -i /tmp/nodogsplash.deb + # Install any missing dependencies for nodogsplash + sudo apt-get install -f -y + rm /tmp/nodogsplash.deb + sudo systemctl unmask hostapd sudo systemctl enable hostapd sudo systemctl enable nodogsplash elif [ "$PKG_MANAGER" == "dnf" ]; then - sudo dnf install -y hostapd dnsmasq nodogsplash + sudo dnf install -y hostapd dnsmasq + echo "Warning: nodogsplash is not available in standard dnf repositories. Please install it manually." sudo systemctl enable hostapd - sudo systemctl enable nodogsplash elif [ "$PKG_MANAGER" == "pacman" ]; then - sudo pacman -Sy --noconfirm hostapd dnsmasq nodogsplash + sudo pacman -Sy --noconfirm hostapd dnsmasq + echo "Warning: nodogsplash is not available in standard pacman repositories. Please install it manually from AUR." sudo systemctl enable hostapd - sudo systemctl enable nodogsplash fi # Stop services to configure From baf674edd8c0c7b7dd0c0e6c19064c6dd09eaccb Mon Sep 17 00:00:00 2001 From: Chris Frankland-Wright Date: Sat, 30 Aug 2025 21:20:26 +0100 Subject: [PATCH 05/24] updated version of dogsplash --- setup.sh | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/setup.sh b/setup.sh index 8638ffa..f8db608 100644 --- a/setup.sh +++ b/setup.sh @@ -127,9 +127,9 @@ if [ "$PKG_MANAGER" == "apt" ]; then # Check architecture ARCH=$(dpkg --print-architecture) if [ "$ARCH" == "armhf" ]; then - NDS_DEB_URL="https://github.com/nodogsplash/nodogsplash/releases/download/v5.0.1/nodogsplash_5.0.1-1_armhf.deb" + NDS_DEB_URL="https://github.com/nodogsplash/nodogsplash/releases/download/v6.0.0/nodogsplash_6.0.0-1_armhf.deb" elif [ "$ARCH" == "arm64" ]; then - NDS_DEB_URL="https://github.com/nodogsplash/nodogsplash/releases/download/v5.0.1/nodogsplash_5.0.1-1_arm64.deb" + NDS_DEB_URL="https://github.com/nodogsplash/nodogsplash/releases/download/v6.0.0/nodogsplash_6.0.0-1_arm64.deb" else echo "Unsupported architecture for nodogsplash deb: $ARCH. Please install manually." exit 1 @@ -138,6 +138,13 @@ if [ "$PKG_MANAGER" == "apt" ]; then echo "Downloading nodogsplash for $ARCH..." curl -L "$NDS_DEB_URL" -o /tmp/nodogsplash.deb + # Verify that the downloaded file is a debian package + if ! dpkg-deb -I /tmp/nodogsplash.deb >/dev/null 2>&1; then + echo "❌ Error: Downloaded file is not a valid Debian package. Please check the URL and your connection." + rm /tmp/nodogsplash.deb + exit 1 + fi + echo "Installing nodogsplash..." sudo dpkg -i /tmp/nodogsplash.deb # Install any missing dependencies for nodogsplash @@ -147,20 +154,18 @@ if [ "$PKG_MANAGER" == "apt" ]; then sudo systemctl unmask hostapd sudo systemctl enable hostapd sudo systemctl enable nodogsplash -elif [ "$PKG_MANAGER" == "dnf" ]; then - sudo dnf install -y hostapd dnsmasq - echo "Warning: nodogsplash is not available in standard dnf repositories. Please install it manually." - sudo systemctl enable hostapd -elif [ "$PKG_MANAGER" == "pacman" ]; then - sudo pacman -Sy --noconfirm hostapd dnsmasq - echo "Warning: nodogsplash is not available in standard pacman repositories. Please install it manually from AUR." - sudo systemctl enable hostapd +else + echo "This script is designed for Debian-based systems like Raspberry Pi OS." + echo "Skipping WiFi hotspot setup." fi # Stop services to configure -sudo systemctl stop hostapd -sudo systemctl stop dnsmasq -sudo systemctl stop nodogsplash +# Ensure services exist before trying to stop them +sudo systemctl stop hostapd || true +sudo systemctl stop dnsmasq || true +if command -v nodogsplash &> /dev/null; then + sudo systemctl stop nodogsplash || true +fi # Configure static IP for wlan0 echo "Configuring static IP for wlan0..." From dad5c2d06a70d20d3d711db73b976afd21e90f34 Mon Sep 17 00:00:00 2001 From: Chris Frankland-Wright Date: Sat, 30 Aug 2025 21:37:25 +0100 Subject: [PATCH 06/24] update to pull nodogsplash and configure --- setup.sh | 51 ++++++++++++++++++++------------------------------- 1 file changed, 20 insertions(+), 31 deletions(-) diff --git a/setup.sh b/setup.sh index f8db608..d12b45b 100644 --- a/setup.sh +++ b/setup.sh @@ -49,9 +49,9 @@ fi echo "Installing common build dependencies..." if [ "$PKG_MANAGER" == "apt" ]; then sudo apt update - sudo apt install -y build-essential libudev-dev pkg-config curl + sudo apt install -y build-essential libudev-dev pkg-config curl wget elif [ "$PKG_MANAGER" == "dnf" ]; then - sudo dnf install -y gcc make perl-devel libudev-devel pkg-config curl + sudo dnf install -y gcc make perl-devel libudev-devel pkg-config curl wget elif [ "$PKG_MANAGER" == "pacman" ]; then sudo pacman -Sy --noconfirm base-devel libudev pkg-config curl fi @@ -121,35 +121,22 @@ echo "NTPD removed (if present). Chrony, NMTUI, and Adjtimex installed and confi echo "📡 Installing and configuring WiFi hotspot and captive portal..." if [ "$PKG_MANAGER" == "apt" ]; then - # Install dependencies, but handle nodogsplash separately - sudo apt install -y hostapd dnsmasq + # Install dependencies for hotspot and for building nodogsplash + sudo apt install -y hostapd dnsmasq git libmicrohttpd-dev - # Check architecture - ARCH=$(dpkg --print-architecture) - if [ "$ARCH" == "armhf" ]; then - NDS_DEB_URL="https://github.com/nodogsplash/nodogsplash/releases/download/v6.0.0/nodogsplash_6.0.0-1_armhf.deb" - elif [ "$ARCH" == "arm64" ]; then - NDS_DEB_URL="https://github.com/nodogsplash/nodogsplash/releases/download/v6.0.0/nodogsplash_6.0.0-1_arm64.deb" - else - echo "Unsupported architecture for nodogsplash deb: $ARCH. Please install manually." - exit 1 - fi + echo "Building and installing nodogsplash from source..." + # Create a temporary directory for the build + BUILD_DIR=$(mktemp -d) + git clone https://github.com/nodogsplash/nodogsplash.git "$BUILD_DIR" - echo "Downloading nodogsplash for $ARCH..." - curl -L "$NDS_DEB_URL" -o /tmp/nodogsplash.deb + cd "$BUILD_DIR" + make + sudo make install - # Verify that the downloaded file is a debian package - if ! dpkg-deb -I /tmp/nodogsplash.deb >/dev/null 2>&1; then - echo "❌ Error: Downloaded file is not a valid Debian package. Please check the URL and your connection." - rm /tmp/nodogsplash.deb - exit 1 - fi - - echo "Installing nodogsplash..." - sudo dpkg -i /tmp/nodogsplash.deb - # Install any missing dependencies for nodogsplash - sudo apt-get install -f -y - rm /tmp/nodogsplash.deb + # Clean up the build directory + cd .. + sudo rm -rf "$BUILD_DIR" + echo "✅ nodogsplash installed successfully." sudo systemctl unmask hostapd sudo systemctl enable hostapd @@ -209,10 +196,12 @@ echo "Configuring nodogsplash..." sudo tee /etc/nodogsplash/nodogsplash.conf > /dev/null < Date: Sat, 30 Aug 2025 21:40:15 +0100 Subject: [PATCH 07/24] install json handler --- setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index d12b45b..29e0bfd 100644 --- a/setup.sh +++ b/setup.sh @@ -122,7 +122,7 @@ echo "📡 Installing and configuring WiFi hotspot and captive portal..." if [ "$PKG_MANAGER" == "apt" ]; then # Install dependencies for hotspot and for building nodogsplash - sudo apt install -y hostapd dnsmasq git libmicrohttpd-dev + sudo apt install -y hostapd dnsmasq git libmicrohttpd-dev libjson-c-dev echo "Building and installing nodogsplash from source..." # Create a temporary directory for the build From 0e7b583829baf532456cb1ab27a5d1a92e727e0e Mon Sep 17 00:00:00 2001 From: Chris Frankland-Wright Date: Sat, 30 Aug 2025 21:43:00 +0100 Subject: [PATCH 08/24] fix bug with service creation --- setup.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/setup.sh b/setup.sh index 29e0bfd..d14f337 100644 --- a/setup.sh +++ b/setup.sh @@ -133,6 +133,17 @@ if [ "$PKG_MANAGER" == "apt" ]; then make sudo make install + # Manually install the systemd service file as 'make install' might not do it. + # This makes the script more robust. + if [ -f "debian/nodogsplash.service" ]; then + echo "Manually installing systemd service file..." + sudo cp debian/nodogsplash.service /etc/systemd/system/nodogsplash.service + # Reload systemd to recognize the new service + sudo systemctl daemon-reload + else + echo "⚠️ Warning: nodogsplash.service file not found in source. Cannot set up as a service." + fi + # Clean up the build directory cd .. sudo rm -rf "$BUILD_DIR" From 57de9a98a5fa734aa3769cd0b709d662bc2f310c Mon Sep 17 00:00:00 2001 From: Chris Frankland-Wright Date: Sat, 30 Aug 2025 21:46:38 +0100 Subject: [PATCH 09/24] updated to network-manager --- setup.sh | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 62 insertions(+), 6 deletions(-) diff --git a/setup.sh b/setup.sh index d14f337..9346bcf 100644 --- a/setup.sh +++ b/setup.sh @@ -165,10 +165,64 @@ if command -v nodogsplash &> /dev/null; then sudo systemctl stop nodogsplash || true fi -# Configure static IP for wlan0 -echo "Configuring static IP for wlan0..." -sudo sed -i '/^interface wlan0/d' /etc/dhcpcd.conf -sudo tee -a /etc/dhcpcd.conf > /dev/null < /dev/null < /dev/null < /dev/null; then + sudo systemctl restart nodogsplash +fi echo "✅ WiFi hotspot and captive portal configured. SSID: TimeTurner, IP: 10.0.252.1" echo "Clients will be redirected to http://10.0.252.1/static/index.html" @@ -276,7 +332,7 @@ if [[ "$(uname)" == "Linux" ]]; then echo " sudo systemctl start timeturner.service" echo "" echo "To view live logs, run:" - echo " journalctl -u timeturner.service -f" + echo " journalctl -u tim_turner.service -f" echo "" fi echo "To run the interactive TUI instead, simply run from the project directory:" From 1caa09ac4656643d4f7c731b530622f34be6d227 Mon Sep 17 00:00:00 2001 From: Chris Frankland-Wright Date: Sat, 30 Aug 2025 21:51:03 +0100 Subject: [PATCH 10/24] added delay in process --- setup.sh | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/setup.sh b/setup.sh index 9346bcf..4dcbbe7 100644 --- a/setup.sh +++ b/setup.sh @@ -271,12 +271,27 @@ FirewallRuleSet preauthenticated-users { RedirectURL http://10.0.252.1/static/index.html EOF -# Restart services +# Restart services in the correct order and add delays to prevent race conditions +echo "Restarting services..." sudo systemctl restart dhcpcd -sudo systemctl restart dnsmasq sudo systemctl restart hostapd -if command -v nodogsplash &> /dev/null; then - sudo systemctl restart nodogsplash + +# Wait for the interface to come up and get the IP address +echo "Waiting for wlan0 to be configured..." +sleep 5 # Give services a moment to start + +# Check for the IP address before starting nodogsplash +IP_CHECK=$(ip -4 addr show wlan0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}') +if [ "$IP_CHECK" == "10.0.252.1" ]; then + echo "✅ wlan0 configured with IP $IP_CHECK." + sudo systemctl restart dnsmasq + if command -v nodogsplash &> /dev/null; then + sudo systemctl restart nodogsplash + fi +else + echo "❌ Error: wlan0 failed to get the static IP 10.0.252.1. Found: '$IP_CHECK'." + echo "Please check 'sudo systemctl status hostapd' and 'sudo systemctl status dhcpcd'." + exit 1 fi echo "✅ WiFi hotspot and captive portal configured. SSID: TimeTurner, IP: 10.0.252.1" From 5ca32b6f36f1965990cd336af77df0f5df871af4 Mon Sep 17 00:00:00 2001 From: Chris Frankland-Wright Date: Sat, 30 Aug 2025 21:54:17 +0100 Subject: [PATCH 11/24] premature exit issue --- setup.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/setup.sh b/setup.sh index 4dcbbe7..e941f6f 100644 --- a/setup.sh +++ b/setup.sh @@ -278,10 +278,19 @@ sudo systemctl restart hostapd # Wait for the interface to come up and get the IP address echo "Waiting for wlan0 to be configured..." -sleep 5 # Give services a moment to start +IP_CHECK="" +# Loop for up to 30 seconds waiting for the IP +for i in {1..15}; do + # The '|| true' prevents the script from exiting if grep finds no match + IP_CHECK=$(ip -4 addr show wlan0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}' || true) + if [ "$IP_CHECK" == "10.0.252.1" ]; then + break + fi + echo "Still waiting for IP..." + sleep 2 +done # Check for the IP address before starting nodogsplash -IP_CHECK=$(ip -4 addr show wlan0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}') if [ "$IP_CHECK" == "10.0.252.1" ]; then echo "✅ wlan0 configured with IP $IP_CHECK." sudo systemctl restart dnsmasq From cc1335f1a9c77edc9ac014defeb25aead08163ad Mon Sep 17 00:00:00 2001 From: Chris Frankland-Wright Date: Sat, 30 Aug 2025 21:56:44 +0100 Subject: [PATCH 12/24] blah --- setup.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index e941f6f..9a85c3b 100644 --- a/setup.sh +++ b/setup.sh @@ -122,8 +122,13 @@ echo "📡 Installing and configuring WiFi hotspot and captive portal..." if [ "$PKG_MANAGER" == "apt" ]; then # Install dependencies for hotspot and for building nodogsplash - sudo apt install -y hostapd dnsmasq git libmicrohttpd-dev libjson-c-dev + sudo apt install -y hostapd dnsmasq git libmicrohttpd-dev libjson-c-dev iptables + # Force iptables-legacy for nodogsplash compatibility + echo "Setting iptables-legacy mode for nodogsplash..." + sudo update-alternatives --set iptables /usr/sbin/iptables-legacy + sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy + echo "Building and installing nodogsplash from source..." # Create a temporary directory for the build BUILD_DIR=$(mktemp -d) From e19b50fe2bc6c6aeff63998788a4965f12904cce Mon Sep 17 00:00:00 2001 From: Chris Frankland-Wright Date: Sat, 30 Aug 2025 22:01:11 +0100 Subject: [PATCH 13/24] moved nodogsplash to nmtui --- setup.sh | 78 +++++++++++++------------------------------------------- 1 file changed, 18 insertions(+), 60 deletions(-) diff --git a/setup.sh b/setup.sh index 9a85c3b..9523e4c 100644 --- a/setup.sh +++ b/setup.sh @@ -172,66 +172,24 @@ fi # Configure static IP for wlan0 using NetworkManager (nmcli) echo "Configuring static IP for wlan0 using NetworkManager..." -# Check if a connection for wlan0 already exists and delete it to start fresh -if nmcli -t -f NAME,DEVICE c show --active | grep -q "wlan0"; then - ACTIVE_CON=$(nmcli -t -f NAME,DEVICE c show --active | grep "wlan0" | cut -d':' -f1) - echo "Temporarily deactivating existing connection on wlan0: $ACTIVE_CON" - sudo nmcli c down "$ACTIVE_CON" || true + +# Define the connection name +CON_NAME="TimeTurner-AP" + +# If a connection with this name already exists, delete it to ensure a clean slate. +if nmcli c show --active | grep -q "$CON_NAME"; then + sudo nmcli c down "$CON_NAME" || true +fi +if nmcli c show | grep -q "$CON_NAME"; then + echo "Deleting existing '$CON_NAME' connection profile..." + sudo nmcli c delete "$CON_NAME" || true fi -# Create a new connection profile for the AP -# This sets the static IP and configures it to not manage this interface for other connections. -sudo tee /etc/NetworkManager/conf.d/99-unmanaged-wlan0.conf > /dev/null < /dev/null < Date: Sat, 30 Aug 2025 22:05:09 +0100 Subject: [PATCH 14/24] more network config --- setup.sh | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/setup.sh b/setup.sh index 9523e4c..dbbb3f9 100644 --- a/setup.sh +++ b/setup.sh @@ -154,8 +154,9 @@ if [ "$PKG_MANAGER" == "apt" ]; then sudo rm -rf "$BUILD_DIR" echo "✅ nodogsplash installed successfully." - sudo systemctl unmask hostapd - sudo systemctl enable hostapd + # Disable the standalone hostapd service to let NetworkManager manage it. + sudo systemctl disable hostapd + sudo systemctl mask hostapd sudo systemctl enable nodogsplash else echo "This script is designed for Debian-based systems like Raspberry Pi OS." @@ -189,6 +190,8 @@ fi echo "Creating new '$CON_NAME' connection profile..." sudo nmcli c add type wifi ifname wlan0 con-name "$CON_NAME" autoconnect yes ssid "TimeTurner" sudo nmcli c modify "$CON_NAME" 802-11-wireless.mode ap 802-11-wireless.band bg +sudo nmcli c modify "$CON_NAME" 802-11-wireless-security.key-mgmt wpa-psk +sudo nmcli c modify "$CON_NAME" 802-11-wireless-security.psk "harry-ron-hermione" sudo nmcli c modify "$CON_NAME" ipv4.method manual ipv4.addresses 10.0.252.1/24 # Configure dnsmasq for DHCP @@ -199,26 +202,6 @@ dhcp-range=10.0.252.10,10.0.252.50,255.255.255.0,24h address=/#/10.0.252.1 EOF -# Configure hostapd -echo "Configuring hostapd..." -sudo tee /etc/hostapd/hostapd.conf > /dev/null < /dev/null < Date: Sat, 30 Aug 2025 22:07:17 +0100 Subject: [PATCH 15/24] asdfghjk --- setup.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/setup.sh b/setup.sh index dbbb3f9..2b69b8f 100644 --- a/setup.sh +++ b/setup.sh @@ -171,6 +171,12 @@ if command -v nodogsplash &> /dev/null; then sudo systemctl stop nodogsplash || true fi +# Ensure NetworkManager is managing wlan0 by removing any conflicting configurations. +# This is the critical fix for the "No suitable device" error. +echo "Ensuring NetworkManager is managing wlan0..." +sudo rm -f /etc/NetworkManager/conf.d/99-unmanaged-wlan0.conf +sudo systemctl reload NetworkManager + # Configure static IP for wlan0 using NetworkManager (nmcli) echo "Configuring static IP for wlan0 using NetworkManager..." From a764b4d4ad4e47c7227c68681b33a92d3870b7d6 Mon Sep 17 00:00:00 2001 From: Chris Frankland-Wright Date: Sat, 30 Aug 2025 22:12:32 +0100 Subject: [PATCH 16/24] remove dnsmasq --- setup.sh | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/setup.sh b/setup.sh index 2b69b8f..9b4851e 100644 --- a/setup.sh +++ b/setup.sh @@ -121,10 +121,14 @@ echo "NTPD removed (if present). Chrony, NMTUI, and Adjtimex installed and confi echo "📡 Installing and configuring WiFi hotspot and captive portal..." if [ "$PKG_MANAGER" == "apt" ]; then - # Install dependencies for hotspot and for building nodogsplash - sudo apt install -y hostapd dnsmasq git libmicrohttpd-dev libjson-c-dev iptables + # Ensure dnsmasq is removed to prevent conflicts with nodogsplash's DHCP server. + echo "Removing dnsmasq to prevent conflicts..." + sudo apt-get remove --purge -y dnsmasq || true + + # Install dependencies for hotspot and for building nodogsplash. dnsmasq is no longer needed. + sudo apt install -y hostapd git libmicrohttpd-dev libjson-c-dev iptables - # Force iptables-legacy for nodogsplash compatibility + # Force iptables-legacy for nodogsplash echo "Setting iptables-legacy mode for nodogsplash..." sudo update-alternatives --set iptables /usr/sbin/iptables-legacy sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy @@ -166,7 +170,7 @@ fi # Stop services to configure # Ensure services exist before trying to stop them sudo systemctl stop hostapd || true -sudo systemctl stop dnsmasq || true +# sudo systemctl stop dnsmasq || true # dnsmasq is no longer used if command -v nodogsplash &> /dev/null; then sudo systemctl stop nodogsplash || true fi @@ -200,21 +204,25 @@ sudo nmcli c modify "$CON_NAME" 802-11-wireless-security.key-mgmt wpa-psk sudo nmcli c modify "$CON_NAME" 802-11-wireless-security.psk "harry-ron-hermione" sudo nmcli c modify "$CON_NAME" ipv4.method manual ipv4.addresses 10.0.252.1/24 -# Configure dnsmasq for DHCP -echo "Configuring dnsmasq..." -sudo tee /etc/dnsmasq.conf > /dev/null < /dev/null < /dev/null < /dev/null; then sudo systemctl restart nodogsplash fi From 360e0751f290ada0ba9ef2380a68650b55cfbac4 Mon Sep 17 00:00:00 2001 From: Chris Frankland-Wright Date: Sat, 30 Aug 2025 22:16:04 +0100 Subject: [PATCH 17/24] ugh... --- setup.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/setup.sh b/setup.sh index 9b4851e..630137a 100644 --- a/setup.sh +++ b/setup.sh @@ -253,13 +253,24 @@ done # Check for the IP address before starting nodogsplash if [ "$IP_CHECK" == "10.0.252.1" ]; then echo "✅ wlan0 configured with IP $IP_CHECK." - # sudo systemctl restart dnsmasq # dnsmasq is no longer used if command -v nodogsplash &> /dev/null; then - sudo systemctl restart nodogsplash + echo "Attempting to start nodogsplash service..." + if ! sudo systemctl restart nodogsplash; then + echo "❌ nodogsplash service failed to start. Displaying logs..." + # Give a moment for logs to be written + sleep 2 + sudo journalctl -u nodogsplash.service --no-pager -n 50 + echo "" + echo "To debug further, run nodogsplash in the foreground with this command:" + echo " sudo /usr/bin/nodogsplash -f -d 7" + echo "" + exit 1 + fi + echo "✅ nodogsplash service started successfully." fi else echo "❌ Error: wlan0 failed to get the static IP 10.0.252.1. Found: '$IP_CHECK'." - echo "Please check 'sudo systemctl status hostapd' and 'sudo systemctl status dhcpcd'." + echo "Please check 'sudo nmcli c show \"$CON_NAME\"' and 'ip addr show wlan0'." exit 1 fi From 3c73a0487ba0ddcaab0e9b6d0254e586ca3bca81 Mon Sep 17 00:00:00 2001 From: Chris Frankland-Wright Date: Sat, 30 Aug 2025 22:19:30 +0100 Subject: [PATCH 18/24] fix nodog install issue --- setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.sh b/setup.sh index 630137a..4623dc5 100644 --- a/setup.sh +++ b/setup.sh @@ -218,7 +218,7 @@ sudo tee /etc/nodogsplash/nodogsplash.conf > /dev/null < Date: Sat, 30 Aug 2025 22:22:02 +0100 Subject: [PATCH 19/24] renambled dns thing --- setup.sh | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/setup.sh b/setup.sh index 4623dc5..75369df 100644 --- a/setup.sh +++ b/setup.sh @@ -121,12 +121,11 @@ echo "NTPD removed (if present). Chrony, NMTUI, and Adjtimex installed and confi echo "📡 Installing and configuring WiFi hotspot and captive portal..." if [ "$PKG_MANAGER" == "apt" ]; then - # Ensure dnsmasq is removed to prevent conflicts with nodogsplash's DHCP server. - echo "Removing dnsmasq to prevent conflicts..." - sudo apt-get remove --purge -y dnsmasq || true + # We will use dnsmasq for DHCP, as the compiled nodogsplash version may not support the internal DHCP server. + # sudo apt-get remove --purge -y dnsmasq || true # This line is no longer needed. - # Install dependencies for hotspot and for building nodogsplash. dnsmasq is no longer needed. - sudo apt install -y hostapd git libmicrohttpd-dev libjson-c-dev iptables + # Install dependencies for hotspot and for building nodogsplash. + sudo apt install -y hostapd dnsmasq git libmicrohttpd-dev libjson-c-dev iptables # Force iptables-legacy for nodogsplash echo "Setting iptables-legacy mode for nodogsplash..." @@ -170,7 +169,7 @@ fi # Stop services to configure # Ensure services exist before trying to stop them sudo systemctl stop hostapd || true -# sudo systemctl stop dnsmasq || true # dnsmasq is no longer used +sudo systemctl stop dnsmasq || true if command -v nodogsplash &> /dev/null; then sudo systemctl stop nodogsplash || true fi @@ -204,25 +203,21 @@ sudo nmcli c modify "$CON_NAME" 802-11-wireless-security.key-mgmt wpa-psk sudo nmcli c modify "$CON_NAME" 802-11-wireless-security.psk "harry-ron-hermione" sudo nmcli c modify "$CON_NAME" ipv4.method manual ipv4.addresses 10.0.252.1/24 -# dnsmasq is no longer used. nodogsplash will handle DHCP. -# echo "Configuring dnsmasq..." -# sudo tee /etc/dnsmasq.conf > /dev/null < /dev/null < /dev/null < /dev/null; then echo "Attempting to start nodogsplash service..." if ! sudo systemctl restart nodogsplash; then From ac035a8e0b766ccd123e1db3c6e002786cc9c718 Mon Sep 17 00:00:00 2001 From: Chris Frankland-Wright Date: Sat, 30 Aug 2025 22:27:28 +0100 Subject: [PATCH 20/24] fix tmp and install python --- setup.sh | 44 +++++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/setup.sh b/setup.sh index 75369df..8fb5965 100644 --- a/setup.sh +++ b/setup.sh @@ -57,6 +57,18 @@ elif [ "$PKG_MANAGER" == "pacman" ]; then fi echo "Common build dependencies installed." +# --- Install Python dependencies for testing --- +echo "🐍 Installing Python dependencies for test scripts..." +if [ "$PKG_MANAGER" == "apt" ]; then + sudo apt install -y python3 python3-pip +elif [ "$PKG_MANAGER" == "dnf" ]; then + sudo dnf install -y python3 python3-pip +elif [ "$PKG_MANAGER" == "pacman" ]; then + sudo pacman -Sy --noconfirm python python-pip +fi +sudo pip3 install pyserial +echo "✅ Python dependencies installed." + # --- Apply custom splash screen --- if [[ "$(uname)" == "Linux" ]]; then echo "🖼️ Applying custom splash screen..." @@ -137,23 +149,25 @@ if [ "$PKG_MANAGER" == "apt" ]; then BUILD_DIR=$(mktemp -d) git clone https://github.com/nodogsplash/nodogsplash.git "$BUILD_DIR" - cd "$BUILD_DIR" - make - sudo make install - - # Manually install the systemd service file as 'make install' might not do it. - # This makes the script more robust. - if [ -f "debian/nodogsplash.service" ]; then - echo "Manually installing systemd service file..." - sudo cp debian/nodogsplash.service /etc/systemd/system/nodogsplash.service - # Reload systemd to recognize the new service - sudo systemctl daemon-reload - else - echo "⚠️ Warning: nodogsplash.service file not found in source. Cannot set up as a service." - fi + # Run the build in a subshell to isolate the directory change + ( + cd "$BUILD_DIR" + make + sudo make install + + # Manually install the systemd service file as 'make install' might not do it. + # This makes the script more robust. + if [ -f "debian/nodogsplash.service" ]; then + echo "Manually installing systemd service file..." + sudo cp debian/nodogsplash.service /etc/systemd/system/nodogsplash.service + # Reload systemd to recognize the new service + sudo systemctl daemon-reload + else + echo "⚠️ Warning: nodogsplash.service file not found in source. Cannot set up as a service." + fi + ) # Clean up the build directory - cd .. sudo rm -rf "$BUILD_DIR" echo "✅ nodogsplash installed successfully." From 6221eea98ced4d482ff443c09466ac2a435c55dd Mon Sep 17 00:00:00 2001 From: Chris Frankland-Wright Date: Sat, 30 Aug 2025 22:29:25 +0100 Subject: [PATCH 21/24] removed pip for install --- setup.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/setup.sh b/setup.sh index 8fb5965..39a7b88 100644 --- a/setup.sh +++ b/setup.sh @@ -60,13 +60,16 @@ echo "Common build dependencies installed." # --- Install Python dependencies for testing --- echo "🐍 Installing Python dependencies for test scripts..." if [ "$PKG_MANAGER" == "apt" ]; then - sudo apt install -y python3 python3-pip + # python3-serial is the name for pyserial in apt + sudo apt install -y python3 python3-pip python3-serial elif [ "$PKG_MANAGER" == "dnf" ]; then - sudo dnf install -y python3 python3-pip + # python3-pyserial is the name for pyserial in dnf + sudo dnf install -y python3 python3-pip python3-pyserial elif [ "$PKG_MANAGER" == "pacman" ]; then - sudo pacman -Sy --noconfirm python python-pip + # python-pyserial is the name for pyserial in pacman + sudo pacman -Sy --noconfirm python python-pip python-pyserial fi -sudo pip3 install pyserial +# sudo pip3 install pyserial # This is replaced by the native package manager installs above echo "✅ Python dependencies installed." # --- Apply custom splash screen --- From 169c9b9aeff6e46853946e1b7ae6bd227a9a3c52 Mon Sep 17 00:00:00 2001 From: Chris Frankland-Wright Date: Sat, 30 Aug 2025 22:32:03 +0100 Subject: [PATCH 22/24] allow update of nodogsplash --- setup.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/setup.sh b/setup.sh index 39a7b88..6becd9a 100644 --- a/setup.sh +++ b/setup.sh @@ -136,6 +136,10 @@ echo "NTPD removed (if present). Chrony, NMTUI, and Adjtimex installed and confi echo "📡 Installing and configuring WiFi hotspot and captive portal..." if [ "$PKG_MANAGER" == "apt" ]; then + # Stop the service if it's running from a previous installation to prevent "Text file busy" error. + echo "Stopping existing nodogsplash service before installation..." + sudo systemctl stop nodogsplash || true + # We will use dnsmasq for DHCP, as the compiled nodogsplash version may not support the internal DHCP server. # sudo apt-get remove --purge -y dnsmasq || true # This line is no longer needed. @@ -187,9 +191,6 @@ fi # Ensure services exist before trying to stop them sudo systemctl stop hostapd || true sudo systemctl stop dnsmasq || true -if command -v nodogsplash &> /dev/null; then - sudo systemctl stop nodogsplash || true -fi # Ensure NetworkManager is managing wlan0 by removing any conflicting configurations. # This is the critical fix for the "No suitable device" error. From af6dbcc9a768a8107e2032e3deac12ed191a7d2d Mon Sep 17 00:00:00 2001 From: Chris Frankland-Wright Date: Sat, 30 Aug 2025 22:42:32 +0100 Subject: [PATCH 23/24] added in chrony settings --- setup.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/setup.sh b/setup.sh index 6becd9a..3dffd84 100644 --- a/setup.sh +++ b/setup.sh @@ -132,6 +132,54 @@ fi echo "NTPD removed (if present). Chrony, NMTUI, and Adjtimex installed and configured." +# --- Configure Chrony to act as a local NTP server --- +echo "⚙️ Configuring Chrony to serve local time..." +# The path to chrony.conf can vary +if [ -f /etc/chrony/chrony.conf ]; then + CHRONY_CONF="/etc/chrony/chrony.conf" +elif [ -f /etc/chrony.conf ]; then + CHRONY_CONF="/etc/chrony.conf" +else + CHRONY_CONF="" +fi + +if [ -n "$CHRONY_CONF" ]; then + # Comment out any existing pool, server, or sourcedir lines to prevent syncing with external sources + echo "Disabling external NTP sources..." + sudo sed -i -E 's/^(pool|server|sourcedir)/#&/' "$CHRONY_CONF" + + # Add settings to the top of the file to serve local clock + # Using a temp file to prepend is safer than multiple sed calls + TEMP_CONF=$(mktemp) + cat < "$TEMP_CONF" +# Serve the system clock as a reference at stratum 1 +server 127.127.1.0 +allow 127.0.0.0/8 +local stratum 1 + +EOF + # Append the rest of the original config file after our new lines + cat "$CHRONY_CONF" >> "$TEMP_CONF" + sudo mv "$TEMP_CONF" "$CHRONY_CONF" + + + # Add settings to the bottom of the file to allow LAN clients + echo "Allowing LAN clients..." + sudo tee -a "$CHRONY_CONF" > /dev/null < Date: Sat, 30 Aug 2025 22:52:42 +0100 Subject: [PATCH 24/24] change default yaml to not have timeturning --- config.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/config.yml b/config.yml index bf892f4..bc552ee 100644 --- a/config.yml +++ b/config.yml @@ -12,8 +12,8 @@ defaultNudgeMs: 2 # Time-turning offsets. All values are added to the incoming LTC time. # These can be positive or negative. timeturnerOffset: - hours: 1 - minutes: 2 - seconds: 3 - frames: 4 - milliseconds: 5 + hours: 0 + minutes: 0 + seconds: 0 + frames: 0 + milliseconds: 0