@rubytech/create-maxy 1.0.778 → 1.0.779
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -332,12 +332,27 @@ handle_connect_requests() {
|
|
|
332
332
|
nmcli device set wlan0 managed yes 2>/dev/null
|
|
333
333
|
sleep 2
|
|
334
334
|
|
|
335
|
+
# NM's wifi-list cache is empty immediately after wlan0 is handed back
|
|
336
|
+
# from hostapd, so `nmcli device wifi connect` reports "No network with
|
|
337
|
+
# SSID 'X' found" even when hostapd's pre-AP scan saw it. Trigger a
|
|
338
|
+
# rescan and poll until the target SSID appears in the cache (or 15s
|
|
339
|
+
# timeout) before attempting the connect.
|
|
340
|
+
nmcli device wifi rescan 2>/dev/null || true
|
|
341
|
+
local rescan_elapsed=0
|
|
342
|
+
while [ "$rescan_elapsed" -lt 15 ]; do
|
|
343
|
+
if nmcli -t -f SSID device wifi list 2>/dev/null | grep -Fxq "$target_ssid"; then
|
|
344
|
+
break
|
|
345
|
+
fi
|
|
346
|
+
sleep 1
|
|
347
|
+
rescan_elapsed=$((rescan_elapsed + 1))
|
|
348
|
+
done
|
|
349
|
+
log "rescan-before-connect: target=\"${target_ssid}\" elapsed=${rescan_elapsed}s"
|
|
350
|
+
|
|
335
351
|
# Attempt WiFi connection. Capture exit code before || true so we
|
|
336
352
|
# get nmcli's actual exit status, not the unconditional 0 from || true.
|
|
337
353
|
local connect_output connect_exit
|
|
338
354
|
# `--wait` / `-w` is a top-level nmcli option (must precede the
|
|
339
|
-
# subcommand), not an argument to `device wifi connect`.
|
|
340
|
-
# after the subcommand fails with "invalid extra argument '--wait'".
|
|
355
|
+
# subcommand), not an argument to `device wifi connect`.
|
|
341
356
|
connect_output=$(nmcli --wait 30 device wifi connect "$target_ssid" password "$target_password" 2>&1)
|
|
342
357
|
connect_exit=$?
|
|
343
358
|
|