mirror of
https://github.com/oneclickvirt/ecs.git
synced 2025-09-30 21:22:11 +08:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
955b887039 | ||
![]() |
ac3839a8eb | ||
![]() |
4d2c89dc96 | ||
![]() |
e773e4d0fd | ||
![]() |
d0814ee1da | ||
![]() |
c31c978fc8 | ||
![]() |
040a3db6e2 |
1
.github/workflows/main.yaml
vendored
1
.github/workflows/main.yaml
vendored
@@ -35,4 +35,3 @@ jobs:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GHT }}
|
||||
GOPRIVATE: github.com/oneclickvirt/security
|
||||
CGO_ENABLED: 0 # 禁用 CGO,强制静态链接
|
||||
|
50
.goreleaser.yaml
Normal file
50
.goreleaser.yaml
Normal file
@@ -0,0 +1,50 @@
|
||||
before:
|
||||
hooks:
|
||||
- go mod download
|
||||
- go generate ./...
|
||||
builds:
|
||||
- env:
|
||||
- CGO_ENABLED=0 # 禁用 CGO,强制静态链接
|
||||
goos:
|
||||
- linux
|
||||
- windows
|
||||
- darwin
|
||||
- openbsd
|
||||
- freebsd
|
||||
goarch:
|
||||
- amd64
|
||||
- arm
|
||||
- arm64
|
||||
- 386
|
||||
- s390x
|
||||
- ppc64
|
||||
- ppc64le
|
||||
- riscv64
|
||||
- mips
|
||||
- mips64
|
||||
- mipsle
|
||||
- mips64le
|
||||
- loong64
|
||||
goarm:
|
||||
- 5
|
||||
- 6
|
||||
- 7
|
||||
gomips:
|
||||
- hardfloat
|
||||
- softfloat
|
||||
ldflags:
|
||||
- -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{ .CommitDate }}
|
||||
archives:
|
||||
- name_template: >-
|
||||
{{ .ProjectName }}_{{ .Version }}_{{ if eq .Os "openbsd" }}OpenBSD{{ else }}{{ title .Os }}{{ end }}_{{ if eq .Arch "386" }}i386{{ else if eq .Arch "amd64" }}x86_64{{ else }}{{ .Arch }}{{ end }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}
|
||||
|
||||
checksum:
|
||||
name_template: 'checksums.txt'
|
||||
snapshot:
|
||||
name_template: "{{ .Tag }}-next"
|
||||
changelog:
|
||||
sort: asc
|
||||
filters:
|
||||
exclude:
|
||||
- '^docs:'
|
||||
- '^test:'
|
18
goecs.go
18
goecs.go
@@ -37,7 +37,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
ecsVersion = "v0.0.39"
|
||||
ecsVersion = "v0.0.40"
|
||||
menuMode bool
|
||||
onlyChinaTest bool
|
||||
input, choice string
|
||||
@@ -251,16 +251,28 @@ func main() {
|
||||
if !enabelUpload {
|
||||
securityTestStatus = false
|
||||
}
|
||||
startTime := time.Now()
|
||||
var (
|
||||
startTime time.Time
|
||||
wg1, wg2 sync.WaitGroup
|
||||
basicInfo, securityInfo, emailInfo, mediaInfo string
|
||||
output, tempOutput string
|
||||
)
|
||||
// 启动一个goroutine来等待信号
|
||||
// 启动一个goroutine来等待信号,内置计时器
|
||||
go func() {
|
||||
startTime = time.Now()
|
||||
// 等待信号
|
||||
<-sig
|
||||
endTime := time.Now()
|
||||
duration := endTime.Sub(startTime)
|
||||
minutes := int(duration.Minutes())
|
||||
seconds := int(duration.Seconds()) % 60
|
||||
currentTime := time.Now().Format("Mon Jan 2 15:04:05 MST 2006")
|
||||
output = utils.PrintAndCapture(func() {
|
||||
utils.PrintCenteredTitle("", width)
|
||||
fmt.Printf("Cost Time : %d min %d sec\n", minutes, seconds)
|
||||
fmt.Printf("Current Time : %s\n", currentTime)
|
||||
utils.PrintCenteredTitle("", width)
|
||||
}, tempOutput, output)
|
||||
utils.ProcessAndUpload(output, filePath, enabelUpload)
|
||||
os.Exit(1) // 使用非零状态码退出,表示意外退出
|
||||
}()
|
||||
|
11
goecs.sh
11
goecs.sh
@@ -80,7 +80,7 @@ goecs_check() {
|
||||
cdn_urls=("https://cdn0.spiritlhl.top/" "http://cdn3.spiritlhl.net/" "http://cdn1.spiritlhl.net/" "http://cdn2.spiritlhl.net/")
|
||||
check_cdn_file
|
||||
case $os in
|
||||
Linux)
|
||||
Linux|FreeBSD)
|
||||
case $arch in
|
||||
"x86_64" | "x86" | "amd64" | "x64")
|
||||
wget -O goecs.tar.gz "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/ecs_${ECS_VERSION}_linux_amd64.tar.gz"
|
||||
@@ -126,6 +126,8 @@ goecs_check() {
|
||||
rm -rf /usr/bin/goecs
|
||||
sleep 1
|
||||
cp goecs /usr/bin/goecs
|
||||
rm -rf README_EN.md
|
||||
rm -rf README.md
|
||||
echo "goecs version:"
|
||||
goecs -v || ./goecs -v
|
||||
}
|
||||
@@ -181,8 +183,7 @@ Check_SysBench() {
|
||||
_yellow "Install sysbench successfully!"
|
||||
else
|
||||
_red "SysBench Moudle install Failure! Try Restart Bench or Manually install it! (/usr/bin/sysbench)"
|
||||
_blue "Will try to test with geekbench5 instead later on"
|
||||
test_cpu_type="gb5"
|
||||
_blue "Will try to test with geekbench5 instead later."
|
||||
fi
|
||||
sleep 3
|
||||
}
|
||||
@@ -274,7 +275,7 @@ env_check() {
|
||||
cdn_urls=("https://cdn0.spiritlhl.top/" "http://cdn3.spiritlhl.net/" "http://cdn1.spiritlhl.net/" "http://cdn2.spiritlhl.net/")
|
||||
check_cdn_file
|
||||
_green "Update system manager."
|
||||
${PACKAGE_UPDATE[int]} command 2>/dev/null
|
||||
${PACKAGE_UPDATE[int]} 2>/dev/null
|
||||
if ! command -v sudo >/dev/null 2>&1; then
|
||||
_green "Installing sudo"
|
||||
${PACKAGE_INSTALL[int]} sudo
|
||||
@@ -313,6 +314,7 @@ env_check() {
|
||||
fi
|
||||
chmod +x /tmp/sysbench.zip
|
||||
unzip /tmp/sysbench.zip -d /tmp
|
||||
Check_SysBench
|
||||
fi
|
||||
fi
|
||||
if ! command -v geekbench >/dev/null 2>&1; then
|
||||
@@ -332,6 +334,7 @@ env_check() {
|
||||
curl -L "${cdn_success_url}https://raw.githubusercontent.com/oneclickvirt/speedtest/main/dspt.sh" -o dspt.sh && chmod +x dspt.sh
|
||||
bash dspt.sh
|
||||
rm -rf dspt.sh
|
||||
rm -rf speedtest.tar.gz
|
||||
_blue "if you want to use golang origin speedtest, you can use"
|
||||
echo "rm -rf /usr/bin/speedtest"
|
||||
echo "rm -rf /usr/bin/speedtest-go"
|
||||
|
Reference in New Issue
Block a user