fix: tap
All checks were successful
ci/woodpecker/push/woodpecker/1 Pipeline was successful
ci/woodpecker/push/woodpecker/2 Pipeline was successful

This commit is contained in:
f 2024-06-14 18:47:42 -03:00
parent 919706b80e
commit ffed22b2df
No known key found for this signature in database

View file

@ -1,7 +1,15 @@
#!/bin/sh
ok() {
echo "ok - $@" >&2
}
not_ok() {
echo "not ok - $@" >&2
}
if test -z "${NODES}" && test -z "${SINGLE_NODE}"; then
echo "not ok - The env var NODES is empty, if you don't want to synchronize to other servers, set SINGLE_NODE=true" >&2
not_ok "The env var NODES is empty, if you don't want to synchronize to other servers, set SINGLE_NODE=true"
exit 1
fi
@ -9,7 +17,7 @@ lock=/tmp/certbot.lck
updated=/tmp/certbot.updated
ensure() {
test -n "$1" && echo "ok - $1 received, exiting gracefully..." >&2
test -n "$1" && ok "$1 received, exiting gracefully..."
if test -f "${updated}" ; then
rm -f "${updated}"
@ -68,8 +76,8 @@ case $1 in
*)
# Only one instance can run at a time
if test -f "${lock}" ; then
echo "not ok - There's a certbotd instance already running, doing nothing..." >&2
echo "not ok - If the problem persists, you may need to remove ${lock} manually." >&2
not_ok "There's a certbotd instance already running, doing nothing..."
not_ok "If the problem persists, you may need to remove ${lock} manually."
exit 1
fi
@ -90,21 +98,21 @@ case $1 in
| jq --raw-output .[] \
| while read domain; do
if test -z "${domain}"; then
echo "not ok - domain is empty" >&2
not_ok "domain is empty"
continue
fi
# Skip already existing domains
if test -s "/etc/letsencrypt/renewal/${domain}.conf"; then
echo "ok - ${domain} already issued" >&2
ok "${domain} already issued"
continue
else
echo "ok - ${domain} renewal conf was empty, fixing..." >&2
ok "${domain} renewal conf was empty, fixing..."
other_renewal="$(grep -l -m 1 "^authenticator = webroot$" /etc/letsencrypt/renewal/*.conf | head -1)"
if test -z "${other_renewal}"; then
echo "not ok - ${domain} couldn't fix" >&2
not_ok "${domain} couldn't fix"
ensure 1
fi
@ -114,7 +122,7 @@ case $1 in
# Ignore non local domains
if ! nslookup "${domain}" 8.8.8.8 | grep -qE "(${SUTTY_ADDRESSES// /|})" ; then
echo "ok - ${domain} is not configured to any Sutty node or DNS records are still cached, ignoring for now # skip" >&2
ok "${domain} is not configured to any Sutty node or DNS records are still cached, ignoring for now # skip"
continue
fi