From de4e951fdbc76e84c47f5044397c422b8e222a59 Mon Sep 17 00:00:00 2001 From: zhao Date: Fri, 27 Dec 2024 00:02:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20bin/ZeroWrt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhao --- bin/ZeroWrt | 81 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 61 insertions(+), 20 deletions(-) diff --git a/bin/ZeroWrt b/bin/ZeroWrt index a10c041..86e0ef8 100644 --- a/bin/ZeroWrt +++ b/bin/ZeroWrt @@ -45,7 +45,7 @@ show_menu() { color_output "\e[36m┃\e[0m 3. 切换默认主题 \e[36m┃\e[0m" color_output "\e[36m┃\e[0m 4. 恢复出厂设置 \e[36m┃\e[0m" color_output "\e[36m┃\e[0m 5. 一键换源 \e[36m┃\e[0m" - color_output "\e[36m┃\e[0m 6. 安装 ShellClash \e[36m┃\e[0m" + color_output "\e[36m┃\e[0m 6. 一键部署 \e[36m┃\e[0m" color_output "\e[36m┃\e[0m 7. 检测更新 \e[36m┃\e[0m" color_output "\e[36m┃\e[0m 0. 退出 \e[36m┃\e[0m" color_output "\e[36m┃ ┃\e[0m" @@ -57,7 +57,7 @@ show_menu() { 3) change_theme ;; 4) reset_config ;; 5) change_source ;; - 6) install_shellclash ;; + 6) install_apps ;; 7) check_update ;; 0) exit 0 ;; *) echo "无效选项,请重新输入"; show_menu ;; @@ -155,26 +155,67 @@ EOF show_menu } -# 6. 安装 ShellClash -install_shellclash() { - color_output "\e[34m[安装 ShellClash]\e[0m" - color_output "\e[36m请选择 ShellClash 的安装源:\e[0m" - color_output "1. GitHub 源" - color_output "2. jsDelivr CDN 源" - color_output "0. 返回" - read -p "请输入您的选择 [0-2]: " install_choice +# 6. 一键部署 +install_apps() { + while true; do + clear + color_output "\e[34m[一键部署]\e[0m" + color_output "\e[36m┏━━━━━━━━━━━━━━━ 部署选项 ━━━━━━━━━━━━━━━┓\e[0m" + color_output "\e[36m┃ ┃\e[0m" + color_output "\e[36m┃\e[0m 1. 安装 ShellClash \e[36m┃\e[0m" + color_output "\e[36m┃\e[0m 2. 安装小雅 Alist \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" + + read -p "$(color_output "\e[33m请输入您的选择 [0-2]: \e[0m")" app_choice - case "$install_choice" in - 1) export url='https://raw.githubusercontent.com/juewuy/ShellCrash/master' ;; - 2) export url='https://fastly.jsdelivr.net/gh/juewuy/ShellCrash@master' ;; - 0) show_menu ; return ;; - *) color_output "\e[31m无效选项,返回菜单。\e[0m" ; show_menu ; return ;; - esac + case "$app_choice" in + 1) + color_output "\e[34m[安装 ShellClash]\e[0m" + color_output "\e[36m请选择 ShellClash 的安装源:\e[0m" + color_output "1. GitHub 源" + color_output "2. jsDelivr CDN 源" + color_output "0. 返回" + read -p "请输入您的选择 [0-2]: " install_choice - sh -c "$(curl -kfsSl $url/install.sh)" && source /etc/profile &> /dev/null - color_output "\e[32mShellClash 已成功安装。\e[0m" - read -p "按 Enter 键返回菜单..." - show_menu + case "$install_choice" in + 1) export url='https://raw.githubusercontent.com/juewuy/ShellCrash/master' ;; + 2) export url='https://fastly.jsdelivr.net/gh/juewuy/ShellCrash@master' ;; + 0) continue ;; + *) + color_output "\e[31m无效选项\e[0m" + sleep 2 + continue + ;; + esac + + if [ "$install_choice" != "0" ]; then + sh -c "$(curl -kfsSl $url/install.sh)" && source /etc/profile &> /dev/null + color_output "\e[32mShellClash 已成功安装。\e[0m" + read -p "按 Enter 键继续..." + fi + ;; + + 2) + color_output "\e[34m[安装小雅 Alist]\e[0m" + color_output "\e[33m正在安装小雅 Alist...\e[0m" + bash -c "$(curl --insecure -fsSL https://ddsrem.com/xiaoya_install.sh)" + color_output "\e[32m小雅 Alist 安装完成。\e[0m" + read -p "按 Enter 键继续..." + ;; + + 0) + show_menu + return + ;; + + *) + color_output "\e[31m无效选项,请重新选择\e[0m" + sleep 2 + ;; + esac + done } # 7. 检测更新