commit:     8cbc788fa83b225e7fd72f38b248a50a1e21e616
Author:     Philippe Chaintreuil <gentoo_bugs_peep <AT> parallaxshift <DOT> com>
AuthorDate: Fri Nov 24 18:19:30 2023 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Sat Jan 27 08:48:55 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8cbc788f

mail-filter/spamassassin: Fix script output when amavisd is disabled

Because bash scripts exit with the status of the last command. If systemctl
is installed but amavisd is not active the script returns with the value 4.

This causes cron to send an email.

Switching from "&&" to an if fixes this.

Signed-off-by: Philippe Chaintreuil <gentoo_bugs_peep <AT> parallaxshift.com>
Closes: https://bugs.gentoo.org/681872
Closes: https://github.com/gentoo/gentoo/pull/33969
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 mail-filter/spamassassin/files/update-spamassassin-rules-r1.cron | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mail-filter/spamassassin/files/update-spamassassin-rules-r1.cron 
b/mail-filter/spamassassin/files/update-spamassassin-rules-r1.cron
index edac381b5de4..37c04f5b6ad8 100644
--- a/mail-filter/spamassassin/files/update-spamassassin-rules-r1.cron
+++ b/mail-filter/spamassassin/files/update-spamassassin-rules-r1.cron
@@ -35,7 +35,8 @@ if (( $? == 0 || $? == 3 )); then
        # check is to keep systemctl from outputting warnings if
        # amavisd is not installed (bug #681872).
         systemctl try-restart spamassassin
-        systemctl is-active --quiet amavisd \
-            && systemctl try-reload-or-restart amavisd
+       if ( systemctl is-active --quiet amavisd ); then
+            systemctl try-reload-or-restart amavisd
+       fi
     fi
 fi

Reply via email to