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