You've already forked mailserver
mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-07-31 12:24:24 +03:00
Change 'while' style (#3365)
This commit is contained in:
@ -38,8 +38,7 @@ function _create_accounts() {
|
||||
# creating users ; 'pass' is encrypted
|
||||
# comments and empty lines are ignored
|
||||
local LOGIN PASS USER_ATTRIBUTES
|
||||
while IFS=$'|' read -r LOGIN PASS USER_ATTRIBUTES
|
||||
do
|
||||
while IFS=$'|' read -r LOGIN PASS USER_ATTRIBUTES; do
|
||||
# Setting variables for better readability
|
||||
USER=$(echo "${LOGIN}" | cut -d @ -f1)
|
||||
DOMAIN=$(echo "${LOGIN}" | cut -d @ -f2)
|
||||
@ -104,8 +103,7 @@ function _create_dovecot_alias_dummy_accounts() {
|
||||
# adding aliases to Dovecot's userdb
|
||||
# ${REAL_FQUN} is a user's fully-qualified username
|
||||
local ALIAS REAL_FQUN DOVECOT_USERDB_LINE
|
||||
while read -r ALIAS REAL_FQUN
|
||||
do
|
||||
while read -r ALIAS REAL_FQUN; do
|
||||
# alias is assumed to not be a proper e-mail
|
||||
# these aliases do not need to be added to Dovecot's userdb
|
||||
[[ ! ${ALIAS} == *@* ]] && continue
|
||||
@ -177,8 +175,7 @@ function _create_masters() {
|
||||
# creating users ; 'pass' is encrypted
|
||||
# comments and empty lines are ignored
|
||||
local LOGIN PASS
|
||||
while IFS=$'|' read -r LOGIN PASS
|
||||
do
|
||||
while IFS=$'|' read -r LOGIN PASS; do
|
||||
_log 'debug' "Creating master user '${LOGIN}'"
|
||||
|
||||
local DOVECOT_MASTERDB_LINE
|
||||
|
@ -9,8 +9,7 @@ LOCK_ID=$(uuid)
|
||||
|
||||
function _create_lock() {
|
||||
LOCK_FILE="/tmp/docker-mailserver/${SCRIPT_NAME}.lock"
|
||||
while [[ -e "${LOCK_FILE}" ]]
|
||||
do
|
||||
while [[ -e "${LOCK_FILE}" ]]; do
|
||||
# Handle stale lock files left behind on crashes
|
||||
# or premature/non-graceful exits of containers while they're making changes
|
||||
if [[ -n "$(find "${LOCK_FILE}" -mmin +1 2>/dev/null)" ]]; then
|
||||
|
@ -45,8 +45,7 @@ function _vhost_collect_postfix_domains() {
|
||||
|
||||
# getting domains FROM mail accounts
|
||||
if [[ -f ${DATABASE_ACCOUNTS} ]]; then
|
||||
while IFS=$'|' read -r LOGIN _
|
||||
do
|
||||
while IFS=$'|' read -r LOGIN _; do
|
||||
DOMAIN=$(echo "${LOGIN}" | cut -d @ -f2)
|
||||
echo "${DOMAIN}" >>"${TMP_VHOST}"
|
||||
done < <(_get_valid_lines_from_file "${DATABASE_ACCOUNTS}")
|
||||
@ -54,8 +53,7 @@ function _vhost_collect_postfix_domains() {
|
||||
|
||||
# getting domains FROM mail aliases
|
||||
if [[ -f ${DATABASE_VIRTUAL} ]]; then
|
||||
while read -r FROM _
|
||||
do
|
||||
while read -r FROM _; do
|
||||
UNAME=$(echo "${FROM}" | cut -d @ -f1)
|
||||
DOMAIN=$(echo "${FROM}" | cut -d @ -f2)
|
||||
|
||||
|
@ -149,8 +149,7 @@ function _populate_relayhost_map() {
|
||||
{
|
||||
_list_domain_parts "${PRINT_DOMAIN_PART_ACCOUNTS}" /tmp/docker-mailserver/postfix-accounts.cf
|
||||
_list_domain_parts "${PRINT_DOMAIN_PART_VIRTUAL}" /tmp/docker-mailserver/postfix-virtual.cf
|
||||
} | sort -u | while read -r DOMAIN_PART
|
||||
do
|
||||
} | sort -u | while read -r DOMAIN_PART; do
|
||||
# DOMAIN_PART not already present in `/etc/postfix/relayhost_map`, and not listed as a relay opt-out domain in `postfix-relaymap.cf`
|
||||
# `^@${DOMAIN_PART}\b` - To check for existing entry, the `\b` avoids accidental partial matches on similar domain parts.
|
||||
# `^\s*@${DOMAIN_PART}\s*$` - Matches line with only a domain part (eg: @example.test) to avoid including a mapping for those domains to the RELAY_HOST.
|
||||
|
@ -97,8 +97,7 @@ function _replace_by_env_in_file() {
|
||||
local ENV_PREFIX=${1} CONFIG_FILE=${2}
|
||||
local ESCAPED_VALUE ESCAPED_KEY
|
||||
|
||||
while IFS='=' read -r KEY VALUE
|
||||
do
|
||||
while IFS='=' read -r KEY VALUE; do
|
||||
KEY=${KEY#"${ENV_PREFIX}"} # strip prefix
|
||||
ESCAPED_KEY=$(sed -E 's#([\=\&\|\$\.\*\/\[\\^]|\])#\\\1#g' <<< "${KEY,,}")
|
||||
ESCAPED_VALUE=$(sed -E 's#([\=\&\|\$\.\*\/\[\\^]|\])#\\\1#g' <<< "${VALUE}")
|
||||
|
Reference in New Issue
Block a user