mirror of
https://github.com/cjfranko/NTP-Timeturner.git
synced 2025-11-08 18:32:02 +00:00
updated to network-manager
This commit is contained in:
parent
0e7b583829
commit
57de9a98a5
1 changed files with 62 additions and 6 deletions
66
setup.sh
66
setup.sh
|
|
@ -165,10 +165,64 @@ if command -v nodogsplash &> /dev/null; then
|
||||||
sudo systemctl stop nodogsplash || true
|
sudo systemctl stop nodogsplash || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Configure static IP for wlan0
|
# Configure static IP for wlan0 using NetworkManager (nmcli)
|
||||||
echo "Configuring static IP for wlan0..."
|
echo "Configuring static IP for wlan0 using NetworkManager..."
|
||||||
sudo sed -i '/^interface wlan0/d' /etc/dhcpcd.conf
|
# Check if a connection for wlan0 already exists and delete it to start fresh
|
||||||
sudo tee -a /etc/dhcpcd.conf > /dev/null <<EOF
|
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
|
||||||
|
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 <<EOF
|
||||||
|
[keyfile]
|
||||||
|
unmanaged-devices=interface-name:wlan0
|
||||||
|
EOF
|
||||||
|
# Reload NetworkManager to apply the unmanaged device setting
|
||||||
|
sudo systemctl reload NetworkManager
|
||||||
|
|
||||||
|
# Now, configure the static IP using a method that doesn't rely on NetworkManager's main loop
|
||||||
|
# We will use dhcpcd for this specific interface, as it's simpler for a static AP setup.
|
||||||
|
# First, ensure dhcpcd is installed.
|
||||||
|
if [ "$PKG_MANAGER" == "apt" ]; then
|
||||||
|
sudo apt install -y dhcpcd5
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Configure static IP for wlan0 in dhcpcd.conf
|
||||||
|
sudo tee /etc/dhcpcd.conf > /dev/null <<EOF
|
||||||
|
# A sample configuration for dhcpcd.
|
||||||
|
# See dhcpcd.conf(5) for details.
|
||||||
|
|
||||||
|
# Allow users of this group to interact with dhcpcd via the control socket.
|
||||||
|
#controlgroup wheel
|
||||||
|
|
||||||
|
# Inform the DHCP server of our hostname for DDNS.
|
||||||
|
hostname
|
||||||
|
|
||||||
|
# Use the hardware address of the interface for the Client ID.
|
||||||
|
clientid
|
||||||
|
|
||||||
|
# Persist interface configuration when dhcpcd exits.
|
||||||
|
persistent
|
||||||
|
|
||||||
|
# Rapid commit support.
|
||||||
|
# Safe to enable by default because it requires the equivalent option set
|
||||||
|
# on the server to actually work.
|
||||||
|
option rapid_commit
|
||||||
|
|
||||||
|
# A list of options to request from the DHCP server.
|
||||||
|
option domain_name_servers, domain_name, domain_search, host_name
|
||||||
|
option classless_static_routes
|
||||||
|
# Respect the network MTU. This is applied to DHCP routes.
|
||||||
|
option interface_mtu
|
||||||
|
|
||||||
|
# A hook script is provided to lookup the hostname if not set by the DHCP
|
||||||
|
# server, but it should not be run by default.
|
||||||
|
nohook lookup-hostname
|
||||||
|
|
||||||
|
# Static IP configuration for TimeTurner AP
|
||||||
interface wlan0
|
interface wlan0
|
||||||
static ip_address=10.0.252.1/24
|
static ip_address=10.0.252.1/24
|
||||||
nohook wpa_supplicant
|
nohook wpa_supplicant
|
||||||
|
|
@ -221,7 +275,9 @@ EOF
|
||||||
sudo systemctl restart dhcpcd
|
sudo systemctl restart dhcpcd
|
||||||
sudo systemctl restart dnsmasq
|
sudo systemctl restart dnsmasq
|
||||||
sudo systemctl restart hostapd
|
sudo systemctl restart hostapd
|
||||||
|
if command -v nodogsplash &> /dev/null; then
|
||||||
sudo systemctl restart nodogsplash
|
sudo systemctl restart nodogsplash
|
||||||
|
fi
|
||||||
|
|
||||||
echo "✅ WiFi hotspot and captive portal configured. SSID: TimeTurner, IP: 10.0.252.1"
|
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"
|
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 " sudo systemctl start timeturner.service"
|
||||||
echo ""
|
echo ""
|
||||||
echo "To view live logs, run:"
|
echo "To view live logs, run:"
|
||||||
echo " journalctl -u timeturner.service -f"
|
echo " journalctl -u tim_turner.service -f"
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
echo "To run the interactive TUI instead, simply run from the project directory:"
|
echo "To run the interactive TUI instead, simply run from the project directory:"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue