Small bugfix with dehydrated lock files (#677)

* Small bugfix with dehydrated lock files

* Fix if

* Small cleanup
This commit is contained in:
Pascal Vizeli
2019-08-30 10:25:38 +02:00
committed by GitHub
parent 57c91feeb9
commit bac3f65023
3 changed files with 21 additions and 13 deletions

View File

@@ -1,5 +1,9 @@
# Changelog # Changelog
## 1.10
- Fix issue with dehydrated lock file
## 1.9 ## 1.9
- Fix issue with empty IPv4 / IPv6 - Fix issue with empty IPv4 / IPv6

View File

@@ -1,6 +1,6 @@
{ {
"name": "Duck DNS", "name": "Duck DNS",
"version": "1.9", "version": "1.10",
"slug": "duckdns", "slug": "duckdns",
"description": "Free Dynamic DNS (DynDNS or DDNS) service with Let's Encrypt support", "description": "Free Dynamic DNS (DynDNS or DDNS) service with Let's Encrypt support",
"url": "https://www.home-assistant.io/addons/duckdns/", "url": "https://www.home-assistant.io/addons/duckdns/",

View File

@@ -21,35 +21,39 @@ function le_renew() {
domains=$(bashio::config 'domains') domains=$(bashio::config 'domains')
# Prepare domain for Let's Encrypt # Prepare domain for Let's Encrypt
for domain in $domains; do for domain in ${domains}; do
domain_args+=("--domain" "$domain") domain_args+=("--domain" "${domain}")
done done
dehydrated --cron --hook ./hooks.sh --challenge dns-01 "${domain_args[@]}" --out "$CERT_DIR" --config "$WORK_DIR/config" || true dehydrated --cron --hook ./hooks.sh --challenge dns-01 "${domain_args[@]}" --out "${CERT_DIR}" --config "${WORK_DIR}/config" || true
LE_UPDATE="$(date +%s)" LE_UPDATE="$(date +%s)"
} }
# Register/generate certificate if terms accepted # Register/generate certificate if terms accepted
if bashio::config.true 'lets_encrypt.accept_terms'; then if bashio::config.true 'lets_encrypt.accept_terms'; then
# Init folder structs # Init folder structs
mkdir -p "$CERT_DIR" mkdir -p "${CERT_DIR}"
mkdir -p "$WORK_DIR" mkdir -p "${WORK_DIR}"
# Generate new certs # Generate new certs
if [ ! -d "$CERT_DIR/live" ]; then if [ ! -d "${CERT_DIR}/live" ]; then
# Create empty dehydrated config file so that this dir will be used for storage # Create empty dehydrated config file so that this dir will be used for storage
touch "$WORK_DIR/config" touch "${WORK_DIR}/config"
dehydrated --register --accept-terms --config "$WORK_DIR/config" dehydrated --register --accept-terms --config "${WORK_DIR}/config"
elif [ -e "${WORK_DIR}/lock" ]; then
# Some user reports issue with lock files/cleanup
rm -rf "${WORK_DIR}/lock"
bashio::log.warning "Reset dehydrated lock file"
fi fi
fi fi
# Run duckdns # Run duckdns
while true; do while true; do
if answer="$(curl -sk "https://www.duckdns.org/update?domains=$DOMAINS&token=$TOKEN&ip=$IPV4&ipv6=$IPV6&verbose=true")"; then if answer="$(curl -sk "https://www.duckdns.org/update?domains=${DOMAINS}&token=${TOKEN}&ip=${IPV4}&ipv6=${IPV6}&verbose=true")"; then
bashio::log.info "$answer" bashio::log.info "${answer}"
else else
bashio::log.warning "$answer" bashio::log.warning "${answer}"
fi fi
now="$(date +%s)" now="$(date +%s)"
@@ -57,5 +61,5 @@ while true; do
le_renew le_renew
fi fi
sleep "$WAIT_TIME" sleep "${WAIT_TIME}"
done done