2020-10-29 16:38:49 +01:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
2020-10-30 11:58:53 +01:00
|
|
|
echo "certbot txt record: $CERTBOT_VALIDATION"
|
2020-10-29 16:38:49 +01:00
|
|
|
|
|
|
|
baseurl='https://www.duckdns.org/update?domains=%s&token=%s&txt=%s'
|
2024-01-16 18:12:37 +01:00
|
|
|
result="$(printf "url=$baseurl\n" "$DUCKDNS_DOMAIN" "$DUCKDNS_TOKEN" "$CERTBOT_VALIDATION" | curl -K -)"
|
2020-10-29 23:30:49 +01:00
|
|
|
|
2020-10-29 16:38:49 +01:00
|
|
|
# give some time for the record to update
|
2020-10-30 11:58:53 +01:00
|
|
|
echo "waiting for txt record"
|
2024-01-16 18:08:21 +01:00
|
|
|
for _i in $(seq 0 60); do
|
2020-10-29 23:58:52 +01:00
|
|
|
val="$(nslookup -type=TXT "$DUCKDNS_DOMAIN.duckdns.org" | grep "$DUCKDNS_DOMAIN.duckdns.org.*text.*=.*" | sed -n 's/.*"\([^"]*\)".*/\1/p')"
|
2020-10-30 11:58:53 +01:00
|
|
|
echo "current txt record: $val"
|
2020-10-29 23:30:49 +01:00
|
|
|
test "$val" = "$CERTBOT_VALIDATION" && break
|
|
|
|
sleep 10
|
|
|
|
done
|
2024-01-16 18:08:21 +01:00
|
|
|
sleep "${DUCKDNS_PROPAGATION_DELAY:-0}"
|
2020-10-30 11:58:53 +01:00
|
|
|
|
2020-10-29 16:38:49 +01:00
|
|
|
test "$result" = 'OK'
|