diff --git a/setup.sh b/setup.sh index 87f51c8..93cb02a 100644 --- a/setup.sh +++ b/setup.sh @@ -229,7 +229,8 @@ 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. - sudo apt install -y hostapd dnsmasq git libmicrohttpd-dev libjson-c-dev iptables + # 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..." @@ -294,22 +295,34 @@ EOF sudo rm -f /etc/NetworkManager/conf.d/99-disable-dns.conf sudo systemctl reload NetworkManager -# 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 +# --- Configure networking for AP mode (using /etc/network/interfaces) --- -# 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 +# 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 -# Now, add our static IP config to the end of the file. -sudo tee -a /etc/dhcpcd.conf > /dev/null < /dev/null <