File dovecot-sieve-antispam-rspamd.spec of Package dovecot-sieve-antispam-rspamd

#
# spec file for package dovecot-sieve-antispam-rspamd
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

%define sieve_dir          /usr/lib/dovecot/sieve
%define sieve_pipe_bin_dir /usr/lib/dovecot/sieve-pipe/

Name:           dovecot-sieve-antispam-rspamd
Version:        0
Release:        0
Summary:        Scripts and config to implement spam/ham learning via imap_sieve
License:        AGPL-3.0
Group:          Productivity/Networking/Email/Servers
Url:            https://nordisch.org/
Source0:        %{name}-%{version}.tar.xz
BuildRequires:  dovecot
BuildArch:      noarch
%description
Scripts and config to implement spam/ham learning via imap_sieve

https://wiki.dovecot.org/HowTo/AntispamWithSieve

%prep
%setup -q

%build

%install
make install-files DESTDIR="%{buildroot}"
touch %{buildroot}/etc/dovecot/rspamd-controller.password
pushd %{buildroot}%{sieve_dir}
  for sieve in *.sieve ; do
    svbin=${sieve%%.sieve}.svbin
    touch ${svbin}
  done
popd

%post
systemctl try-reload-or-restart dovecot ||:
pushd %{sieve_dir} > /dev/null
  for sieve in *.sieve ; do
    svbin=${sieve%%.sieve}.svbin
    sievec ${sieve} ${svbin}
    chmod go+r ${svbin}
  done
popd  > /dev/null

%files
%defattr(-,root,root)
%doc README.md
%config(noreplace) /etc/dovecot/rspamd-controller.conf.sh
%config(noreplace) /etc/dovecot/rspamd-controller.password
%config(noreplace) /etc/dovecot/conf.d/99-antispam_with_sieve.conf
%dir %{sieve_pipe_bin_dir}
%{sieve_pipe_bin_dir}/learn-ham.rspamd.script
%{sieve_pipe_bin_dir}/learn-spam.rspamd.script
%dir %{sieve_dir}
%{sieve_dir}/learn-ham.sieve
%{sieve_dir}/learn-spam.sieve
%config(noreplace) %{sieve_dir}/global-spam.sieve
%config(noreplace) %{sieve_dir}/global-try-spam.sieve
%ghost %{sieve_dir}/learn-ham.svbin
%ghost %{sieve_dir}/learn-spam.svbin
%ghost %{sieve_dir}/global-spam.svbin
%ghost %{sieve_dir}/global-try-spam.svbin

%changelog

openSUSE Build Service is sponsored by