Allow a single upgrade at a time

This commit is contained in:
Audrius Butkevicius
2014-09-25 23:13:41 +01:00
parent 56d0ecc253
commit 59ffec4e39
4 changed files with 31 additions and 17 deletions

View File

@@ -19,17 +19,10 @@ import (
"path/filepath"
"runtime"
"strings"
"bitbucket.org/kardianos/osext"
)
// Upgrade to the given release, saving the previous binary with a ".old" extension.
func UpgradeTo(rel Release, archExtra string) error {
path, err := osext.Executable()
if err != nil {
return err
}
func upgradeTo(path string, rel Release, archExtra string) error {
expectedRelease := fmt.Sprintf("syncthing-%s-%s%s-%s.", runtime.GOOS, runtime.GOARCH, archExtra, rel.Tag)
if debug {
l.Debugf("expected release asset %q", expectedRelease)