mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-08-03 09:34:33 +02:00
scripts: restructure container restart behavior (#4323)
Signed-off-by: georglauterbach <44545919+georglauterbach@users.noreply.github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
parent
85793988d6
commit
59a379aed7
6 changed files with 202 additions and 179 deletions
|
@ -38,7 +38,6 @@ function _register_functions() {
|
|||
# ? >> Checks
|
||||
|
||||
_register_check_function '_check_hostname'
|
||||
_register_check_function '_check_log_level'
|
||||
_register_check_function '_check_spam_prefix'
|
||||
|
||||
# ? >> Setup
|
||||
|
@ -63,7 +62,6 @@ function _register_functions() {
|
|||
;;
|
||||
|
||||
( 'LDAP' )
|
||||
_environment_variables_ldap
|
||||
_register_setup_function '_setup_ldap'
|
||||
;;
|
||||
|
||||
|
@ -76,15 +74,8 @@ function _register_functions() {
|
|||
;;
|
||||
esac
|
||||
|
||||
if [[ ${ENABLE_OAUTH2} -eq 1 ]]; then
|
||||
_environment_variables_oauth2
|
||||
_register_setup_function '_setup_oauth2'
|
||||
fi
|
||||
|
||||
if [[ ${ENABLE_SASLAUTHD} -eq 1 ]]; then
|
||||
_environment_variables_saslauthd
|
||||
_register_setup_function '_setup_saslauthd'
|
||||
fi
|
||||
[[ ${ENABLE_OAUTH2} -eq 1 ]] && _register_setup_function '_setup_oauth2'
|
||||
[[ ${ENABLE_SASLAUTHD} -eq 1 ]] && _register_setup_function '_setup_saslauthd'
|
||||
|
||||
_register_setup_function '_setup_dovecot_inet_protocols'
|
||||
|
||||
|
@ -122,20 +113,23 @@ function _register_functions() {
|
|||
_register_setup_function '_setup_logwatch'
|
||||
|
||||
_register_setup_function '_setup_save_states'
|
||||
_register_setup_function '_setup_apply_fixes_after_configuration'
|
||||
_register_setup_function '_environment_variables_export'
|
||||
_register_setup_function '_setup_adjust_state_permissions'
|
||||
|
||||
if [[ ${ENABLE_MTA_STS} -eq 1 ]]; then
|
||||
_register_setup_function '_setup_mta_sts'
|
||||
_register_start_daemon '_start_daemon_mta_sts_daemon'
|
||||
fi
|
||||
|
||||
# ! The following functions must be executed after all other setup functions
|
||||
_register_setup_function '_setup_directory_and_file_permissions'
|
||||
_register_setup_function '_setup_run_user_patches'
|
||||
|
||||
# ? >> Daemons
|
||||
|
||||
_register_start_daemon '_start_daemon_cron'
|
||||
_register_start_daemon '_start_daemon_rsyslog'
|
||||
|
||||
[[ ${SMTP_ONLY} -ne 1 ]] && _register_start_daemon '_start_daemon_dovecot'
|
||||
[[ ${SMTP_ONLY} -ne 1 ]] && _register_start_daemon '_start_daemon_dovecot'
|
||||
|
||||
if [[ ${ENABLE_UPDATE_CHECK} -eq 1 ]]; then
|
||||
if [[ ${DMS_RELEASE} != 'edge' ]]; then
|
||||
|
@ -174,26 +168,24 @@ function _register_functions() {
|
|||
# ? >> Executing all stacks / actual start of DMS
|
||||
# ------------------------------------------------------------
|
||||
|
||||
_early_supervisor_setup
|
||||
_early_variables_setup
|
||||
|
||||
_log 'info' "Welcome to docker-mailserver ${DMS_RELEASE}"
|
||||
|
||||
_register_functions
|
||||
_check
|
||||
|
||||
# Ensure DMS only adjusts config files for a new container.
|
||||
# Container restarts should skip as they retain the modified config.
|
||||
if [[ ! -f /CONTAINER_START ]]; then
|
||||
_early_supervisor_setup
|
||||
_early_variables_setup
|
||||
|
||||
_log 'info' "Welcome to docker-mailserver ${DMS_RELEASE}"
|
||||
|
||||
_register_functions
|
||||
_check
|
||||
_setup
|
||||
_run_user_patches
|
||||
if [[ -f /CONTAINER_START ]]; then
|
||||
_log 'info' 'Container was restarted. Skipping most setup routines.'
|
||||
# We cannot skip all setup routines because some need to run _after_
|
||||
# the initial setup (and hence, they cannot be moved to the check stack).
|
||||
_setup_directory_and_file_permissions
|
||||
_setup_adjust_state_permissions
|
||||
else
|
||||
# container was restarted
|
||||
_early_variables_setup
|
||||
|
||||
_log 'info' 'Container was restarted. Skipping setup routines.'
|
||||
_log 'info' "Welcome to docker-mailserver ${DMS_RELEASE}"
|
||||
|
||||
_register_functions
|
||||
_setup
|
||||
fi
|
||||
|
||||
# marker to check if container was restarted
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue