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>
pull/9119/head
Andrew Lytvynov 1 year ago committed by GitHub
parent 8d2eaa1956
commit 67e48d9285
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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 {
@ -832,10 +829,15 @@ func LatestTailscaleVersion(track string) (string, error) {
type trackPackages struct { type trackPackages struct {
Version string Version string
Tarballs map[string]string Tarballs map[string]string
TarballsVersion string
Exes []string Exes []string
ExesVersion string
MSIs map[string]string MSIs map[string]string
MSIsVersion string
MacZips map[string]string MacZips map[string]string
MacZipsVersion string
SPKs map[string]map[string]string SPKs map[string]map[string]string
SPKsVersion string
} }
func latestPackages(track string) (*trackPackages, error) { func latestPackages(track string) (*trackPackages, error) {

Loading…
Cancel
Save