fix: `relay.sh` - `grep` regex compatibility with `+` requires `-E`

This commit is contained in:
Brennan Kinney 2024-01-30 11:31:33 +13:00 committed by GitHub
parent 7aaa515ed9
commit 7b073c4d6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -166,7 +166,8 @@ function _legacy_support() {
local MATCH_EXISTING_ENTRY="^@${SENDER_DOMAIN}\s+"
local MATCH_OPT_OUT_LINE="^\s*@${SENDER_DOMAIN}\s*$"
if ! grep -q -e "${MATCH_EXISTING_ENTRY}" /etc/postfix/relayhost_map && ! grep -qs -e "${MATCH_OPT_OUT_LINE}" "${DATABASE_RELAYHOSTS}"; then
# NOTE: `-E` is required for `\s+` syntax to avoid escaping `+`
if ! grep -q -E "${MATCH_EXISTING_ENTRY}" /etc/postfix/relayhost_map && ! grep -qs "${MATCH_OPT_OUT_LINE}" "${DATABASE_RELAYHOSTS}"; then
_log 'trace' "Configuring '${SENDER_DOMAIN}' for the default relayhost '${RELAY_HOST}'"
echo "@${SENDER_DOMAIN} $(_env_relay_host)" >> /etc/postfix/relayhost_map
fi