From 7378d8f53f9c97a0caaa846a04daa25e5030533f Mon Sep 17 00:00:00 2001 From: Olia Lisa Date: Fri, 22 May 2026 12:33:45 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=81=E7=A7=BBcreate=5Fconfig=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E5=88=B0install.sh=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/create_config.sh | 31 ------------------------------- install.sh | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/bin/create_config.sh b/bin/create_config.sh index 50ed15b..cabb068 100644 --- a/bin/create_config.sh +++ b/bin/create_config.sh @@ -189,35 +189,4 @@ create_hysteria_acme_tls_config() { } -create_config(){ - local SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # 脚本文件夹绝对路径 - local CONFIG_FILE="$SCRIPT_DIR/../config/config.json" - - # 如果配置文件已存在,提示用户是否重新生成 - if [ -e "$CONFIG_FILE" ]; then - local REGENERATE - read -p "检测到配置已存在,是否重新生成配置?(y/n): " REGENERATE - if [ "$REGENERATE" != "y" ] && [ "$REGENERATE" != "Y" ]; then - echo "取消重新生成配置." - return - fi - fi - - echo "请选择配置类型:" - echo "1. Tuic" - echo "2. Hysteria" - local CHOICE - read -p "输入您的选择: " CHOICE - case $CHOICE in - 1) - create_tuic_config - ;; - 2) - create_hysteria_config - ;; - *) - echo "无效的选择, 请重新选择." - ;; - esac -} diff --git a/install.sh b/install.sh index b772d9e..74dfb28 100644 --- a/install.sh +++ b/install.sh @@ -103,6 +103,39 @@ check_config_file(){ fi } +# 创建配置文件 +create_config(){ + local SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/bin" # 脚本文件夹绝对路径 + local CONFIG_FILE="$SCRIPT_DIR/../config/config.json" + + # 如果配置文件已存在,提示用户是否重新生成 + if [ -e "$CONFIG_FILE" ]; then + local REGENERATE + read -p "检测到配置已存在,是否重新生成配置?(y/n): " REGENERATE + if [ "$REGENERATE" != "y" ] && [ "$REGENERATE" != "Y" ]; then + echo "取消重新生成配置." + return + fi + fi + + echo "请选择配置类型:" + echo "1. Tuic" + echo "2. Hysteria" + local CHOICE + read -p "输入您的选择: " CHOICE + case $CHOICE in + 1) + create_tuic_config + ;; + 2) + create_hysteria_config + ;; + *) + echo "无效的选择, 请重新选择." + ;; + esac +} + main(){ local container_status=$(check_container_status) # 显示菜单