self-update: Check current version before download

This commit is contained in:
Alexander Neumann
2018-10-14 17:29:46 +02:00
parent 7d0f2eaf24
commit a432b42c81
2 changed files with 10 additions and 3 deletions

View File

@@ -60,12 +60,14 @@ func runSelfUpdate(opts SelfUpdateOptions, gopts GlobalOptions, args []string) e
Printf("writing restic to %v\n", opts.Output)
v, err := selfupdate.DownloadLatestStableRelease(gopts.ctx, opts.Output, Verbosef)
v, err := selfupdate.DownloadLatestStableRelease(gopts.ctx, opts.Output, version, Verbosef)
if err != nil {
return errors.Fatalf("unable to update restic: %v", err)
}
Printf("successfully updated restic to version %v\n", v)
if v != version {
Printf("successfully updated restic to version %v\n", v)
}
return nil
}