Gentoo Archives: gentoo-dev

From: Rolf Eike Beer <eike@×××××××.de>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] [PATCH 2/2] qmail.eclass: remove usage of egrep
Date: Mon, 16 May 2022 14:49:34
Message-Id: 5822447.lOV4Wx5bFT@eto.sf-tec.de
In Reply to: [gentoo-dev] [PATCH 1/2] qmail.eclass: drop obsolete install hooks by Rolf Eike Beer
1 This does not use extended regular expressions in any way. While at it change
2 the way these matches are done: it's irrelevant if the entire expression is in
3 the file, if there is any rule for the given IP address then do not add the
4 new
5 expression.
6
7 Signed-off-by: Rolf Eike Beer <eike@×××××××.de>
8 ---
9 eclass/qmail.eclass | 5 ++---
10 1 file changed, 2 insertions(+), 3 deletions(-)
11
12 diff --git a/eclass/qmail.eclass b/eclass/qmail.eclass
13 index 9b2c5a8c7fb..ed53bca56fa 100644
14 --- a/eclass/qmail.eclass
15 +++ b/eclass/qmail.eclass
16 @@ -409,7 +409,7 @@ qmail_config_fast() {
17 }
18
19 qmail_tcprules_config() {
20 - local localips ip tcpstring line proto f
21 + local localips ip tcpstring proto f
22
23 einfo "Accepting relaying by default from all ips configured on
24 this machine."
25
26 @@ -425,10 +425,9 @@ qmail_tcprules_config() {
27 tcpstring=':allow,RELAYCLIENT="",RBLSMTPD=""'
28
29 for ip in ${localips}; do
30 - line="${ip}${tcpstring}"
31 for proto in smtp qmtp qmqp; do
32 f="${EROOT}${TCPRULES_DIR}/tcp.qmail-$
33 {proto}"
34 - egrep -qs "${line}" "${f}" || echo "${line}"
35 >> "${f}"
36 + grep -qs "^${ip}:" "${f}" || echo "${ip}$
37 {tcpstring}" >> "${f}"
38 done
39 done
40 }
41 --
42 2.35.3

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies