diff --git a/.github/workflows/sync.yaml b/.github/workflows/sync.yaml index 3761cd2..6d10bca 100644 --- a/.github/workflows/sync.yaml +++ b/.github/workflows/sync.yaml @@ -27,6 +27,13 @@ jobs: git config --local user.name "GitHub Action" git config --local user.email "action@github.com" + - name: Copy repository files + run: | + cp goecs.sh temp_repo/ + cp README_EN.md temp_repo/ + cp README.md temp_repo/ + cp LICENSE temp_repo/ + - name: Download release assets run: | cd temp_repo diff --git a/README.md b/README.md index 7aad7d7..76480af 100644 --- a/README.md +++ b/README.md @@ -1,149 +1,164 @@ -# ecs +# ECS [![release](https://github.com/oneclickvirt/ecs/actions/workflows/main.yaml/badge.svg)](https://github.com/oneclickvirt/ecs/actions/workflows/main.yaml) [![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Foneclickvirt%2Fecs&count_bg=%2357DEFF&title_bg=%23000000&icon=cliqz.svg&icon_color=%23E7E7E7&title=hits&edge_flat=false)](https://www.spiritlhl.net/) -融合怪测评脚本 - GO重构版本 - 由于未正式发版,如有问题请issues反馈 +融合怪测评脚本 - GO 重构版本 +由于未正式发版,如有问题请 [issues](https://github.com/oneclickvirt/ecs/issues) 反馈。 -Shell版本: https://github.com/spiritLHLS/ecs +Shell 版本:[https://github.com/spiritLHLS/ecs](https://github.com/spiritLHLS/ecs) -## 语言 +--- + +## **语言** [中文文档](README.md) | [English Docs](README_EN.md) -## 适配系统和架构 +--- -编译支持的架构: amd64、arm、arm64、386、mips、mipsle、s390x、riscv64 +## **适配系统和架构** -测试支持的架构: amd64、arm64 +### **编译支持的架构** -更多架构请自行测试 +- amd64、arm、arm64、386、mips、mipsle、s390x、riscv64 -编译支持的系统: Linux、Windows、MacOS、FreeBSD、OpenBSD +### **测试支持的架构** -测试支持的系统: Linux、Windows +- amd64、arm64 -更多系统请自行测试 +> 更多架构请自行测试。 -待支持的系统(存在硬件测试BUG未修复): MacOS、FreeBSD、OpenBSD +### **编译支持的系统** -## 功能 +- Linux、Windows、MacOS、FreeBSD、OpenBSD -- [x] 系统基础信息查询[自研[basics](https://github.com/oneclickvirt/basics)、[gostun](https://github.com/oneclickvirt/gostun)] -- [x] IP基础信息并发查询[自研[basics](https://github.com/oneclickvirt/basics)] -- [x] CPU测试[自研[cputest](https://github.com/oneclickvirt/cputest)支持sysbench、geekbench、winsat] -- [x] 内存测试[自研[memorytest](https://github.com/oneclickvirt/memorytest)支持sysbench、dd] -- [x] 硬盘测试[自研[disktest](https://github.com/oneclickvirt/disktest)支持dd、fio、winsat] -- [x] 御三家流媒体解锁信息并发查询[借鉴[netflix-verify](https://github.com/sjlleo/netflix-verify)、[VerifyDisneyPlus](https://github.com/sjlleo/VerifyDisneyPlus)、[TubeCheck](https://github.com/sjlleo/TubeCheck)逻辑开发至于[CommonMediaTests](https://github.com/oneclickvirt/CommonMediaTests)] -- [x] 常见流媒体测试并发查询[自研至于[UnlockTests](https://github.com/oneclickvirt/UnlockTests),逻辑借鉴[RegionRestrictionCheck](https://github.com/lmc999/RegionRestrictionCheck)、[MediaUnlockTest](https://github.com/HsukqiLee/MediaUnlockTest)] -- [x] IP质量/安全信息并发查询[自研,由于测试含密钥信息,故而私有化开发,但二进制文件编译至于[securityCheck](https://github.com/oneclickvirt/securityCheck)] -- [x] 邮件端口测试[自研[portchecker](https://github.com/oneclickvirt/portchecker)] -- [x] 三网回程测试[借鉴[zhanghanyun/backtrace](https://github.com/zhanghanyun/backtrace)二次开发至于[oneclickvirt/backtrace](https://github.com/oneclickvirt/backtrace)] -- [x] 三网路由测试[借鉴[NTrace-core](https://github.com/nxtrace/NTrace-core)二次开发至于[nt3](https://github.com/oneclickvirt/nt3)] -- [x] 测试网速[基于[speedtest.net-爬虫](https://github.com/spiritLHLS/speedtest.net-CN-ID)、[speedtest.cn-爬虫](https://github.com/spiritLHLS/speedtest.cn-CN-ID)的数据,使用[speedtest-go](https://github.com/showwin/speedtest-go)开发至于[oneclickvirt/speedtest](https://github.com/oneclickvirt/speedtest)] -- [x] 测试三网Ping值[借鉴[ecsspeed](https://github.com/spiritLHLS/ecsspeed)的逻辑二次开发至于[pingtest](https://github.com/oneclickvirt/pingtest)] +### **测试支持的系统** -## Linux/FreeBSD/MacOS上使用的说明 +- Linux、Windows -### 一键命令 +> 更多系统请自行测试。 -``` -export noninteractive=true && curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs -``` +### **待支持的系统** -或 +- MacOS、FreeBSD、OpenBSD(存在硬件测试 BUG 未修复) -``` -export noninteractive=true && curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs -``` +--- -### 详细说明 +## **功能** -下载脚本 +- 系统基础信息查询: + 自研 [basics](https://github.com/oneclickvirt/basics)、[gostun](https://github.com/oneclickvirt/gostun) +- IP 基础信息并发查询: + 自研 [basics](https://github.com/oneclickvirt/basics) +- CPU 测试: + 自研 [cputest](https://github.com/oneclickvirt/cputest),支持 sysbench、geekbench、winsat +- 内存测试: + 自研 [memorytest](https://github.com/oneclickvirt/memorytest),支持 sysbench、dd +- 硬盘测试: + 自研 [disktest](https://github.com/oneclickvirt/disktest),支持 dd、fio、winsat +- 流媒体解锁信息并发查询: + 借鉴 [netflix-verify](https://github.com/sjlleo/netflix-verify) 等逻辑,开发至 [CommonMediaTests](https://github.com/oneclickvirt/CommonMediaTests) +- 常见流媒体测试并发查询: + 自研至 [UnlockTests](https://github.com/oneclickvirt/UnlockTests),逻辑借鉴 [RegionRestrictionCheck](https://github.com/lmc999/RegionRestrictionCheck) 等 +- IP 质量/安全信息并发查询: + 自研,二进制文件编译至 [securityCheck](https://github.com/oneclickvirt/securityCheck) +- 邮件端口测试: + 自研 [portchecker](https://github.com/oneclickvirt/portchecker) +- 三网回程测试: + 借鉴 [zhanghanyun/backtrace](https://github.com/zhanghanyun/backtrace),二次开发至 [oneclickvirt/backtrace](https://github.com/oneclickvirt/backtrace) +- 三网路由测试: + 借鉴 [NTrace-core](https://github.com/nxtrace/NTrace-core),二次开发至 [nt3](https://github.com/oneclickvirt/nt3) +- 网速测试: + 基于 [speedtest.net](https://github.com/spiritLHLS/speedtest.net-CN-ID) 和 [speedtest.cn](https://github.com/spiritLHLS/speedtest.cn-CN-ID) 数据,开发至 [oneclickvirt/speedtest](https://github.com/oneclickvirt/speedtest) +- 三网 Ping 值测试: + 借鉴 [ecsspeed](https://github.com/spiritLHLS/ecsspeed),二次开发至 [pingtest](https://github.com/oneclickvirt/pingtest) -``` -curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh -``` +--- -或 +## **使用说明** -``` -curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh -``` +### **Linux/FreeBSD/MacOS** -更新包管理器(可选择)和安装环境 +#### **一键命令** -``` -./goecs.sh env -``` +- **国际用户无加速:** -如果不想要互动,可使用```export noninteractive=true```再执行```env```命令 + ```bash + export noninteractive=true && curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs + ``` -安装goecs +- **国际/国内使用 CDN 加速:** -``` -./goecs.sh install -``` + ```bash + export noninteractive=true && curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs + ``` -升级goecs +- **国内用户使用 CNB 加速:** -``` -./goecs.sh upgrade -``` + ```bash + export noninteractive=true && curl -L https://cnb.cool/oneclickvirt/ecs/-/git/raw/main/goecs.sh -o goecs.sh && chmod +x goecs.sh && bash goecs.sh env && bash goecs.sh install && goecs + ``` -卸载goecs +#### **详细说明** -``` -./goecs.sh uninstall -``` +1. **下载脚本** -shell脚本的说明 + **国际用户无加速:** -``` -可用命令: - -./goecs.sh env 检查并安装依赖包 - 警告: 此命令会执行系统更新(可选择),可能: - 1. 耗时较长 - 2. 导致网络短暂中断 - 3. 影响系统稳定性 - 4. 影响后续系统启动 - 对于内存小于1GB的系统,还可能导致: - 1. 系统卡死 - 2. SSH连接中断 - 3. 关键服务失败 - 推荐: - 环境依赖安装过程中挂起执行 - - 必需组件: - sysbench/geekbench (CPU性能测试必需) - - 可选组件: - sudo, tar, unzip, dd, fio - speedtest (网络测试) - ping (网络连通性测试) - systemd-detect-virt/dmidecode (系统信息检测) - -./goecs.sh install 安装 goecs 命令 -./goecs.sh upgrade 升级 goecs 命令 -./goecs.sh uninstall 卸载 goecs 命令 -./goecs.sh help 显示此消息 -``` + ```bash + curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh + ``` -goecs唤起菜单 + **国际/国内使用 CDN 加速:** -``` -goecs -``` + ```bash + curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh + ``` -或 + **国内用户使用 CNB 加速:** -``` -./goecs -``` + ```bash + curl -L https://cnb.cool/oneclickvirt/ecs/-/git/raw/main/goecs.sh -o goecs.sh && chmod +x goecs.sh + ``` -goecs命令参数化 +2. **更新包管理器(可选择)并安装环境** -``` + ```bash + ./goecs.sh env + ``` + + **非互动模式:** + + ```bash + export noninteractive=true && ./goecs.sh env + ``` + +3. **安装 `goecs`** + + ```bash + ./goecs.sh install + ``` + +4. **升级 `goecs`** + + ```bash + ./goecs.sh upgrade + ``` + +5. **卸载 `goecs`** + + ```bash + ./goecs.sh uninstall + ``` + +6. **唤起菜单** + + ```bash + goecs + ``` + +#### **命令参数化** + +```bash Usage: goecs [options] -backtrace Enable/Disable backtrace test (in 'en' language or on windows it always false) (default true) @@ -197,19 +212,16 @@ Usage: goecs [options] -v Display version information ``` -## Windows上使用的说明 - -下载带exe文件的压缩文件 - -https://github.com/oneclickvirt/ecs/releases +--- -找其中最新的版本,按照对应架构下载对应的 .zip 文件,解压后文件夹内有一个exe文件 +### **Windows** -选择该exe文件,右键点击选择管理员模式运行(非管理员模式运行无法进行硬件测试),唤起菜单自选 +1. 下载带 exe 文件的压缩包:[Releases](https://github.com/oneclickvirt/ecs/releases) +2. 解压后,右键以管理员模式运行。 -windows测试无需进行环境安装 +--- -## 在Docker中使用的说明 +### **Docker** 国际镜像地址:https://hub.docker.com/r/spiritlhl/goecs @@ -253,10 +265,10 @@ docker run --rm docker.cnb.cool/oneclickvirt/ecs:latest -menu=false -l zh ``` sysbench geekbench -轻量几乎所有服务器都能跑 重型小机器跑不动 -测试无联网需求,无硬件需求 测试必须联网,且必须IPV4环境,且有内存大小1G的最低需求 -LUA编写且开源,各架构系统可自行编译 仅官方二进制文件且不开源,无对应架构时无法自行编译 -核心测试组件十多年不变 每次大版本更新对标的CPU,不同版本间得分互相之间难转化,你只能以对标的CPU为准 +轻量几乎所有服务器都能跑 重型小机器跑不动 +测试无联网需求,无硬件需求 测试必须联网,且必须IPV4环境并有内存大小1G的最低需求 +LUA编写且开源,各架构系统可自行编译 仅官方二进制文件且不开源,无对应架构时无法自行编译 +核心测试组件十多年不变 每次大版本更新对标的CPU,不同版本间得分互相之间难转化,你只能以对标的CPU为准 测试仅测试计算性能 测试涵盖多种性能测试,得分以权重计算,但实际很多测试项目实际是用不到的 适合快速测试 适合全面测试 ``` diff --git a/goecs.sh b/goecs.sh index e1ddb44..35f5860 100644 --- a/goecs.sh +++ b/goecs.sh @@ -1,8 +1,10 @@ #!/bin/bash # From https://github.com/oneclickvirt/ecs -# 2024.11.18 +# 2024.12.08 # curl -L https://raw.githubusercontent.com/oneclickvirt/ecs/master/goecs.sh -o goecs.sh && chmod +x goecs.sh +# 或 +# curl -L https://cnb.cool/oneclickvirt/ecs/-/git/raw/main/goecs.sh -o goecs.sh && chmod +x goecs.sh cat <<"EOF" GGGGGGGG OOOOOOO EEEEEEEE CCCCCCCCC SSSSSSSSSS @@ -60,6 +62,67 @@ download_file() { return 0 } +check_china() { + _yellow "正在检测IP所在区域......" + if [[ -z "${CN}" ]]; then + # 首先尝试通过 ipapi.co 检测 + if curl -m 6 -s https://ipapi.co/json | grep -q 'China'; then + _yellow "根据ipapi.co提供的信息,当前IP可能在中国" + if [ "$noninteractive" != "true" ]; then + reading "是否使用中国镜像完成安装? ([y]/n) " input + case $input in + [yY][eE][sS] | [yY] | "") + _green "已选择使用中国镜像" + CN=true + ;; + [nN][oO] | [nN]) + _yellow "已选择不使用中国镜像" + CN=false + ;; + *) + _green "已选择使用中国镜像" + CN=true + ;; + esac + else + # 在非交互模式下默认使用中国镜像 + CN=true + fi + else + # 如果 ipapi.co 检测失败,尝试使用 cip.cc + if ! curl -m 6 -s https://ipapi.co/json >/dev/null 2>&1; then + if curl -m 6 -s cip.cc | grep -q "中国"; then + _yellow "根据cip.cc提供的信息,当前IP可能在中国" + if [ "$noninteractive" != "true" ]; then + reading "是否使用中国镜像完成安装? ([y]/n) " input + case $input in + [yY][eE][sS] | [yY] | "") + _green "已选择使用中国镜像" + CN=true + ;; + [nN][oO] | [nN]) + _yellow "已选择不使用中国镜像" + CN=false + ;; + *) + _green "已选择使用中国镜像" + CN=true + ;; + esac + else + # 在非交互模式下默认使用中国镜像 + CN=true + fi + else + CN=false + fi + else + CN=false + fi + fi + fi +} + get_memory_size() { if [ -f /proc/meminfo ]; then local mem_kb=$(grep MemTotal /proc/meminfo | awk '{print $2}') @@ -89,6 +152,8 @@ cleanup_epel() { goecs_check() { os=$(uname -s) arch=$(uname -m) + # 先进行中国IP检测 + check_china ECS_VERSION=$(curl -m 6 -sSL "https://api.github.com/repos/oneclickvirt/ecs/releases/latest" | awk -F \" '/tag_name/{gsub(/^v/,"",$4); print $4}') # 如果 https://api.github.com/ 请求失败,则使用 https://githubapi.spiritlhl.workers.dev/ ,此时可能宿主机无IPV4网络 if [ -z "$ECS_VERSION" ]; then @@ -117,75 +182,144 @@ goecs_check() { _green "Can not find goecs, need to download and install, 5 seconds later will start to install" fi sleep 5 - 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) - case $arch in - "x86_64" | "x86" | "amd64" | "x64") - download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_amd64.zip" "goecs.zip" + if [[ "$CN" == true ]]; then + _yellow "使用中国镜像下载..." + case $os in + Linux) + case $arch in + "x86_64" | "x86" | "amd64" | "x64") + download_file "https://cnb.cool/oneclickvirt/ecs/-/git/raw/main/goecs_linux_amd64.zip" "goecs.zip" + ;; + "i386" | "i686") + download_file "https://cnb.cool/oneclickvirt/ecs/-/git/raw/main/goecs_linux_386.zip" "goecs.zip" + ;; + "armv7l" | "armv8" | "armv8l" | "aarch64" | "arm64") + download_file "https://cnb.cool/oneclickvirt/ecs/-/git/raw/main/goecs_linux_arm64.zip" "goecs.zip" + ;; + "mips") + download_file "https://cnb.cool/oneclickvirt/ecs/-/git/raw/main/goecs_linux_mips.zip" "goecs.zip" + ;; + "mipsle") + download_file "https://cnb.cool/oneclickvirt/ecs/-/git/raw/main/goecs_linux_mipsle.zip" "goecs.zip" + ;; + "s390x") + download_file "https://cnb.cool/oneclickvirt/ecs/-/git/raw/main/goecs_linux_s390x.zip" "goecs.zip" + ;; + "riscv64") + download_file "https://cnb.cool/oneclickvirt/ecs/-/git/raw/main/goecs_linux_riscv64.zip" "goecs.zip" + ;; + *) + _red "不支持的架构: $arch" + exit 1 + ;; + esac ;; - "i386" | "i686") - download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_386.zip" "goecs.zip" + FreeBSD) + case $arch in + "x86_64" | "x86" | "amd64" | "x64") + download_file "https://cnb.cool/oneclickvirt/ecs/-/git/raw/main/goecs_freebsd_amd64.zip" "goecs.zip" + ;; + "i386" | "i686") + download_file "https://cnb.cool/oneclickvirt/ecs/-/git/raw/main/goecs_freebsd_386.zip" "goecs.zip" + ;; + "armv7l" | "armv8" | "armv8l" | "aarch64" | "arm64") + download_file "https://cnb.cool/oneclickvirt/ecs/-/git/raw/main/goecs_freebsd_arm64.zip" "goecs.zip" + ;; + *) + _red "不支持的架构: $arch" + exit 1 + ;; + esac ;; - "armv7l" | "armv8" | "armv8l" | "aarch64" | "arm64") - download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_arm64.zip" "goecs.zip" - ;; - "mips") - download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_mips.zip" "goecs.zip" - ;; - "mipsle") - download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_mipsle.zip" "goecs.zip" - ;; - "s390x") - download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_s390x.zip" "goecs.zip" - ;; - "riscv64") - download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_riscv64.zip" "goecs.zip" + Darwin) + case $arch in + "x86_64" | "x86" | "amd64" | "x64") + download_file "https://cnb.cool/oneclickvirt/ecs/-/git/raw/main/goecs_darwin_amd64.zip" "goecs.zip" + ;; + "armv7l" | "armv8" | "armv8l" | "aarch64" | "arm64") + download_file "https://cnb.cool/oneclickvirt/ecs/-/git/raw/main/goecs_darwin_arm64.zip" "goecs.zip" + ;; + *) + _red "不支持的架构: $arch" + exit 1 + ;; + esac ;; *) - _red "Unsupported architecture: $arch , please check https://github.com/oneclickvirt/ecs/releases to download the zip for yourself and unzip it to use the binary for testing." + _red "不支持的操作系统: $os" exit 1 ;; - esac - ;; - FreeBSD) - case $arch in - "x86_64" | "x86" | "amd64" | "x64") - download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_freebsd_amd64.zip" "goecs.zip" - ;; - "i386" | "i686") - download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_freebsd_386.zip" "goecs.zip" - ;; - "armv7l" | "armv8" | "armv8l" | "aarch64" | "arm64") - download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_freebsd_arm64.zip" "goecs.zip" - ;; - *) - _red "Unsupported architecture: $arch , please check https://github.com/oneclickvirt/ecs/releases to download the zip for yourself and unzip it to use the binary for testing." - exit 1 + esac + else + 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) + case $arch in + "x86_64" | "x86" | "amd64" | "x64") + download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_amd64.zip" "goecs.zip" + ;; + "i386" | "i686") + download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_386.zip" "goecs.zip" + ;; + "armv7l" | "armv8" | "armv8l" | "aarch64" | "arm64") + download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_arm64.zip" "goecs.zip" + ;; + "mips") + download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_mips.zip" "goecs.zip" + ;; + "mipsle") + download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_mipsle.zip" "goecs.zip" + ;; + "s390x") + download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_s390x.zip" "goecs.zip" + ;; + "riscv64") + download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_linux_riscv64.zip" "goecs.zip" + ;; + *) + _red "Unsupported architecture: $arch , please check https://github.com/oneclickvirt/ecs/releases to download the zip for yourself and unzip it to use the binary for testing." + exit 1 + ;; + esac ;; - esac - ;; - Darwin) - case $arch in - "x86_64" | "x86" | "amd64" | "x64") - download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_amd64.zip" "goecs.zip" + FreeBSD) + case $arch in + "x86_64" | "x86" | "amd64" | "x64") + download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_freebsd_amd64.zip" "goecs.zip" + ;; + "i386" | "i686") + download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_freebsd_386.zip" "goecs.zip" + ;; + "armv7l" | "armv8" | "armv8l" | "aarch64" | "arm64") + download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_freebsd_arm64.zip" "goecs.zip" + ;; + *) + _red "Unsupported architecture: $arch , please check https://github.com/oneclickvirt/ecs/releases to download the zip for yourself and unzip it to use the binary for testing." + exit 1 + ;; + esac ;; - "armv7l" | "armv8" | "armv8l" | "aarch64" | "arm64") - download_file "${cdn_success_url}https://github.com/oneclickvirt/ ecs/releases/download/v${ECS_VERSION}/goecs_arm64.zip" "goecs.zip" + Darwin) + case $arch in + "x86_64" | "x86" | "amd64" | "x64") + download_file "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/goecs_amd64.zip" "goecs.zip" + ;; + "armv7l" | "armv8" | "armv8l" | "aarch64" | "arm64") + download_file "${cdn_success_url}https://github.com/oneclickvirt/ ecs/releases/download/v${ECS_VERSION}/goecs_arm64.zip" "goecs.zip" + ;; + *) + _red "Unsupported architecture: $arch , please check https://github.com/oneclickvirt/ecs/releases to download the zip for yourself and unzip it to use the binary for testing." + exit 1 + ;; + esac ;; *) - _red "Unsupported architecture: $arch , please check https://github.com/oneclickvirt/ecs/releases to download the zip for yourself and unzip it to use the binary for testing." + _red "Unsupported operating system: $os , please check https://github.com/oneclickvirt/ecs/releases to download the zip for yourself and unzip it to use the binary for testing." exit 1 ;; - esac - ;; - *) - _red "Unsupported operating system: $os , please check https://github.com/oneclickvirt/ecs/releases to download the zip for yourself and unzip it to use the binary for testing." - exit 1 - ;; - esac - + esac + fi unzip goecs.zip rm -rf goecs.zip rm -rf README.md