Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DDNS的脚本update_aliyun_com.sh有BUG #220

Open
oldxianyu opened this issue Nov 21, 2024 · 0 comments
Open

DDNS的脚本update_aliyun_com.sh有BUG #220

oldxianyu opened this issue Nov 21, 2024 · 0 comments

Comments

@oldxianyu
Copy link

pdate_aliyun_com.sh 里面的一段 脚本的逻辑误将顶级域名 abc.cn 的 RR 设为 abc,导致更新失败成子域名记录 abc.abc.cn
[ "${domain:0:2}" == "@." ] && domain="${domain/./}" # 主域名处理
[ "$domain" == "${domain/@/}" ] && domain="${domain/./@}" # 未找到分隔符,兼容常用域名格式
__HOST="${domain%%@}"
__DOMAIN="${domain#
@}"
[ -z "$__HOST" -o "$__HOST" == "$__DOMAIN" ] && __HOST="@"

更新如下:

if [[ "$domain" != @ ]]; then
# 如果 domain 不包含 @,认为是顶级域名
__HOST="@"
__DOMAIN="$domain"
else
# 如果 domain 包含 @,正常分离主机名和域名
__HOST="${domain%%@}"
__DOMAIN="${domain#
@}"
fi

确保 __HOST 为空时设置为 @

[ -z "$__HOST" ] && __HOST="@"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant