2019-09-27 00:13:30 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
readonly VERBOSE=${VERBOSE:-"0"}
|
|
|
|
readonly QUIET=${QUIET:-"0"}
|
|
|
|
|
|
|
|
error() {
|
|
|
|
>&2 echo "${PROGNAME}: $1"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
debug() {
|
|
|
|
if [ "${VERBOSE}" = "1" ] && [ "${QUIET}" != "1" ]; then
|
|
|
|
>&2 echo "${PROGNAME}: $1"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2019-09-27 09:31:22 +02:00
|
|
|
doveconf_bin=$(command -v doveconf)
|
|
|
|
|
|
|
|
if [ -n "$(pidof dovecot)" ] && [ -n "${doveconf_bin}" ]; then
|
|
|
|
if ${doveconf_bin} | grep -E "^ssl_cert[^_]" | grep -q "letsencrypt"; then
|
|
|
|
if ${doveconf_bin} > /dev/null; then
|
2019-09-27 00:13:30 +02:00
|
|
|
debug "Dovecot detected... reloading"
|
|
|
|
systemctl reload dovecot
|
|
|
|
else
|
2019-09-27 09:31:22 +02:00
|
|
|
error "Dovecot config is broken, you must fix it !"
|
2019-09-27 00:13:30 +02:00
|
|
|
fi
|
|
|
|
else
|
2019-09-27 09:31:22 +02:00
|
|
|
debug "Dovecot doesn't use Let's Encrypt certificate. Skip."
|
2019-09-27 00:13:30 +02:00
|
|
|
fi
|
|
|
|
else
|
2019-09-27 09:31:22 +02:00
|
|
|
debug "Dovecot is not running or missing. Skip."
|
2019-09-27 00:13:30 +02:00
|
|
|
fi
|