mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-07-16 12:24:50 +02:00
improvement: get rid of subshell + exec
in helper-functions.sh
(#2401)
* get rid of subshell + exec The new way of executing `sha512sum` should work as well as the old way but without the clutter and possible problems the usage of subshells + exec incurs. Moreover, there was a misconception about array expansion. Using `""` around an expanding array (`${ARRAY[@]}`) is quite fine (and actually the preffered way), not because it makes the expansion _one_ string (this would be `${ARRAY[*]}`), but it makes sure when elements are expanded, each element has `""` around them so to speak, i.e. there is no re-splitting of these elements. * removed old concerns in comments * increase test and check for changes sleep duration
This commit is contained in:
parent
7b21db77cc
commit
ede2b2394a
3 changed files with 19 additions and 24 deletions
|
@ -50,6 +50,7 @@ do
|
|||
# get chksum and check it, no need to lock config yet
|
||||
_monitored_files_checksums >"${CHKSUM_FILE}.new"
|
||||
cmp --silent -- "${CHKSUM_FILE}" "${CHKSUM_FILE}.new"
|
||||
|
||||
# cmp return codes
|
||||
# 0 – files are identical
|
||||
# 1 – files differ
|
||||
|
@ -60,13 +61,7 @@ do
|
|||
create_lock # Shared config safety lock
|
||||
CHANGED=$(grep -Fxvf "${CHKSUM_FILE}" "${CHKSUM_FILE}.new" | sed 's/^[^ ]\+ //')
|
||||
|
||||
# Bug alert! This overwrites the alias set by start-mailserver.sh
|
||||
# Take care that changes in one script are propagated to the other
|
||||
|
||||
# ! NEEDS FIX -----------------------------------------
|
||||
# TODO FIX --------------------------------------------
|
||||
# ! NEEDS EXTENSIONS ----------------------------------
|
||||
# TODO Perform updates below conditionally too --------
|
||||
# TODO Perform updates below conditionally too
|
||||
# Also note that changes are performed in place and are not atomic
|
||||
# We should fix that and write to temporary files, stop, swap and start
|
||||
|
||||
|
@ -137,7 +132,7 @@ do
|
|||
# mark changes as applied
|
||||
mv "${CHKSUM_FILE}.new" "${CHKSUM_FILE}"
|
||||
|
||||
sleep 1
|
||||
sleep 2
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue