scripts: more consistency in start-mailserver.sh (#2587)

* consistently name functions (starting with `_`) in `start-mailserver.sh`

Most of the functions that execute the different stacks during startup
were not prefixed with `_`, but all our other functions are. This has
now been fixed.

* cleanup in `start-mailserver.sh`

I adjusted the comments for all sections in the start script so they are
properly displayed again.
This commit is contained in:
Georg Lauterbach 2022-05-15 23:37:21 +02:00 committed by GitHub
parent 777d4a8cb7
commit b7e5d42e09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 20 deletions

View file

@ -1,5 +1,6 @@
#! /bin/bash
# ------------------------------------------------------------
# ? >> Sourcing helpers & stacks
# 1. Helpers
# 2. Checks
@ -27,24 +28,28 @@ source /usr/local/bin/misc-stack.sh
# shellcheck source=./startup/daemons-stack.sh
source /usr/local/bin/daemons-stack.sh
# ------------------------------------------------------------
# ? << Sourcing helpers & stacks
# --
# ? >> Setup Supervisor & DNS names
# ------------------------------------------------------------
# Setup supervisord as early as possible
declare -A VARS
VARS[SUPERVISOR_LOGLEVEL]="${SUPERVISOR_LOGLEVEL:=warn}"
_setup_supervisor
# shellcheck disable=SC2034
declare -a FUNCS_SETUP FUNCS_FIX FUNCS_CHECK FUNCS_MISC DAEMONS_START
_obtain_hostname_and_domainname
# ------------------------------------------------------------
# ? <<
# ? << Setup Supervisor & DNS names
# --
# ? >> Setup of default and global values / variables
# ------------------------------------------------------------
# shellcheck disable=SC2034
declare -a FUNCS_SETUP FUNCS_FIX FUNCS_CHECK FUNCS_MISC DAEMONS_START
# These variables must be defined first; They are used as default values for other variables.
VARS[POSTMASTER_ADDRESS]="${POSTMASTER_ADDRESS:=postmaster@${DOMAINNAME}}"
VARS[REPORT_RECIPIENT]="${REPORT_RECIPIENT:=${POSTMASTER_ADDRESS}}"
@ -117,7 +122,7 @@ VARS[VIRUSMAILS_DELETE_DELAY]="${VIRUSMAILS_DELETE_DELAY:=7}"
# ? >> Registering functions
# ------------------------------------------------------------
function register_functions
function _register_functions
{
_log 'info' 'Initializing setup'
_log 'debug' 'Registering functions'
@ -268,24 +273,21 @@ function _register_misc_function
# ------------------------------------------------------------
# ? << Registering functions
# ------------------------------------------------------------
# ? << Sourcing all stacks
# --
# ? >> Executing all stacks
# ? >> Executing all stacks / actual start of DMS
# ------------------------------------------------------------
_log 'info' "Welcome to docker-mailserver $(</VERSION)"
register_functions
check
setup
_register_functions
_check
_setup
[[ ${LOG_LEVEL} =~ (debug|trace) ]] && print-environment
fix
start_misc
_apply_fixes
_start_misc
_start_daemons
# marker to check, if container was restarted
# marker to check if container was restarted
date >/CONTAINER_START
_log 'info' "${HOSTNAME} is up and running"

View file

@ -1,6 +1,6 @@
#! /bin/bash
function check
function _check
{
_log 'info' 'Checking configuration'
for FUNC in "${FUNCS_CHECK[@]}"

View file

@ -1,6 +1,6 @@
#! /bin/bash
function fix
function _apply_fixes
{
_log 'info' 'Post-configuration checks'
for FUNC in "${FUNCS_FIX[@]}"

View file

@ -1,6 +1,6 @@
#! /bin/bash
function start_misc
function _start_misc
{
_log 'info' 'Starting miscellaneous tasks'
for FUNC in "${FUNCS_MISC[@]}"

View file

@ -1,6 +1,6 @@
#! /bin/bash
function setup
function _setup
{
_log 'info' 'Configuring mail server'
for FUNC in "${FUNCS_SETUP[@]}"