Compare commits

..

3 commits

Author SHA1 Message Date
Chris Frankland-Wright
2d46fccfbe include ifup ifdown
Some checks are pending
Build for Raspberry Pi / Build for aarch64 (push) Waiting to run
2025-08-31 11:00:55 +01:00
Chris Frankland-Wright
fdddf4eb76 revert to dchcpcd 2025-08-31 10:56:22 +01:00
Chris Frankland-Wright
46892884a1 ignore all eth for dnsq 2025-08-31 10:48:46 +01:00

View file

@ -229,7 +229,8 @@ 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.
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 # Force iptables-legacy for nodogsplash
echo "Setting iptables-legacy mode 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 rm -f /etc/NetworkManager/conf.d/99-disable-dns.conf
sudo systemctl reload NetworkManager sudo systemctl reload NetworkManager
# Configure a static IP for wlan0 using dhcpcd. # --- Configure networking for AP mode (using /etc/network/interfaces) ---
echo "Configuring static IP for wlan0 via dhcpcd..."
# Ensure dhcpcd is installed
sudo apt install -y dhcpcd5
# First, remove any existing configurations for wlan0 to prevent conflicts. # 1. Uninstall dhcpcd5 to prevent any conflicts.
# This is a more robust way to ensure our settings are applied. echo "Removing dhcpcd5 to switch to /etc/network/interfaces..."
sudo sed -i '/^interface wlan0/,/^\s*$/d' /etc/dhcpcd.conf 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. # 2. Configure a static IP for wlan0 directly in the interfaces file.
sudo tee -a /etc/dhcpcd.conf > /dev/null <<EOF 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).
# Static IP configuration for Hachi Time AP source /etc/network/interfaces.d/*
interface wlan0
static ip_address=10.0.252.1/24 # The loopback network interface
nohook wpa_supplicant 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
EOF EOF
# Configure hostapd for the Access Point # Configure hostapd for the Access Point
@ -374,8 +387,11 @@ 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
# Restart dhcpcd to apply the static IP # Bring up the wlan0 interface manually
sudo systemctl restart dhcpcd echo "Bringing up wlan0 interface..."
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
@ -426,7 +442,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 'sudo systemctl status dhcpcd'." echo "Please check 'sudo systemctl status hostapd' and 'cat /etc/network/interfaces'."
exit 1 exit 1
fi fi