Files
dock/GoEdge-cdn
2026-02-13 09:32:05 +08:00

73 lines
2.2 KiB
Bash
Raw 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.
#!/bin/bash
# 定义变量
INSTALL_DIR="/usr/local/goedge"
# 你的 Gitea 下载链接
DOWNLOAD_URL="https://git.vps3344521.xyz/3344/dock/releases/download/Goedge-cdn/edge-admin-linux-amd64-plus-v1.4.7.zip"
SAVE_PATH="/tmp/edge-admin.zip"
echo "=== 开始检查依赖环境 ==="
# 1. 检测并安装 unzip (解压用)
if ! command -v unzip &> /dev/null; then
echo "未检测到 unzip正在安装..."
apt-get update && apt-get install -y unzip
fi
# 2. 检测并安装 axel (多线程下载用)
if ! command -v axel &> /dev/null; then
echo "未检测到 axel正在安装..."
apt-get update && apt-get install -y axel
else
echo "检测到 axel 已安装。"
fi
# 3. 准备目录
if [ ! -d "$INSTALL_DIR" ]; then
mkdir -p "$INSTALL_DIR"
echo "创建目录: $INSTALL_DIR"
fi
# 4. 使用 axel 多线程下载
echo "=== 开始多线程下载 (10线程) ==="
rm -f "$SAVE_PATH"
axel -n 10 -a -o "$SAVE_PATH" "$DOWNLOAD_URL"
if [ $? -ne 0 ]; then
echo "下载失败,请检查网络或链接有效性。"
exit 1
fi
# 5. 解压文件
echo "=== 正在解压文件 ==="
unzip -o "$SAVE_PATH" -d "$INSTALL_DIR"
# 6. 自动寻找并执行安装
# 兼容不同解压路径,自动寻找 edge-admin 二进制文件所在位置
REAL_BIN_PATH=$(find $INSTALL_DIR -name "edge-admin" -type f | grep "/bin/" | head -n 1)
if [ -f "$REAL_BIN_PATH" ]; then
REAL_DIR=$(dirname $(dirname "$REAL_BIN_PATH"))
cd "$REAL_DIR"
echo "=== 正在配置系统服务 ==="
chmod +x bin/edge-admin
./bin/edge-admin install
echo "=== 正在启动 GoEdge Admin ==="
./bin/edge-admin start
# 获取本机 IP
SERVER_IP=$(curl -s https://ifconfig.me || hostname -I | awk '{print $1}')
echo ""
echo "======================================================"
echo "🎉 GoEdge Admin 安装并启动成功!"
echo "======================================================"
echo "👉 访问地址: http://${SERVER_IP}:7788"
echo "👉 默认配置: 请按照网页提示进行初始化"
echo "👉 数据目录: ${REAL_DIR}"
echo "======================================================"
else
echo "错误:未能找到 edge-admin 程序,请检查压缩包内容。"
fi