start-mailserver.sh split (#1820)

* splitting start-mailserver.sh

* refactoring part 2

* refactored setup-stack.sh
* stzarted adjusting target/bin/*.sh to use new usage format

* corrected lowercase-uppercase test error

* better handling of .bashrc variable export

* linting tests and fix for default assignements

* last stylistic changes and rebase
This commit is contained in:
Georg Lauterbach 2021-02-23 20:03:01 +01:00 committed by GitHub
parent 2262d354db
commit c881facbd2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 2214 additions and 2278 deletions

View file

@ -8,12 +8,16 @@ DATABASE=${DATABASE:-/tmp/docker-mailserver/postfix-virtual.cf}
EMAIL="${1}"
RECIPIENT="${2}"
function usage { echo "Usage: delalias <alias@domain> <recipient@other>" ; }
function __usage { echo "Usage: delalias <alias@domain> <recipient@other>" ; }
[[ -z ${EMAIL} ]] && { usage ; errex "Error: No alias specified" ; }
[[ -z ${RECIPIENT} ]] && { usage ; errex "Error: No recipient specified" ; }
[[ ${1:-} == 'help' ]] && { __usage ; exit 0 ; }
[[ -z ${EMAIL} ]] && { __usage ; errex "Error: No alias specified" ; }
[[ -z ${RECIPIENT} ]] && { __usage ; errex "Error: No recipient specified" ; }
[[ -s ${DATABASE} ]] || exit 0
sed -i -e "/^${EMAIL} *${RECIPIENT}$/d" \
sed -i \
-e "/^${EMAIL} *${RECIPIENT}$/d" \
-e "/^${EMAIL}/s/,${RECIPIENT}//g" \
-e "/^${EMAIL}/s/${RECIPIENT},//g" "${DATABASE}"
-e "/^${EMAIL}/s/${RECIPIENT},//g" \
"${DATABASE}"