2024-09-27 14:22:23 +08:00
|
|
|
#!/bin/bash
|
|
|
|
echo "1.查看已经成功申请证书的域名"
|
|
|
|
|
2024-11-18 23:12:52 +08:00
|
|
|
declare user_choice
|
|
|
|
read -p "请输入选择:" user_choice
|
2024-09-27 14:22:23 +08:00
|
|
|
|
2024-11-18 23:12:52 +08:00
|
|
|
case $user_choice in
|
2024-09-27 14:22:23 +08:00
|
|
|
'1')
|
2024-11-18 23:12:52 +08:00
|
|
|
declare certificate_name
|
|
|
|
declare certificate_count=0
|
|
|
|
declare -a certificate_array
|
2024-09-27 14:22:23 +08:00
|
|
|
|
|
|
|
for i in "${HOME}/.acme.sh"/* ; do
|
2024-11-18 23:12:52 +08:00
|
|
|
certificate_name=$(basename $i )
|
|
|
|
if ! echo "$certificate_name" | grep -q "_ecc" ; then
|
2024-09-27 14:22:23 +08:00
|
|
|
continue
|
|
|
|
fi
|
2024-11-18 23:12:52 +08:00
|
|
|
certificate_name=$(echo $certificate_name | sed "s/_ecc//g" )
|
|
|
|
certificate_count=$(( certificate_count+1 ))
|
|
|
|
certificate_array[$certificate_count]=$certificate_name
|
|
|
|
echo "${certificate_count}.${certificate_name}"
|
2024-09-27 14:22:23 +08:00
|
|
|
done
|
2024-11-18 23:12:52 +08:00
|
|
|
if [ ${#certificate_array[@]} == 0 ]; then
|
2024-09-27 14:45:16 +08:00
|
|
|
echo "暂时没有安装证书"
|
|
|
|
exit
|
|
|
|
fi
|
2024-11-18 23:12:52 +08:00
|
|
|
read -p "请输入要查看证书详细信息的序号:" user_choice
|
|
|
|
if [[ $user_choice =~ [1-${#certificate_array[@]}] ]]; then
|
|
|
|
bash "${HOME}/.acme.sh/acme.sh -info -d ${certificate_array[$user_choice]}"
|
2024-09-27 14:22:23 +08:00
|
|
|
else
|
|
|
|
echo "选择错误"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|