fix: make setup script WiFi-safe by removing instant network activation

This commit is contained in:
Timothy Hofland
2026-03-16 00:10:50 +01:00
parent 6fea68f903
commit 4e1858de61

View File

@ -141,14 +141,11 @@ echo "Configuring Networking..."
rfkill unblock wlan || true rfkill unblock wlan || true
if command -v nmcli > /dev/null; then if command -v nmcli > /dev/null; then
echo "NetworkManager detected. Using nmcli for hotspot..." echo "NetworkManager detected. Configuring hotspot (WiFi-Safe)..."
# Disconnect current wifi to free the radio
nmcli device disconnect wlan0 2>/dev/null || true
# Clean up any existing MPVJ connection # Clean up any existing MPVJ connection
nmcli con delete MPVJ-AP 2>/dev/null || true nmcli con delete MPVJ-AP 2>/dev/null || true
# Create the Access Point # Create the Access Point profile (but don't activate it yet)
nmcli con add type wifi ifname wlan0 mode ap con-name MPVJ-AP autoconnect yes ssid "$WIFI_SSID" nmcli con add type wifi ifname wlan0 mode ap con-name MPVJ-AP autoconnect yes ssid "$WIFI_SSID"
nmcli con modify MPVJ-AP 802-11-wireless.mode ap 802-11-wireless.band bg ipv4.method shared nmcli con modify MPVJ-AP 802-11-wireless.mode ap 802-11-wireless.band bg ipv4.method shared
nmcli con modify MPVJ-AP wifi-sec.key-mgmt wpa-psk nmcli con modify MPVJ-AP wifi-sec.key-mgmt wpa-psk
@ -156,9 +153,6 @@ if command -v nmcli > /dev/null; then
nmcli con modify MPVJ-AP ipv4.addresses 192.168.4.1/24 nmcli con modify MPVJ-AP ipv4.addresses 192.168.4.1/24
nmcli con modify MPVJ-AP connection.autoconnect-priority 100 nmcli con modify MPVJ-AP connection.autoconnect-priority 100
# Bring it up immediately
nmcli con up MPVJ-AP || true
# Ensure hostapd/dnsmasq are disabled # Ensure hostapd/dnsmasq are disabled
systemctl stop hostapd dnsmasq 2>/dev/null || true systemctl stop hostapd dnsmasq 2>/dev/null || true
systemctl disable hostapd dnsmasq 2>/dev/null || true systemctl disable hostapd dnsmasq 2>/dev/null || true