feat(cli/setup): friendlier enable-ssh timeout + re-sync boseurls after XML migration (refs #471)

Two follow-ups from the #471 field reports on the BETA `setup enable-ssh`:

1. enable-ssh: when sshd (:22) does not come up within the wait window, this is
   no longer treated as a hard error. On some devices (e.g. the Wireless Link
   Adapter) the envswitch injection is accepted but sshd only starts after the
   speaker restarts. The command now prints a warning with power-cycle + retry
   guidance (and the exact ssh command), deliberately leaves the injected
   boseurls in place so a restart re-triggers the unlock, and exits cleanly
   instead of failing.

2. XML migration: re-apply the boseurls over telnet at the end of migrateViaXML
   so the runtime layer reported by `getpdo CurrentSystemConfiguration` matches
   the persisted SoundTouchSdkPrivateCfg.xml. After enable-ssh bootstraps SSH,
   that runtime layer still points at the placeholder (https://aftertouch.invalid),
   so the preflight cross-check keeps warning that margeServerUrl/swUpdateUrl
   differ between transports until a reboot. The re-apply reconciles it now.
   Best-effort: if telnet is unavailable (e.g. port 17000 was closed via
   --close-17000), a reboot still reconciles the layers, so it only logs a note
   and never fails the migration.

Tests cover the re-apply command and its best-effort (non-fatal) behavior.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Tobias Gesellchen
2026-06-08 21:36:21 +02:00
co-authored by Claude Opus 4.8
parent ae67e1e8ad
commit fa158bc498
3 changed files with 115 additions and 2 deletions
+19 -2
View File
@@ -604,8 +604,25 @@ func setupEnableSSHCmd() *cli.Command {
fmt.Printf("Waiting up to %s for sshd (:22) to come up...\n", c.Duration("wait"))
if err := setup.WaitForSSHPort(cfg.Host, c.Duration("wait")); err != nil {
PrintError(err.Error())
return err
// Not a hard failure: on some devices (e.g. the Wireless Link
// Adapter, see #471) the envswitch injection is accepted but
// sshd only actually starts after the speaker restarts. We
// deliberately leave the injected boseurls in place (no reset)
// so a power-cycle re-triggers the unlock, and guide the user
// to reboot and retry rather than exiting with an error.
fmt.Println()
PrintWarning(fmt.Sprintf("sshd (:22) did not come up within %s, but the speaker accepted the SSH-enable command.", c.Duration("wait")))
fmt.Println("On some devices sshd only starts after a restart. Next steps:")
fmt.Println(" 1. Power-cycle the speaker (unplug it, wait a few seconds, plug it back in).")
fmt.Println(" 2. Once it is back online, run this same command again, or just connect with:")
fmt.Printf(" ssh -o HostKeyAlgorithms=+ssh-rsa,ssh-dss root@%s\n", cfg.Host)
fmt.Println("The temporary boseurls were left in place on purpose, so the restart re-triggers the unlock.")
if placeholder {
fmt.Println("(No --service-url was given; you'll set the real service URLs later during migration.)")
}
return nil
}
PrintSuccess("SSH is up on " + cfg.Host)