mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-09 23:00:58 +00:00
Beta versions *should* upgrade to other beta version (ref #436)
This commit is contained in:
parent
f762bd5e25
commit
6188185b22
@ -93,14 +93,25 @@ func currentRelease() (githubRelease, error) {
|
|||||||
json.NewDecoder(resp.Body).Decode(&rels)
|
json.NewDecoder(resp.Body).Decode(&rels)
|
||||||
resp.Body.Close()
|
resp.Body.Close()
|
||||||
|
|
||||||
|
if strings.Contains(Version, "-beta") {
|
||||||
|
// We are a beta version. Use whatever we can find that is newer-or-equal than current.
|
||||||
|
for _, rel := range rels {
|
||||||
|
if compareVersions(rel.Tag, Version) >= 0 {
|
||||||
|
return rel, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// We found nothing. Return the latest release and let the next layer decide.
|
||||||
|
return rels[0], nil
|
||||||
|
} else {
|
||||||
|
// We are a regular release. Only consider non-prerelease versions for upgrade.
|
||||||
for _, rel := range rels {
|
for _, rel := range rels {
|
||||||
if !rel.Prerelease {
|
if !rel.Prerelease {
|
||||||
return rel, nil
|
return rel, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return githubRelease{}, errors.New("no suitable release found")
|
return githubRelease{}, errors.New("no suitable release found")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func readTarGZ(url string, dir string) (string, error) {
|
func readTarGZ(url string, dir string) (string, error) {
|
||||||
req, err := http.NewRequest("GET", url, nil)
|
req, err := http.NewRequest("GET", url, nil)
|
||||||
|
Loading…
Reference in New Issue
Block a user