From 9f5b2eac010cde31569c9a92619d6979823ace2a Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sat, 10 Oct 2020 23:24:05 +0200 Subject: tidy: avoid useless use of cat, and wrap some long lines --- postfix/postfix.sh | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/postfix/postfix.sh b/postfix/postfix.sh index 92febc6..9b075cb 100755 --- a/postfix/postfix.sh +++ b/postfix/postfix.sh @@ -116,7 +116,7 @@ catallfilesfromotherrealms() { [ -d "$realmsdir" ] || exit 0 [ -f "$realmsdir/realms" ] || exit 0 - realms=$(cat "$realmsdir/realms" | sed 's/#.*//') + realms=$(sed 's/#.*//' < "$realmsdir/realms") for realm in $realms; do if [ "$thisrealm" != "$realm" ]; then @@ -230,8 +230,8 @@ fi # Support exceptions to default response # (Day Old Bread (dob) lists need to reject only temporarily) _postconf -e rbl_reply_maps="hash:$confdir/rbl_reply_map" -cat /etc/local-COMMON/postfix/rbl_reply_map \ - | sed 's/#.*//' \ +sed 's/#.*//' \ + < /etc/local-COMMON/postfix/rbl_reply_map \ > "$tempdir/rbl_reply_map" postmapfiles="$postmapfiles rbl_reply_map" @@ -240,10 +240,16 @@ postmapfiles="$postmapfiles rbl_reply_map" # (add own domains before peers for (rare) cases of duplicates) # FIXME: somehow do this step only if enabled in smtpd_sender_restrictions # TODO: Properly implement exception exclusion like yahoo (which does not want to be checked any longer!) -cat /etc/local-COMMON/postfix/maildomains | grep -v yahoo | sort | sed 's/$/ reject_unverified_sender/' > "$tempdir/sender_access" +grep -v yahoo \ + < /etc/local-COMMON/postfix/maildomains \ + | sort \ + | sed 's/$/ reject_unverified_sender/' \ + > "$tempdir/sender_access" ( catfilefromownrealm maildomains | sort; catallfilesfromotherrealms maildomains | sort ) \ - | sed 's/\(.*\)$/postmaster@\1 permit\n\1 reject_unverified_sender/' >> "$tempdir/sender_access" -[ ! -f "$tempdir/sender_access.addon" ] || cat "$tempdir/sender_access.addon" >> "$tempdir/sender_access" + | sed 's/\(.*\)$/postmaster@\1 permit\n\1 reject_unverified_sender/' \ + >> "$tempdir/sender_access" +[ ! -f "$tempdir/sender_access.addon" ] || cat "$tempdir/sender_access.addon" \ + >> "$tempdir/sender_access" postmapfiles="$postmapfiles sender_access" _postconf -e unverified_sender_reject_code=550 @@ -273,8 +279,11 @@ fi _postconf -e smtp_tls_loglevel=1 # enforce TLS trust path towards peers -catallfilesfromotherrealms mailhost | sort | sed 's/^/[/;s/$/]:submission secure/' > "$tempdir/tls_policy" -[ ! -f "$tempdir/tls_policy.addon" ] || cat "$tempdir/tls_policy.addon" >> "$tempdir/tls_policy" +catallfilesfromotherrealms mailhost | sort \ + | sed 's/^/[/;s/$/]:submission secure/' \ + > "$tempdir/tls_policy" +[ ! -f "$tempdir/tls_policy.addon" ] || cat "$tempdir/tls_policy.addon" \ + >> "$tempdir/tls_policy" postmapfiles="$postmapfiles tls_policy" _postconf -e smtp_tls_policy_maps="hash:$confdir/tls_policy" @@ -441,7 +450,7 @@ fi case $do_update in y|Y) if [ -f "$tempdir/COMMANDS" ]; then - cat "$tempdir/COMMANDS" | sh -s + sh -s < "$tempdir/COMMANDS" fi rm -f "$tempdir/COMMANDS" -- cgit v1.2.3