clientupdate: abort if current version is newer than latest (#9733)

This is only relevant for unstable releases and local builds. When local
version is newer than upstream, abort release.

Also, re-add missing newlines in output that were missed in
https://github.com/tailscale/tailscale/pull/9694.

Updates #cleanup

Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
This commit is contained in:
Andrew Lytvynov
2023-10-10 17:01:44 -07:00
committed by GitHub
parent 7f08bddfe1
commit 677d486830
4 changed files with 9 additions and 4 deletions

View File

@@ -30,6 +30,7 @@ import (
"github.com/google/uuid"
"tailscale.com/clientupdate/distsign"
"tailscale.com/types/logger"
"tailscale.com/util/cmpver"
"tailscale.com/util/winutil"
"tailscale.com/version"
"tailscale.com/version/distro"
@@ -211,9 +212,13 @@ func Update(args Arguments) error {
}
func (up *Updater) confirm(ver string) bool {
if version.Short() == ver {
switch cmpver.Compare(version.Short(), ver) {
case 0:
up.Logf("already running %v; no update needed", ver)
return false
case 1:
up.Logf("installed version %v is newer than the latest available version %v; no update needed", version.Short(), ver)
return false
}
if up.Confirm != nil {
return up.Confirm(ver)