Files
dock/GoEdge-cdn
2026-02-12 22:19:51 +08:00

71 lines
1.9 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线程) ==="
# 先清理旧文件,防止 axel 断点续传出错
rm -f "$SAVE_PATH"
# -n 10: 指定10个线程
# -a: 显示简化的进度条
# -o: 指定输出文件名
axel -n 10 -a -o "$SAVE_PATH" "$DOWNLOAD_URL"
if [ $? -ne 0 ]; then
echo "下载失败,请检查网络或链接有效性。"
exit 1
fi
# 5. 解压文件
echo "=== 正在解压文件 ==="
# -o: 覆盖不提示
# -d: 指定解压目录
unzip -o "$SAVE_PATH" -d "$INSTALL_DIR"
# 6. 执行安装和启动
if [ -d "$INSTALL_DIR/edge-admin" ]; then
cd "$INSTALL_DIR/edge-admin"
echo "=== 正在配置系统服务 ==="
./edge-admin install
echo "=== 正在启动 GoEdge Admin ==="
./edge-admin start
# 检查进程是否运行
if pgrep -f "edge-admin" > /dev/null; then
echo ">>> 安装并启动成功!"
echo ">>> 请访问 http://你的IP:7788 进行配置"
else
echo "启动命令已执行,但进程未检测到,请手动检查 logs 目录。"
fi
else
echo "错误:解压后未找到 edge-admin 目录,请检查下载文件是否正确。"
fi