From 74e7ddc044cfc9965761b46af0aeff181cf422a9 Mon Sep 17 00:00:00 2001 From: zhao Date: Fri, 24 Jan 2025 01:13:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20bin/=20ZeroWrt.backup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhao --- bin/ ZeroWrt.backup | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/bin/ ZeroWrt.backup b/bin/ ZeroWrt.backup index a5dcde8..84702ba 100644 --- a/bin/ ZeroWrt.backup +++ b/bin/ ZeroWrt.backup @@ -331,6 +331,7 @@ install_apps() { color_output "\e[36m┃\e[0m 3. 部署 Subconverter \e[36m┃\e[0m" color_output "\e[36m┃\e[0m 4. 部署 AdGuardhome \e[36m┃\e[0m" color_output "\e[36m┃\e[0m 5. 部署 Gitea-MySQL \e[36m┃\e[0m" + color_output "\e[36m┃\e[0m 6. 部署 SunPanel \e[36m┃\e[0m" color_output "\e[36m┃\e[0m 0. 返回主菜单 \e[36m┃\e[0m" color_output "\e[36m┃ ┃\e[0m" color_output "\e[36m┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛\e[0m" @@ -511,7 +512,45 @@ install_apps() { color_output "\e[31mGitea-MySQL 部署失败!\e[0m" fi read -p "按 Enter 键返回..." - ;; + ;; + 6) + color_output "\e[34m[部署 SunPanel]\e[0m" + + # 检查 SunPanel 容器是否已存在 + if docker ps -a | grep -q "sunpanel"; then + color_output "\e[33mSunPanel 已经部署过,跳过部署!\e[0m" + read -p "按 Enter 键返回..." + continue + fi + + color_output "\e[33m正在部署 SunPanel...\e[0m" + + # 创建目录 + mkdir -p /opt/sunpanel + + # 下载 Docker Compose 文件到 /opt/sunpanel + curl -L https://git.kejizero.online/zhao/files/raw/branch/main/docker-compose/SunPanel -o /opt/sunpanel/docker-compose.yml + + # 检查是否下载成功 + if [ -f "/opt/sunpanel/docker-compose.yml" ]; then + color_output "\e[32mDocker Compose 文件下载成功!\e[0m" + else + color_output "\e[31mDocker Compose 文件下载失败!\e[0m" + read -p "按 Enter 键返回..." + continue + fi + + # 部署 SunPanel + cd /opt/sunpanel + docker-compose up -d + + if docker ps | grep -q "sunpanel"; then + color_output "\e[32mSunPanel 部署成功!\e[0m" + else + color_output "\e[31mSunPanel 部署失败!\e[0m" + fi + read -p "按 Enter 键返回..." + ;; 0) show_menu return