From ecd2ef80fd58f614913983f32825766afa7a79b7 Mon Sep 17 00:00:00 2001 From: lsy Date: Mon, 23 Sep 2024 01:23:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dacme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Config/Other/Acme.sh | 48 +++++++++++++++++++++++--------------------- Menus/Other.sh | 1 + 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/Config/Other/Acme.sh b/Config/Other/Acme.sh index 32d5ff5..e8bc608 100644 --- a/Config/Other/Acme.sh +++ b/Config/Other/Acme.sh @@ -1,25 +1,30 @@ #!/bin/bash -declare mail -declare domain -declare domain_str='' -read -p "请输入用来申请域名的邮箱:" mail -if [[ $mail =~ "\w+@\w+\.[a-z]+" ]];then - echo "邮箱不合法" - exit - fi +if [[ ! -d "${HOME}/.acme.sh" ]];then + declare mail + declare domain + read -p "请输入用来申请域名的邮箱:" mail + if [[ $mail =~ "\w+@\w+\.[a-z]+" ]];then + echo "邮箱不合法" + exit + fi -echo "请输入需要申请SSL证书的域名" -while(1);do - read -p "不输入退出添加:" domain - if [[ -z $domain ]];then - break - elif [[ $domain =~ "\w+\.[a-z]+" ]];then - echo "域名不合法" - exit - domain_str="$domain_str -d $domain" - fi -done + echo "请输入需要申请SSL证书的域名" + while(1);do + read -p "不输入退出添加:" domain + if [[ -z $domain ]];then + break + elif [[ $domain =~ "\w+\.[a-z]+" ]];then + echo "域名不合法" + exit + domain_str="$domain_str -d $domain" + fi + done + + curl https://get.acme.sh | sh -s "email=$mail" +fi + +declare domain_str='' if [[ -z $domain_str ]]; then echo "需要添加的域名不能为空" exit @@ -30,10 +35,6 @@ read "1.http验证" read "2.dns验证" read -p "请选择验证模式" pick_mode -if [[ ! -d "${HOME}/.acme.sh" ]];then - curl https://get.acme.sh | sh -s "email=$mail" -fi - case $pick_mode in '1') declare pick_start @@ -60,6 +61,7 @@ case $pick_mode in case ${mode_arr[$pick_mode]} in 'TXT记录') + declare domain declare $log_output=$(acme.sh --issue --dns $domain_str --yes-I-know-dns-manual-mode-enough-go-ahead-please) declare domain=$( echo "$log_output" | grep "Domain:" | awk -F ": " '{print $2}') declare txt_value=$(echo "$log_output" | grep "TXT value:" | awk -F ": " '{print $2}') diff --git a/Menus/Other.sh b/Menus/Other.sh index df53f7d..70c4454 100644 --- a/Menus/Other.sh +++ b/Menus/Other.sh @@ -1,4 +1,5 @@ declare pick +declare path_script=$1 echo "========Other========" echo "1.开启BBR" echo "2.更换系统语言"