--- /dev/null
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+command="/usr/sbin/spamd"
+pidfile="/run/spamd.pid"
+command_args="--username=spamd
+ --groupname=spamd
+ --pidfile=${pidfile}
+ ${SPAMD_OPTS}"
+command_args_background="--daemonize"
+
+: ${SPAMD_NICELEVEL:=0}
+start_stop_daemon_args="--nicelevel ${SPAMD_NICELEVEL}"
+
+# Retry after SPAMD_TIMEOUT seconds because spamd can take a
+# while to kill off all of its children. This was bug 322025.
+: ${SPAMD_TIMEOUT:=15}
+retry="${SPAMD_TIMEOUT}"
+
+extra_started_commands="reload"
+
+depend() {
+ before mta
+ use logger mysql postgres
+}
+
+reload() {
+ ebegin "Reloading configuration"
+ # Warning: reload causes the PID of the spamd process to
+ # change, but spamd does update its PID file afterwards.
+ start-stop-daemon --signal HUP --pidfile "${pidfile}"
+ eend $?
+}
--- /dev/null
+--- a/lib/Mail/SpamAssassin/PerMsgStatus.pm (revision 1790817)
++++ b/lib/Mail/SpamAssassin/PerMsgStatus.pm (working copy)
+@@ -896,16 +896,16 @@
+ $str .= shift @{$ary};
+ }
+ undef $ary;
+- chomp ($str); $str .= " [...]\n";
+
+ # in case the last line was huge, trim it back to around 200 chars
+ local $1;
+- $str =~ s/^(.{,200}).*$/$1/gs;
++ $str =~ s/^(.{200}).+$/$1 [...]/gm;
++ chomp ($str); $str .= "\n";
+
+ # now, some tidy-ups that make things look a bit prettier
+- $str =~ s/-----Original Message-----.*$//gs;
++ $str =~ s/-----Original Message-----.*$//gm;
+ $str =~ s/This is a multi-part message in MIME format\.//gs;
+- $str =~ s/[-_\*\.]{10,}//gs;
++ $str =~ s/[-_*.]{10,}//gs;
+ $str =~ s/\s+/ /gs;
+
+ # add "Content preview:" ourselves, so that the text aligns
EAPI=6
-inherit perl-functions systemd toolchain-funcs
+inherit perl-functions systemd toolchain-funcs user
MY_P="Mail-SpamAssassin-${PV//_/-}"
S="${WORKDIR}/${MY_P}"
"${FILESDIR}/spamassassin-3.4.1-bug_7231.patch"
"${FILESDIR}/spamassassin-3.4.1-bug_7265.patch"
"${FILESDIR}/spamassassin-3.4.1-bug_7231-extra.patch"
+ "${FILESDIR}/spamassassin-3.4.1-bug_7404.patch"
"${FILESDIR}/spamassassin-3.4.1-perl526.patch"
)
|| die "failed to disable plugins by default"
# Add the init and config scripts.
- newinitd "${FILESDIR}/3.4.1-spamd.init" spamd
+ newinitd "${FILESDIR}/3.4.1-spamd.init-r1" spamd
newconfd "${FILESDIR}/3.4.1-spamd.conf" spamd
systemd_newunit "${FILESDIR}/${PN}.service-r1" "${PN}.service"
systemd_install_serviced "${FILESDIR}/${PN}.service.conf"
- # The sed statements in the following conditionals alter the init
- # script to depend (or not) on the database being running before
- # spamd is started. The sed commands either enable the dependency,
- # or delete the line entirely.
- if use postgres; then
- sed -i -e 's:@USEPOSTGRES@::' "${ED}/etc/init.d/spamd" || die
-
- dodoc sql/*_pg.sql
- else
- sed -i -e '/@USEPOSTGRES@/d' "${ED}/etc/init.d/spamd" || die
- fi
-
- if use mysql; then
- sed -i -e 's:@USEMYSQL@::' "${ED}/etc/init.d/spamd" || die
-
- dodoc sql/*_mysql.sql
- else
- sed -i -e '/@USEMYSQL@/d' "${ED}/etc/init.d/spamd" || die
- fi
+ use postgres && dodoc sql/*_pg.sql
+ use mysql && dodoc sql/*_mysql.sql
dodoc NOTICE TRADEMARK CREDITS UPGRADE USAGE sql/README.bayes \
sql/README.awl procmailrc.example sample-nonspam.txt \
default
}
+pkg_preinst() {
+ # The spamd daemon runs as this user. Use a real home directory so
+ # that it can hold SA configuration.
+ enewuser spamd -1 -1 /home/spamd
+}
+
pkg_postinst() {
elog
elog 'No rules are installed by default. You will need to run sa-update'