From: Andrew Yu <andrew@andrewyu.org>
To: test-list@andrewyu.org
Cc: Andrew Yu <andrew@andrewyu.org>
Subject: [PATCH] Make it work with Debian 12: spamassassin -> spamd
Date: Mon, 3 Jul 2023 09:00:25 +0000 [thread overview]
Message-ID: <20230703090025.82349-1-andrew@andrewyu.org> (raw)
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
reply other threads:[~2023-07-03 9:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230703090025.82349-1-andrew@andrewyu.org \
--to=andrew@andrewyu.org \
--cc=test-list@andrewyu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox