Commit 2ba03925 authored by Noah Meyerhans's avatar Noah Meyerhans

sa-compile: remove /var/lib/spamassassin/compiled on upgrade

Avoid leaving stale sa-compile output lying around.
parent e45e33a3
......@@ -13,8 +13,9 @@ spamassassin (3.4.2-2) UNRELEASED; urgency=medium
* Import upstream fix for "Not a HASH reference at
/usr/share/perl5/Mail/SpamAssassin/Plugin/FromNameSpoof.pm"
(Closes: 910435)
* Remove /var/lib/spamassassin/compiled during sa-compile upgrades.
--
-- Noah Meyerhans <noahm@debian.org> Sun, 16 Dec 2018 23:22:17 -0800
spamassassin (3.4.2-1) unstable; urgency=medium
......
......@@ -2,17 +2,23 @@
set -e
umask 022
output_dir="/var/lib/spamassassin/compiled"
sa_compile() {
OWNER=$(stat -c '%U' /var/lib/spamassassin)
# Compile, if rules have previously been compiled, and it's possible
if [ -x /usr/bin/re2c -a -x /usr/bin/sa-compile ]; then
echo "Running sa-compile (may take a long time)"
if [ -d "$output_dir" ]; then
rm -rf "$output_dir"
fi
su - $OWNER -c "sa-compile --quiet"
# Fixup perms -- group and other should be able to
# read and execute, but never write. Works around
# sa-compile's failure to obey umask.
runuser -u debian-spamd -- \
chmod -R go-w,go+rX /var/lib/spamassassin/compiled
chmod -R go-w,go+rX "$output_dir"
if command -v invoke-rc.d >/dev/null 2>&1; then
invoke-rc.d --quiet spamassassin status > /dev/null && \
invoke-rc.d spamassassin reload > /dev/null 2>&1 || true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment