From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on andrewyu.org X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,NO_RECEIVED,NO_RELAYS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=4.0.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=andrewyu.org; s=mail; t=1688374828; bh=sSTHVW0IAlam0bphzzpSgpQVvfKx4bo1+ZDyRZgFGjE=; h=From:To:Cc:Subject:Date:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Archive:List-Owner:List-ID:From; b=qor6i4U4dB9JoLvbzPfeD6WVj5vcmhkCgD83amKdCKvniBfVgypaVetQF4+Xa6b+d fGJFKou0zGNH8RcOVCTQeu8Whsbi71ewApbYfljQsqkO484VAwOD2DN5w3fr3dWdcR Z0AkhUkeAyUgyqn0lcAxLPfs01PCZ9DV52HVAyJl3CfySstmBiVhqbSLrYgv+XZxM6 jcrSfvgIjQvaUC3RYBmNLW7viQaSR9J6l0qnpk8fCiqCKoVvnbi+U/jyqwLPzD+Qfy aMgutgsWn+SbrqqubwQCaCjmA/WpWgkax47DYxw8rkrfK0NHs11nysnX/rOubdUV7/ BEJeZynNoTynA== Authentication-Results: mail.andrewyu.org; dkim=pass (2048-bit key; unprotected) header.d=andrewyu.org header.i=@andrewyu.org header.a=rsa-sha256 header.s=mail header.b=x9OR49uY; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=andrewyu.org; s=mail; t=1688374826; bh=sSTHVW0IAlam0bphzzpSgpQVvfKx4bo1+ZDyRZgFGjE=; h=From:To:Cc:Subject:Date:From; b=x9OR49uYCLqTIJGq8+TcT6ojwQBQim700OTHNMhF67qCXdKMmyCUGsq0EFYDCsw9L GvHO+UI1PHaJUQaLHMuQtMSpSo7D6VSEBL8zwj4MfibS3RUCWqHC8zRwGqhBqGISiZ ybOY5rXnb9G56BkY2B31tOr13DkYG8mHUf1MyUqdw6O9UvR+vSO45SkLIpyO0RC7mm io40/l/QX6lHZRg26f3wV40OwRBSIWYgjvaN6R/Y/mgzvVl7gGvxkEUFMlA9Bo5f8d +mCrNAbmkY9IxlS8UOyeKWRBZM8VdGsnKN1xsE1PYPSWsNVZ0wr838wlREAsqbts7B b3nRbWp1fledw== From: Andrew Yu To: test-list@andrewyu.org Cc: Andrew Yu Subject: [PATCH] Make it work with Debian 12: spamassassin -> spamd Date: Mon, 3 Jul 2023 09:00:25 +0000 Message-Id: <20230703090025.82349-1-andrew@andrewyu.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Archive: List-Owner: List-ID: Testing List Sender: smlmp+bounces@andrewyu.org This commits checks for /etc/default/spamassassin. If it exists, it's passed through sed to modify the CRON variable as usual, and spamassassin.service is enabled and restarted. If /etc/default/spamassassin does not exist, but /etc/default/spamd exists, we modify /etc/default/spamd instead, and restart and enable spamd.service. This has to be done because Debian 12 introduced this breaking change: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1020859 Signed-off-by: Andrew Yu --- README | 10 ++++++++++ emailwiz.sh | 20 +++++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 README diff --git a/README b/README new file mode 100644 index 0000000..e5bdb17 --- /dev/null +++ b/README @@ -0,0 +1,10 @@ +Please refer to "README.md" (as opposed to this "README") for installation +instructions. + +This is a fork of https://github.com/lukesmithxyz/emailwiz/ that works with +Debian 12 bookworm, as Debian 12 introduced a breaking change, renaming +/etc/default/spamassassin to /etc/default/spamd, and renaming the relevant +systemd service from spamassassin to spamd. + +Refer to https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1020859 for details +on the Debian side of this change. diff --git a/emailwiz.sh b/emailwiz.sh index 2e24c57..1c56f52 100644 --- a/emailwiz.sh +++ b/emailwiz.sh @@ -318,9 +318,23 @@ enabled = true enabled = true" > /etc/fail2ban/jail.d/emailwiz.local # Enable SpamAssassin update cronjob. -sed -i "s|^CRON=0|CRON=1|" /etc/default/spamassassin - -for x in spamassassin opendkim dovecot postfix fail2ban; do +if [ -f /etc/default/spamassassin ] +then + sed -i "s|^CRON=0|CRON=1|" /etc/default/spamassassin + printf "Restarting spamassassin..." + service spamassassin restart && printf " ...done\\n" + systemctl enable spamassassin +elif [ -f /etc/default/spamd ] +then + sed -i "s|^CRON=0|CRON=1|" /etc/default/spamd + printf "Restarting spamd..." + service spamd restart && printf " ...done\\n" + systemctl enable spamd +else + printf "!!! Neither /etc/default/spamassassin or /etc/default/spamd exists, this is unexpected and needs to be investigated" +fi + +for x in opendkim dovecot postfix fail2ban; do printf "Restarting %s..." "$x" service "$x" restart && printf " ...done\\n" systemctl enable "$x" -- 2.39.2