💩 强制 windows 运行对应正确二进制
This commit is contained in:
parent
165411a12b
commit
2af0bc667b
@ -18,6 +18,7 @@ import (
|
|||||||
"github.com/go-ping/ping"
|
"github.com/go-ping/ping"
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
"github.com/p14yground/go-github-selfupdate/selfupdate"
|
"github.com/p14yground/go-github-selfupdate/selfupdate"
|
||||||
|
"github.com/shirou/gopsutil/v3/host"
|
||||||
flag "github.com/spf13/pflag"
|
flag "github.com/spf13/pflag"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/credentials"
|
"google.golang.org/grpc/credentials"
|
||||||
@ -46,7 +47,7 @@ type AgentConfig struct {
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
version string
|
version string
|
||||||
arch string = runtime.GOARCH
|
arch string
|
||||||
client pb.NezhaServiceClient
|
client pb.NezhaServiceClient
|
||||||
inited bool
|
inited bool
|
||||||
)
|
)
|
||||||
@ -73,8 +74,23 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
if arch != runtime.GOARCH {
|
if runtime.GOOS == "windows" {
|
||||||
panic(fmt.Sprintf("与当前系统不匹配,当前运行 %s_%s, 需要下载 %s_%s", runtime.GOOS, arch, runtime.GOOS, runtime.GOARCH))
|
hostArch, err := host.KernelArch()
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
if hostArch == "i386" {
|
||||||
|
hostArch = "386"
|
||||||
|
}
|
||||||
|
if hostArch == "i686" || hostArch == "ia64" || hostArch == "x86_64" {
|
||||||
|
hostArch = "amd64"
|
||||||
|
}
|
||||||
|
if hostArch == "aarch64" {
|
||||||
|
hostArch = "arm64"
|
||||||
|
}
|
||||||
|
if arch != hostArch {
|
||||||
|
panic(fmt.Sprintf("与当前系统不匹配,当前运行 %s_%s, 需要下载 %s_%s", runtime.GOOS, arch, runtime.GOOS, hostArch))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 来自于 GoReleaser 的版本号
|
// 来自于 GoReleaser 的版本号
|
||||||
|
@ -23,8 +23,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Version string = "debug"
|
Version string
|
||||||
expectDiskFsTypes = []string{
|
expectDiskFsTypes = []string{
|
||||||
"apfs", "ext4", "ext3", "ext2", "f2fs", "reiserfs", "jfs", "btrfs",
|
"apfs", "ext4", "ext3", "ext2", "f2fs", "reiserfs", "jfs", "btrfs",
|
||||||
"fuseblk", "zfs", "simfs", "ntfs", "fat32", "exfat", "xfs", "fuse.rclone",
|
"fuseblk", "zfs", "simfs", "ntfs", "fat32", "exfat", "xfs", "fuse.rclone",
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user