diff options
| author | guol-fnst <goul-fnst@fujitsu.com> | 2022-06-15 15:51:37 +0800 |
|---|---|---|
| committer | guol-fnst <goul-fnst@fujitsu.com> | 2022-06-16 11:40:20 +0800 |
| commit | 1dbb925d298572afb09257ba3555374032799580 (patch) | |
| tree | e53374b6e222d533018d2b0638ad6bc99b61e012 /weed/command/update.go | |
| parent | 3df84cabf67918beb4bb4f56c4250e57c0f219c5 (diff) | |
| download | seaweedfs-1dbb925d298572afb09257ba3555374032799580.tar.xz seaweedfs-1dbb925d298572afb09257ba3555374032799580.zip | |
remove unused function
remove log when weed is up to date
add check whether weed is full version
Diffstat (limited to 'weed/command/update.go')
| -rw-r--r-- | weed/command/update.go | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/weed/command/update.go b/weed/command/update.go index 945ecc293..3f575d513 100644 --- a/weed/command/update.go +++ b/weed/command/update.go @@ -52,6 +52,9 @@ type githubError struct { Message string } +//default version is not full version +var isFullVersion = false + var ( updateOpt UpdateOptions ) @@ -91,16 +94,11 @@ func runUpdate(cmd *Command, args []string) bool { } } - glog.V(0).Infof("writing weed to %v\n", *updateOpt.Output) - v, err := downloadLatestStableRelease(context.Background(), *updateOpt.Output) if err != nil { - glog.Fatalf("unable to update weed: %v", err) + glog.Fatalf("unable to update weed to version %s: %v", err, v) return false } - - glog.V(0).Infof("successfully updated weed to version %v\n", v) - return true } @@ -123,12 +121,17 @@ func downloadLatestStableRelease(ctx context.Context, target string) (version st largeDiskSuffix = "_large_disk" } + fullSuffix := "" + if isFullVersion { + fullSuffix = "_full" + } + ext := "tar.gz" if runtime.GOOS == "windows" { ext = "zip" } - suffix := fmt.Sprintf("%s_%s%s.%s", runtime.GOOS, runtime.GOARCH, largeDiskSuffix, ext) + suffix := fmt.Sprintf("%s_%s%s%s.%s", runtime.GOOS, runtime.GOARCH, fullSuffix, largeDiskSuffix, ext) md5Filename := fmt.Sprintf("%s.md5", suffix) _, md5Val, err := getGithubDataFile(ctx, rel.Assets, md5Filename) if err != nil { @@ -152,18 +155,13 @@ func downloadLatestStableRelease(ctx context.Context, target string) (version st err = extractToFile(buf, downloadFilename, target) if err != nil { return "", err + } else { + glog.V(0).Infof("successfully updated weed to version %v\n", rel.Version) } return rel.Version, nil } -func (r Release) String() string { - return fmt.Sprintf("%v %v, %d assets", - r.TagName, - r.PublishedAt.Local().Format("2006-01-02 15:04:05"), - len(r.Assets)) -} - // GitHubLatestRelease uses the GitHub API to get information about the latest // release of a repository. func GitHubLatestRelease(ctx context.Context, owner, repo string) (Release, error) { |
