flash-mac.sh: write preset wifi_creds + preserve user-saved networks
Previous flashes on macOS shipped the USB with NO wifi_creds.json at
all — so every freshly-flashed stick booted a device that couldn't
connect to any of the 4 standard presets the Linux oven/ac-os path
bakes in, and re-flashes wiped out any user-added networks from the
prior session.
Two-step mirror of ac_media_write_global_wifi_creds +
ac_media_merge_wifi_creds from scripts/media-layout.sh:
1. Preset list, inlined in the script (kept in sync with the JSON in
media-layout.sh:140 — aesthetic.computer / ATT2AWTpcr / GettyLink /
Tondo_Guest). Written on every flash even for a never-flashed stick.
2. Before the partitioning wipe, read the existing wifi_creds.json
off the target (if present) into /tmp/ac-wifi-preserve.*.json.
After mount, merge preset + preserved with Python one-liner:
dedupe by SSID, preserved entries override presets for the same
SSID (so user-saved passwords survive a re-flash). Both partitions
(ACBOOT + ACEFI) get the same merged file.
If the caller stages their own wifi_creds.json at ${SRC_DIR}/wifi_creds.json
(e.g. /tmp/ac-os-pull/wifi_creds.json) that file wins as source-of-truth
and neither preset nor preserved merge is applied.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>