From 55e856934fde9ec2ff16955f570e312dd8c85f40 Mon Sep 17 00:00:00 2001 From: lsy Date: Mon, 23 Sep 2024 16:47:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86acme=E9=87=8D=E5=91=BD=E5=90=8D?= =?UTF-8?q?=E6=96=B9=E4=BE=BF=E5=8C=BA=E5=88=86,=E5=B0=86=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=8C=96=E8=84=9A=E6=9C=AC=E7=9A=84=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E8=AD=A6=E5=91=8A=E6=8F=90=E5=8F=96=E5=87=BA=E6=9D=A5=E4=BA=86?= =?UTF-8?q?,=E5=B0=86bbr=E6=8F=90=E5=8F=96=E5=87=BA=E6=9D=A5=E4=BA=86,?= =?UTF-8?q?=E6=9B=B4=E6=94=B9other=E7=9A=84=E6=89=93=E5=8D=B0=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Config/Automation/acme.sh | 11 ------ Config/Automation/acme_update.sh | 7 ++++ Config/Automation/backup.sh | 4 -- Config/Automation/up-docker_compose.sh | 4 +- Config/Automation/update.sh | 4 -- Config/Other/{Language.sh => Language_set.sh} | 0 Config/Other/Reinstall.sh | 2 +- Config/Other/{Acme.sh => acme_ssl.sh} | 0 Config/Other/bbr_open.sh | 10 +++++ Menus/Automation.sh | 4 ++ Menus/Other.sh | 39 ++++++------------- 11 files changed, 35 insertions(+), 50 deletions(-) delete mode 100644 Config/Automation/acme.sh create mode 100644 Config/Automation/acme_update.sh rename Config/Other/{Language.sh => Language_set.sh} (100%) rename Config/Other/{Acme.sh => acme_ssl.sh} (100%) create mode 100644 Config/Other/bbr_open.sh diff --git a/Config/Automation/acme.sh b/Config/Automation/acme.sh deleted file mode 100644 index 818fa31..0000000 --- a/Config/Automation/acme.sh +++ /dev/null @@ -1,11 +0,0 @@ -declare path="$1" - -if [[ -f "${path}/acme.sh" ]];then - echo "该路径文件已经存在" -fi - -cat > "${path}/acme.sh" << EOF -#!/bin/bash -${HOME}/.acme.sh/acme.sh --upgrade -${HOME}/.acme.sh/acme.sh --renew-all -EOF \ No newline at end of file diff --git a/Config/Automation/acme_update.sh b/Config/Automation/acme_update.sh new file mode 100644 index 0000000..2c3f6e3 --- /dev/null +++ b/Config/Automation/acme_update.sh @@ -0,0 +1,7 @@ +declare path="$1" + +cat > "${path}/acme_update.sh" << EOF +#!/bin/bash +${HOME}/.acme.sh/acme.sh --upgrade +${HOME}/.acme.sh/acme.sh --renew-all +EOF \ No newline at end of file diff --git a/Config/Automation/backup.sh b/Config/Automation/backup.sh index cd5274d..51f3b9b 100644 --- a/Config/Automation/backup.sh +++ b/Config/Automation/backup.sh @@ -8,10 +8,6 @@ declare aliyun_pick declare ignore=1 -if [[ -f "${path}/backup.sh" ]];then - echo "该路径文件已经存在" -fi - read -p "请输入数据目录,默认 /var/www :" web_path if [[ -z ${web_path} ]];then web_path='/var/www' diff --git a/Config/Automation/up-docker_compose.sh b/Config/Automation/up-docker_compose.sh index 906fabe..180ffdb 100644 --- a/Config/Automation/up-docker_compose.sh +++ b/Config/Automation/up-docker_compose.sh @@ -5,9 +5,7 @@ if ! command -v docker &> /dev/null; then echo "docker未安装" exit fi -if [[ -f "${path}/up-docker_compose.sh" ]];then - echo "该路径文件已经存在" -fi + declare web_path read -p "请输入数据目录,默认 /var/www :" web_path if [[ -z ${web_path} ]];then diff --git a/Config/Automation/update.sh b/Config/Automation/update.sh index ed864d0..28ed619 100644 --- a/Config/Automation/update.sh +++ b/Config/Automation/update.sh @@ -1,9 +1,5 @@ declare path="$1" -if [[ -f "${path}/update.sh" ]];then - echo "该路径文件已经存在" -fi - echo '#!/bin/bash' > "${path}/update.sh" if [[ -f "/usr/bin/apt" ]];then diff --git a/Config/Other/Language.sh b/Config/Other/Language_set.sh similarity index 100% rename from Config/Other/Language.sh rename to Config/Other/Language_set.sh diff --git a/Config/Other/Reinstall.sh b/Config/Other/Reinstall.sh index 2b5f3a7..148d8e8 100644 --- a/Config/Other/Reinstall.sh +++ b/Config/Other/Reinstall.sh @@ -45,8 +45,8 @@ if [[ $pick =~ [1-"${#imags_dick[@]}"\ ] ]];then elif [[ $pick =~ [1-$version_number] ]];then version=${version_arr[$pick]} fi - echo "bash <(curl -Ls ${server}) ${img} ${version}" fi + eval "bash <(curl -Ls ${server}) ${img} ${version}" else echo "选择错误" fi \ No newline at end of file diff --git a/Config/Other/Acme.sh b/Config/Other/acme_ssl.sh similarity index 100% rename from Config/Other/Acme.sh rename to Config/Other/acme_ssl.sh diff --git a/Config/Other/bbr_open.sh b/Config/Other/bbr_open.sh new file mode 100644 index 0000000..5f51590 --- /dev/null +++ b/Config/Other/bbr_open.sh @@ -0,0 +1,10 @@ +#!/bin/bash +declare version=$(uname -r | awk -F "." '{print $1}') +if ! [[ $version -ge 5 ]];then + echo "系统内核版本过低" + exit +fi +grep -q "net.core.default_qdisc=fq" "/etc/sysctl.conf" || echo 'net.core.default_qdisc=fq' | sudo tee -a "/etc/sysctl.conf" +grep -q "net.ipv4.tcp_congestion_control=bbr" "/etc/sysctl.conf" || echo 'net.ipv4.tcp_congestion_control=bbr' | sudo tee -a "/etc/sysctl.conf" +sudo sysctl -p || echo "bbr 开启失败" +sysctl net.ipv4.tcp_available_congestion_control | grep bbr && echo "bbr 开启成功" \ No newline at end of file diff --git a/Menus/Automation.sh b/Menus/Automation.sh index 7e5b2a4..2893ef3 100644 --- a/Menus/Automation.sh +++ b/Menus/Automation.sh @@ -49,6 +49,10 @@ if [[ "$cron" == '* * * * * ' ]];then exit fi +if [[ -f "${path_script}/Config/Automation/${print_array[pick]}.sh" ]];then + echo "该路径文件已经存在" +fi + bash "${path_script}/Config/Automation/${print_array[pick]}.sh" "$path" chmod +x "${path}/${print_array[pick]}.sh" diff --git a/Menus/Other.sh b/Menus/Other.sh index 77ea8b5..0e68a93 100644 --- a/Menus/Other.sh +++ b/Menus/Other.sh @@ -1,33 +1,18 @@ -declare pick declare path_script=$1 +declare file_name=$(basename $0) echo "========Other========" -echo "1.开启BBR" -echo "2.更换系统语言" -echo "3.申请SSL证书" -echo "4.一键DD/重装脚本" +declare print_number=0 +declare -a print_arr +declare pick +for i in "${path_script}/Config/${file_name}"/* ; do + print_number=$(( print_number+1 )) + print_arr[$print_number]=$(basename $i) + echo "${print_number}.${i}" +done echo "输入其他任意返回主页" echo "========Other========" read -p "请输入:" pick -case "$pick" in - '1') - declare version=$(uname -r | awk -F "." '{print $1}') - if ! [[ $version -ge 5 ]];then - echo "系统内核版本过低" - exit - fi - grep -q "net.core.default_qdisc=fq" "/etc/sysctl.conf" || echo 'net.core.default_qdisc=fq' | sudo tee -a "/etc/sysctl.conf" - grep -q "net.ipv4.tcp_congestion_control=bbr" "/etc/sysctl.conf" || echo 'net.ipv4.tcp_congestion_control=bbr' | sudo tee -a "/etc/sysctl.conf" - sudo sysctl -p || echo "bbr 开启失败" - sysctl net.ipv4.tcp_available_congestion_control | grep bbr && echo "bbr 开启成功" - ;; - '2') - bash "${path_script}/Config/Other/Language.sh" - ;; - '3') - bash "${path_script}/Config/Other/Acme.sh" - ;; - '4') - bash "${path_script}/Config/Other/Reinstall.sh" - ;; -esac \ No newline at end of file +if [[ $pick =~ [1-$print_number] ]]; then + bash "${path_script}/Config/${file_name}/${print_arr[$pick]}.sh" +fi \ No newline at end of file