Files
dock/GoEdge-cdn
2026-02-12 21:38:52 +08:00

70 lines
1.8 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 获取当前系统的操作系统类型(如 Linux
OS=`uname -s`
# 获取当前系统的硬件架构(如 x86_64 或 aarch64
ARCH=`uname -m`
# 初始化 Go 语言对应的架构变量
GOARCH=""
# 定义 GoEdge 的默认安装目录
DIST=/usr/local/goedge
# 检查系统是否安装了 wget 工具
if [ `which wget` ]; then
echo "checking wget ... ok"
else
# 如果没有 wget脚本将无法下载文件直接退出
echo "'wget' command not found"
exit
fi
# 根据系统硬件架构分配对应的下载标识
case "$ARCH" in
"x86_64")
# 64位 Intel/AMD 处理器
GOARCH="amd64"
;;
"aarch64_be"|"aarch64"|"armv8b"|"armv8l"|"armv8"|"arm64")
# 64位 ARM 处理器(如 树莓派、华为鲲鹏、部分云服务器)
GOARCH="arm64"
;;
*)
# 如果是不支持的架构,输出错误并退出
echo "arch '${ARCH}' is not supported yet"
exit
;;
esac
# 拼接 edge-boot 引导程序的下载地址
BOOT_URL="https://dl.goedge.cloud/edge-boot/linux/${GOARCH}/edge-boot"
# 定义引导程序在本地系统的存放路径
BOOT_FILE="/usr/local/bin/edge-boot"
# 如果本地不存在 edge-boot 文件,则开始下载和安装
if [ ! -e $BOOT_FILE ]; then
echo "installing edge-boot to '/usr/local/bin' ..."
# 如果存放路径的目录不存在,则递归创建该目录
if [ ! -d /usr/local/bin ]; then
mkdir -p /usr/local/bin
fi
# 从官网下载 edge-boot 二进制文件
wget $BOOT_URL -O $BOOT_FILE
# 检查文件是否下载成功
if [ ! -f $BOOT_FILE ]; then
echo "download edge-boot failed"
exit
fi
# 赋予该文件所有者可执行权限
chmod u+x $BOOT_FILE
fi
# 输出安装提示信息
echo "installing edge-admin to '${DIST}' ..."
# 调用下载好的引导程序,执行真正的 edge-admin 安装流程
$BOOT_FILE install admin