mirror of
https://github.com/tomav/docker-mailserver
synced 2025-08-31 22:35:40 +00:00
Fix checksum race condition in check-for-changes.sh
If a change to one of the tracked files happened soon after (<1 second?) a previously detected change, it could end up going undetected. In particular, this could cause integration tests to fail (see next commits). Fixed by computing the new checksum file _before_ checking for changes.
This commit is contained in:
@@ -73,3 +73,23 @@ for key, value in acme.items():
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# File storing the checksums of the monitored files.
|
||||
CHKSUM_FILE=/tmp/docker-mailserver-config-chksum
|
||||
|
||||
# Compute checksums of monitored files.
|
||||
function monitored_files_checksums() {
|
||||
(
|
||||
cd /tmp/docker-mailserver
|
||||
# (2>/dev/null to ignore warnings about files that don't exist)
|
||||
exec sha512sum 2>/dev/null -- \
|
||||
postfix-accounts.cf \
|
||||
postfix-virtual.cf \
|
||||
postfix-aliases.cf \
|
||||
dovecot-quotas.cf \
|
||||
/etc/letsencrypt/acme.json \
|
||||
"/etc/letsencrypt/live/$HOSTNAME/key.pem" \
|
||||
"/etc/letsencrypt/live/$HOSTNAME/fullchain.pem"
|
||||
)
|
||||
return 0
|
||||
}
|
||||
|
Reference in New Issue
Block a user