From 7b073c4d6fdd07862d2bfb4fbb7e397e2e171328 Mon Sep 17 00:00:00 2001 From: Brennan Kinney <5098581+polarathene@users.noreply.github.com> Date: Tue, 30 Jan 2024 11:31:33 +1300 Subject: [PATCH] fix: `relay.sh` - `grep` regex compatibility with `+` requires `-E` --- target/scripts/helpers/relay.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/scripts/helpers/relay.sh b/target/scripts/helpers/relay.sh index 845f2b6f..b92da3b4 100644 --- a/target/scripts/helpers/relay.sh +++ b/target/scripts/helpers/relay.sh @@ -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