mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-08-03 17:44:49 +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
|
@ -1,7 +1,7 @@
|
|||
#! /bin/bash
|
||||
|
||||
# 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/dovecot-quotas.cf}
|
||||
USER_DATABASE=${USER_DATABASE:-/tmp/docker-mailserver/postfix-accounts.cf}
|
||||
|
@ -12,13 +12,13 @@ function __usage { echo "Usage: delquota <username@domain>" ; }
|
|||
|
||||
USER="${1}"
|
||||
|
||||
[[ -z ${USER} ]] && { __usage ; errex "No username specified" ; }
|
||||
[[ ${USER} =~ .*\@.* ]] || { __usage ; errex "Username must include the domain"; }
|
||||
[[ -z ${USER} ]] && { __usage ; _errex "No username specified" ; }
|
||||
[[ ${USER} =~ .*\@.* ]] || { __usage ; _errex "Username must include the domain"; }
|
||||
|
||||
if ! grep -qE "^${USER}\|" "${USER_DATABASE}"
|
||||
then
|
||||
__usage
|
||||
errex "user ${USER} does not exist"
|
||||
_errex "user ${USER} does not exist"
|
||||
fi
|
||||
|
||||
[[ -s ${DATABASE} ]] || exit 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue