mirror of
https://github.com/cjfranko/NTP-Timeturner.git
synced 2025-11-08 18:32:02 +00:00
Compare commits
No commits in common. "2d46fccfbe49a1be2146bbd0936c3600583e3a95" and "04165f26867dd633505938843bf3198c87e33b94" have entirely different histories.
2d46fccfbe
...
04165f2686
1 changed files with 17 additions and 33 deletions
50
setup.sh
50
setup.sh
|
|
@ -229,8 +229,7 @@ if [ "$PKG_MANAGER" == "apt" ]; then
|
||||||
# sudo apt-get remove --purge -y dnsmasq || true # This line is no longer needed.
|
# sudo apt-get remove --purge -y dnsmasq || true # This line is no longer needed.
|
||||||
|
|
||||||
# Install dependencies for hotspot and for building nodogsplash.
|
# 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
|
||||||
sudo apt install -y hostapd dnsmasq git libmicrohttpd-dev libjson-c-dev iptables ifupdown
|
|
||||||
|
|
||||||
# Force iptables-legacy for nodogsplash
|
# Force iptables-legacy for nodogsplash
|
||||||
echo "Setting iptables-legacy mode for nodogsplash..."
|
echo "Setting iptables-legacy mode for nodogsplash..."
|
||||||
|
|
@ -295,34 +294,22 @@ EOF
|
||||||
sudo rm -f /etc/NetworkManager/conf.d/99-disable-dns.conf
|
sudo rm -f /etc/NetworkManager/conf.d/99-disable-dns.conf
|
||||||
sudo systemctl reload NetworkManager
|
sudo systemctl reload NetworkManager
|
||||||
|
|
||||||
# --- Configure networking for AP mode (using /etc/network/interfaces) ---
|
# Configure a static IP for wlan0 using dhcpcd.
|
||||||
|
echo "Configuring static IP for wlan0 via dhcpcd..."
|
||||||
|
# Ensure dhcpcd is installed
|
||||||
|
sudo apt install -y dhcpcd5
|
||||||
|
|
||||||
# 1. Uninstall dhcpcd5 to prevent any conflicts.
|
# First, remove any existing configurations for wlan0 to prevent conflicts.
|
||||||
echo "Removing dhcpcd5 to switch to /etc/network/interfaces..."
|
# This is a more robust way to ensure our settings are applied.
|
||||||
sudo apt-get remove --purge -y dhcpcd5 || true
|
sudo sed -i '/^interface wlan0/,/^\s*$/d' /etc/dhcpcd.conf
|
||||||
sudo systemctl disable dhcpcd || true
|
|
||||||
|
|
||||||
# 2. Configure a static IP for wlan0 directly in the interfaces file.
|
# Now, add our static IP config to the end of the file.
|
||||||
echo "Configuring static IP for wlan0 via /etc/network/interfaces..."
|
sudo tee -a /etc/dhcpcd.conf > /dev/null <<EOF
|
||||||
sudo tee /etc/network/interfaces > /dev/null <<EOF
|
|
||||||
# This file describes the network interfaces available on your system
|
|
||||||
# and how to activate them. For more information, see interfaces(5).
|
|
||||||
|
|
||||||
source /etc/network/interfaces.d/*
|
# Static IP configuration for Hachi Time AP
|
||||||
|
interface wlan0
|
||||||
# The loopback network interface
|
static ip_address=10.0.252.1/24
|
||||||
auto lo
|
nohook wpa_supplicant
|
||||||
iface lo inet loopback
|
|
||||||
|
|
||||||
# The primary network interface (Ethernet) - managed by NetworkManager
|
|
||||||
allow-hotplug eth0
|
|
||||||
iface eth0 inet dhcp
|
|
||||||
|
|
||||||
# Static IP configuration for Fetch-Hachi AP
|
|
||||||
allow-hotplug wlan0
|
|
||||||
iface wlan0 inet static
|
|
||||||
address 10.0.252.1
|
|
||||||
netmask 255.255.255.0
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Configure hostapd for the Access Point
|
# Configure hostapd for the Access Point
|
||||||
|
|
@ -387,11 +374,8 @@ echo "Disabling systemd-resolved to ensure dnsmasq has full control..."
|
||||||
sudo systemctl stop systemd-resolved || true
|
sudo systemctl stop systemd-resolved || true
|
||||||
sudo systemctl disable systemd-resolved || true
|
sudo systemctl disable systemd-resolved || true
|
||||||
|
|
||||||
# Bring up the wlan0 interface manually
|
# Restart dhcpcd to apply the static IP
|
||||||
echo "Bringing up wlan0 interface..."
|
sudo systemctl restart dhcpcd
|
||||||
sudo ifdown wlan0 || true
|
|
||||||
sudo ifup wlan0
|
|
||||||
|
|
||||||
# Restart hostapd to create the access point
|
# Restart hostapd to create the access point
|
||||||
sudo systemctl restart hostapd
|
sudo systemctl restart hostapd
|
||||||
|
|
||||||
|
|
@ -442,7 +426,7 @@ if [ "$IP_CHECK" == "10.0.252.1" ]; then
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "❌ Error: wlan0 failed to get the static IP 10.0.252.1. Found: '$IP_CHECK'."
|
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'."
|
echo "Please check 'sudo systemctl status hostapd' and 'sudo systemctl status dhcpcd'."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue