refactoring: split helper functions into smaller scripts (#2420)

This commit is contained in:
Georg Lauterbach 2022-02-21 11:56:57 +01:00 committed by GitHub
parent 2927cc47c7
commit b61dfe1e24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 389 additions and 396 deletions

View file

@ -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/postfix-sasl-password.cf}
@ -13,14 +13,14 @@ DOMAIN="${1}"
USER="${2}"
PASSWD="${3}"
[[ -z ${DOMAIN} ]] && { __usage ; errex 'No domain specified' ; }
[[ -z ${USER} ]] && { __usage ; errex 'No username specified' ; }
[[ -z ${DOMAIN} ]] && { __usage ; _errex 'No domain specified' ; }
[[ -z ${USER} ]] && { __usage ; _errex 'No username specified' ; }
if [[ -z ${PASSWD} ]]
then
read -r -s -p "Enter Password: " PASSWD
echo
[[ -z ${PASSWD} ]] && errex 'Password must not be empty'
[[ -z ${PASSWD} ]] && _errex 'Password must not be empty'
fi
if grep -qi "^@${DOMAIN}" "${DATABASE}" 2>/dev/null