@rubytech/create-maxy 1.0.780 → 1.0.781
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/dist/index.js
CHANGED
|
@@ -430,6 +430,18 @@ function installSystemDeps() {
|
|
|
430
430
|
console.log(` Avahi host-name: ${HOSTNAME_FLAG} (updated avahi-daemon.conf)`);
|
|
431
431
|
}
|
|
432
432
|
catch { /* avahi-daemon.conf may not exist — non-critical */ }
|
|
433
|
+
// Restart avahi-daemon so the new hostname takes effect immediately
|
|
434
|
+
// and any stale "maxytest-2" auto-renamed records from a previous
|
|
435
|
+
// boot's hostname-conflict cycle are withdrawn. Without this,
|
|
436
|
+
// avahi-resolve -n <hostname>.local times out from the device itself
|
|
437
|
+
// because the daemon is still advertising the previous identity.
|
|
438
|
+
try {
|
|
439
|
+
console.log(" [privileged] systemctl restart avahi-daemon");
|
|
440
|
+
shell("systemctl", ["restart", "avahi-daemon"], { sudo: true });
|
|
441
|
+
}
|
|
442
|
+
catch (err) {
|
|
443
|
+
console.error(` WARNING: avahi-daemon restart failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
444
|
+
}
|
|
433
445
|
}
|
|
434
446
|
catch (err) {
|
|
435
447
|
console.error(` WARNING: Failed to set hostname to '${HOSTNAME_FLAG}': ${err instanceof Error ? err.message : String(err)}`);
|
package/package.json
CHANGED
|
@@ -361,6 +361,13 @@ handle_connect_requests() {
|
|
|
361
361
|
assigned_ip=$(get_wifi_ip)
|
|
362
362
|
log_state "connected" "ssid=\"${target_ssid}\" ip=\"${assigned_ip}\""
|
|
363
363
|
|
|
364
|
+
# Restart avahi-daemon so it withdraws any stale "<host>-2.local"
|
|
365
|
+
# auto-renamed records from a previous boot (where hostapd's wlan0
|
|
366
|
+
# transition triggered a self-conflict during withdraw/announce) and
|
|
367
|
+
# re-claims the canonical hostname on the freshly-connected network.
|
|
368
|
+
systemctl restart avahi-daemon 2>/dev/null || true
|
|
369
|
+
log "avahi-daemon restarted to refresh ${HOSTNAME_NAME}.local advertisement"
|
|
370
|
+
|
|
364
371
|
# Write success result for the HTTP server
|
|
365
372
|
echo "{\"success\":true,\"ip\":\"${assigned_ip}\",\"hostname\":\"${HOSTNAME_NAME}\"}" > "$RESULT_FILE"
|
|
366
373
|
|