duckdns: clean up lock file at start also if no live cert exists (#1422)

Closes https://github.com/home-assistant/hassio-addons/issues/1337
This commit is contained in:
Ville Skyttä
2020-06-25 12:30:55 +03:00
committed by GitHub
parent b87ad0db57
commit c1f31375c4
3 changed files with 13 additions and 7 deletions

View File

@@ -1,5 +1,9 @@
# Changelog
## 1.12.1
- Clean up dehydrated lock file at start also if no live cert exists
## 1.12.0
- Add option to specify a service or URL as IPv4 and IPv6 address source

View File

@@ -1,6 +1,6 @@
{
"name": "Duck DNS",
"version": "1.12.0",
"version": "1.12.1",
"slug": "duckdns",
"description": "Free Dynamic DNS (DynDNS or DDNS) service with Let's Encrypt support",
"url": "https://github.com/home-assistant/hassio-addons/tree/master/duckdns",

View File

@@ -34,17 +34,19 @@ if bashio::config.true 'lets_encrypt.accept_terms'; then
# Init folder structs
mkdir -p "${CERT_DIR}"
mkdir -p "${WORK_DIR}"
# Clean up possible stale lock file
if [ -e "${WORK_DIR}/lock" ]; then
rm -f "${WORK_DIR}/lock"
bashio::log.warning "Reset dehydrated lock file"
fi
# Generate new certs
if [ ! -d "${CERT_DIR}/live" ]; then
# Create empty dehydrated config file so that this dir will be used for storage
touch "${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