mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-08-03 09:34:33 +02:00
refactoring: split helper functions into smaller scripts (#2420)
This commit is contained in:
parent
2927cc47c7
commit
b61dfe1e24
41 changed files with 389 additions and 396 deletions
|
@ -5,8 +5,8 @@
|
|||
# ? the same file in the same pipeline", which is a result of ${DATABASE}
|
||||
# ? being used below. (This disables the message file-wide.)
|
||||
|
||||
# shellcheck source=../scripts/helper-functions.sh
|
||||
. /usr/local/bin/helper-functions.sh
|
||||
# shellcheck source=../scripts/helpers/index.sh
|
||||
source /usr/local/bin/helpers/index.sh
|
||||
|
||||
DATABASE=${DATABASE:-/tmp/docker-mailserver/postfix-accounts.cf}
|
||||
ALIAS_DATABASE="/tmp/docker-mailserver/postfix-virtual.cf"
|
||||
|
@ -67,14 +67,14 @@ do
|
|||
|
||||
* )
|
||||
__usage
|
||||
errex "The option ${OPT} is unknown."
|
||||
_errex "The option ${OPT} is unknown."
|
||||
;;
|
||||
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
[[ -z ${*} ]] && { __usage ; errex "No user specifed" ; }
|
||||
[[ -z ${*} ]] && { __usage ; _errex "No user specifed" ; }
|
||||
[[ -s ${DATABASE} ]] || exit 0
|
||||
|
||||
if ! ${MAILDEL}
|
||||
|
@ -86,7 +86,7 @@ then
|
|||
fi
|
||||
fi
|
||||
|
||||
create_lock # Protect config file with lock to avoid race conditions
|
||||
_create_lock # Protect config file with lock to avoid race conditions
|
||||
|
||||
for EMAIL in "${@}"
|
||||
do
|
||||
|
@ -97,7 +97,7 @@ do
|
|||
|
||||
# ${EMAIL} must not contain /s and other syntactic characters
|
||||
UNESCAPED_EMAIL="${EMAIL}"
|
||||
EMAIL=$(escape "${EMAIL}")
|
||||
EMAIL=$(_escape "${EMAIL}")
|
||||
|
||||
if [[ -f ${DATABASE} ]]
|
||||
then
|
||||
|
@ -155,6 +155,6 @@ use 'sudo docker exec mailserver rm -R /var/mail/${DOMAIN}/${USER}'"
|
|||
ERROR=true
|
||||
fi
|
||||
|
||||
${ERROR} && errex 'See the messages above.'
|
||||
${ERROR} && _errex 'See the messages above.'
|
||||
done
|
||||
exit 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue