diff --git a/scripts/setup.sh b/scripts/setup.sh index e9e66b1..29bba51 100644 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -142,6 +142,9 @@ rfkill unblock wlan || true if command -v nmcli > /dev/null; then echo "NetworkManager detected. Using nmcli for hotspot..." + # Disconnect current wifi to free the radio + nmcli device disconnect wlan0 2>/dev/null || true + # Clean up any existing MPVJ connection nmcli con delete MPVJ-AP 2>/dev/null || true @@ -151,8 +154,12 @@ if command -v nmcli > /dev/null; then nmcli con modify MPVJ-AP wifi-sec.key-mgmt wpa-psk nmcli con modify MPVJ-AP wifi-sec.psk "$WIFI_PASS" nmcli con modify MPVJ-AP ipv4.addresses 192.168.4.1/24 + nmcli con modify MPVJ-AP connection.autoconnect-priority 100 - # Ensure hostapd/dnsmasq are disabled to prevent conflict + # Bring it up immediately + nmcli con up MPVJ-AP || true + + # Ensure hostapd/dnsmasq are disabled systemctl stop hostapd dnsmasq 2>/dev/null || true systemctl disable hostapd dnsmasq 2>/dev/null || true systemctl mask hostapd dnsmasq 2>/dev/null || true