clientupdate: use SPKsVersion instead of Version (#9118)

Top-level Version in pkgs response is not always in sync with SPK
versions, especially on unstable track. It's very confusing when the
confirmation prompt asks you "update to 1.49.x?" and you end up updating
to 1.49.y.
Instead, grab the SPK-specific version field.

Updates #cleanup.

Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
This commit is contained in:
Andrew Lytvynov 2023-08-28 15:26:19 -06:00 committed by GitHub
parent 8d2eaa1956
commit 67e48d9285
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -204,15 +204,12 @@ func (up *updater) updateSynology() error {
if err != nil { if err != nil {
return err return err
} }
if latest.Version == "" {
return fmt.Errorf("no latest version found for %q track", up.track)
}
spkName := latest.SPKs[osName][arch] spkName := latest.SPKs[osName][arch]
if spkName == "" { if spkName == "" {
return fmt.Errorf("cannot find Synology package for os=%s arch=%s, please report a bug with your device model", osName, arch) return fmt.Errorf("cannot find Synology package for os=%s arch=%s, please report a bug with your device model", osName, arch)
} }
if !up.confirm(latest.Version) { if !up.confirm(latest.SPKsVersion) {
return nil return nil
} }
if err := requireRoot(); err != nil { if err := requireRoot(); err != nil {
@ -830,12 +827,17 @@ func LatestTailscaleVersion(track string) (string, error) {
} }
type trackPackages struct { type trackPackages struct {
Version string Version string
Tarballs map[string]string Tarballs map[string]string
Exes []string TarballsVersion string
MSIs map[string]string Exes []string
MacZips map[string]string ExesVersion string
SPKs map[string]map[string]string MSIs map[string]string
MSIsVersion string
MacZips map[string]string
MacZipsVersion string
SPKs map[string]map[string]string
SPKsVersion string
} }
func latestPackages(track string) (*trackPackages, error) { func latestPackages(track string) (*trackPackages, error) {