* [PATCH] Make it work with Debian 12: spamassassin -> spamd
@ 2023-07-03 9:00 Andrew Yu
0 siblings, 0 replies; only message in thread
From: Andrew Yu @ 2023-07-03 9:00 UTC (permalink / raw)
To: test-list; +Cc: Andrew Yu
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 <andrew@andrewyu.org>
---
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-07-03 9:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-03 9:00 [PATCH] Make it work with Debian 12: spamassassin -> spamd Andrew Yu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox