Browse Source

fix: 修改升级过程中的架构判断 (#4102)

pull/4109/head
ssongliu 9 months ago committed by GitHub
parent
commit
8ce066a9d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 34
      backend/app/service/upgrade.go

34
backend/app/service/upgrade.go

@ -7,7 +7,6 @@ import (
"net/http" "net/http"
"os" "os"
"path" "path"
"runtime"
"strings" "strings"
"time" "time"
@ -250,19 +249,24 @@ func (u *UpgradeService) loadReleaseNotes(path string) (string, error) {
} }
func loadArch() (string, error) { func loadArch() (string, error) {
switch runtime.GOARCH { std, err := cmd.Exec("uname -a")
case "amd64", "ppc64le", "s390x", "arm64": if err != nil {
return runtime.GOARCH, nil return "", fmt.Errorf("std: %s, err: %s", std, err.Error())
case "arm": }
std, err := cmd.Exec("uname -m") if strings.Contains(std, "x86_64") {
if err != nil { return "amd64", nil
return "", fmt.Errorf("std: %s, err: %s", std, err.Error()) }
} if strings.Contains(std, "arm64") || strings.Contains(std, "aarch64") {
if std == "armv7l\n" { return "arm64", nil
return "armv7", nil }
} if strings.Contains(std, "armv7l") {
return "", fmt.Errorf("unsupported such arch: arm-%s", std) return "armv7", nil
default: }
return "", fmt.Errorf("unsupported such arch: %s", runtime.GOARCH) if strings.Contains(std, "ppc64le") {
return "ppc64le", nil
}
if strings.Contains(std, "s390x") {
return "s390x", nil
} }
return "", fmt.Errorf("unsupported such arch: %s", std)
} }

Loading…
Cancel
Save