diff --git a/setup.sh b/setup.sh index 93cb02a..87f51c8 100644 --- a/setup.sh +++ b/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 < /dev/null <