clientupdate: return OS-specific version from LatestTailscaleVersion (#11812)

We don't always have the same latest version for all platforms (like
with 1.64.2 is only Synology+Windows), so we should use the OS-specific
result from pkgs JSON response instead of the main Version field.

Updates #11795

Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
nickkhyl/ipn-user-identity
Andrew Lytvynov 7 months ago committed by GitHub
parent bbe194c80d
commit b3fb3bf084
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1295,10 +1295,23 @@ func LatestTailscaleVersion(track string) (string, error) {
if err != nil {
return "", err
}
if latest.Version == "" {
return "", fmt.Errorf("no latest version found for %q track", track)
ver := latest.Version
switch runtime.GOOS {
case "windows":
ver = latest.MSIsVersion
case "darwin":
ver = latest.MacZipsVersion
case "linux":
ver = latest.TarballsVersion
if distro.Get() == distro.Synology {
ver = latest.SPKsVersion
}
}
if ver == "" {
return "", fmt.Errorf("no latest version found for OS %q on %q track", runtime.GOOS, track)
}
return latest.Version, nil
return ver, nil
}
type trackPackages struct {

Loading…
Cancel
Save