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.
|
||||
|
||||
# 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
|
||||
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..."
|
||||
|
|
@ -295,34 +294,22 @@ EOF
|
|||
sudo rm -f /etc/NetworkManager/conf.d/99-disable-dns.conf
|
||||
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.
|
||||
echo "Removing dhcpcd5 to switch to /etc/network/interfaces..."
|
||||
sudo apt-get remove --purge -y dhcpcd5 || true
|
||||
sudo systemctl disable dhcpcd || true
|
||||
# First, remove any existing configurations for wlan0 to prevent conflicts.
|
||||
# This is a more robust way to ensure our settings are applied.
|
||||
sudo sed -i '/^interface wlan0/,/^\s*$/d' /etc/dhcpcd.conf
|
||||
|
||||
# 2. Configure a static IP for wlan0 directly in the interfaces file.
|
||||
echo "Configuring static IP for wlan0 via /etc/network/interfaces..."
|
||||
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).
|
||||
# Now, add our static IP config to the end of the file.
|
||||
sudo tee -a /etc/dhcpcd.conf > /dev/null <<EOF
|
||||
|
||||
source /etc/network/interfaces.d/*
|
||||
|
||||
# The loopback network interface
|
||||
auto lo
|
||||
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
|
||||
# Static IP configuration for Hachi Time AP
|
||||
interface wlan0
|
||||
static ip_address=10.0.252.1/24
|
||||
nohook wpa_supplicant
|
||||
EOF
|
||||
|
||||
# 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 disable systemd-resolved || true
|
||||
|
||||
# Bring up the wlan0 interface manually
|
||||
echo "Bringing up wlan0 interface..."
|
||||
sudo ifdown wlan0 || true
|
||||
sudo ifup wlan0
|
||||
|
||||
# Restart dhcpcd to apply the static IP
|
||||
sudo systemctl restart dhcpcd
|
||||
# Restart hostapd to create the access point
|
||||
sudo systemctl restart hostapd
|
||||
|
||||
|
|
@ -442,7 +426,7 @@ if [ "$IP_CHECK" == "10.0.252.1" ]; then
|
|||
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'."
|
||||
echo "Please check 'sudo systemctl status hostapd' and 'sudo systemctl status dhcpcd'."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue