diff --git a/README.md b/README.md index 9102675..8d9f429 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,22 @@ The installation script automates the following steps: After installation is complete, the script will provide instructions to start the service manually or to run the application in its interactive terminal mode. +```bash +The working directory is /opt/timeturner. +Default 'config.yml' installed to /opt/timeturner. + +To start the service, run: + sudo systemctl start timeturner.service + +To view live logs, run: + journalctl -u timeturner.service -f + +To run the interactive TUI instead, simply run from the project directory: + cargo run +Or from anywhere after installation: + timeturner +``` + --- ## 🔄 Updating diff --git a/setup.sh b/setup.sh index 93cb02a..9be2334 100644 --- a/setup.sh +++ b/setup.sh @@ -97,7 +97,7 @@ echo "Common build dependencies installed." # --- Install Python dependencies for testing --- echo "🐍 Installing Python dependencies for test scripts..." if [ "$PKG_MANAGER" == "apt" ]; then - # python3-serial is the name for pyserial in apt + # We no longer need hotspot dependencies sudo apt install -y python3 python3-pip python3-serial elif [ "$PKG_MANAGER" == "dnf" ]; then # python3-pyserial is the name for pyserial in dnf @@ -217,237 +217,8 @@ else fi -# --- Install and configure WiFi hotspot and captive portal --- -echo "📡 Installing and configuring WiFi hotspot and captive portal..." +# --- The entire WiFi hotspot and captive portal section has been removed --- -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. - - # Install dependencies for hotspot and for building nodogsplash. - # ifupdown is needed to manage /etc/network/interfaces - sudo apt install -y hostapd dnsmasq git libmicrohttpd-dev libjson-c-dev iptables ifupdown - - # 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 - - 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" - - # 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 - sudo rm -rf "$BUILD_DIR" - echo "✅ nodogsplash installed successfully." - - # Disable the standalone hostapd service to let NetworkManager manage it. - # We are now using the classic hostapd service, so unmask it. - sudo systemctl unmask hostapd - sudo systemctl enable hostapd - sudo systemctl enable nodogsplash -else - echo "This script is designed for Debian-based systems like Raspberry Pi OS." - echo "Skipping WiFi hotspot setup." -fi - -# Stop services to configure -# Ensure services exist before trying to stop them -sudo systemctl stop hostapd || true -sudo systemctl stop dnsmasq || true - -# --- Configure networking for AP mode --- - -# Set the WiFi country code to prevent radio issues. This is a critical step. -echo "Setting WiFi Country Code to US..." -sudo raspi-config nonint do_wifi_country US - -# Tell NetworkManager to ignore wlan0 completely to prevent conflicts. -echo "Configuring NetworkManager to ignore wlan0..." -sudo tee /etc/NetworkManager/conf.d/99-unmanaged-wlan0.conf > /dev/null < /dev/null < /dev/null < /dev/null < /dev/null < /dev/null; then - 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 'cat /etc/network/interfaces'." - exit 1 -fi - -echo "✅ WiFi hotspot and captive portal configured. SSID: Fetch-Hachi, IP: 10.0.252.1" -echo "Clients will be redirected to http://10.0.252.1/static/index.html" # 1. Build the release binary echo "📦 Building release binary with Cargo..." @@ -476,7 +247,7 @@ if [[ "$(uname)" == "Linux" ]]; then echo "⚙️ Installing systemd service for Linux..." sudo cp timeturner.service /etc/systemd/system/ sudo systemctl daemon-reload - sudo systemctl enable timeturner.service + sudo systemctl enable tim_turner.service echo "✅ Systemd service installed and enabled." else echo "⚠️ Skipping systemd service installation on non-Linux OS."