diff --git a/amavisd-new-service b/amavisd-new-service new file mode 100644 index 0000000..7973500 --- /dev/null +++ b/amavisd-new-service @@ -0,0 +1,12 @@ +[Unit] +Description=Amavisd an interface between MTA and content checkers. +After=syslog.target network.target +Wants=clamd.service + +[Service] +Type=forking +PIDFile=/var/amavis/amavisd.pid +ExecStart=/usr/sbin/amavisd -c /etc/amavisd.conf + +[Install] +WantedBy=multi-user.target diff --git a/amavisd-new.spec b/amavisd-new.spec index 3f15d87..69d1b76 100644 --- a/amavisd-new.spec +++ b/amavisd-new.spec @@ -2,15 +2,16 @@ %define vscan_gid 65416 Name: amavisd-new -Version: 2.9.1 -Release: 2mamba +Version: 2.10.0 +Release: 1mamba Summary: An interface between mailer (MTA) and content checkers: virus scanners, and/or SpamAssassin Group: System/Servers Vendor: openmamba Distribution: openmamba Packager: Silvan Calarco URL: http://www.ijs.si/software/amavisd/ -Source: http://www.ijs.si/software/amavisd/amavisd-new-%{version}.tar.gz +Source: http://www.ijs.si/software/amavisd/amavisd-new-%{version}.tar.xz +Source1: amavisd-new-service Patch0: amavisd-new-2.8.1-initscript-no-deprecated-network.patch License: GPL BuildRoot: %{_tmppath}/%{name}-%{version}-root @@ -31,6 +32,7 @@ Requires: perl-Mail-DKIM Requires: perl-Mail-Tools Requires: perl-MIME-tools Requires: perl-Archive-Zip +Requires: perl-File-LibMagic Requires: clamav Requires: clamd Requires: pax @@ -55,7 +57,7 @@ amavisd-new is a high-performance interface between mailer (MTA) and content che %prep %setup -q -%patch0 -p1 +#%patch0 -p1 %build @@ -63,20 +65,27 @@ amavisd-new is a high-performance interface between mailer (MTA) and content che [ "%{buildroot}" != / ] && rm -rf "%{buildroot}" install -d %{buildroot}/var/amavis/{tmp,var,db,home} install -D -m0755 amavisd %{buildroot}%{_sbindir}/amavisd -install -D -m0755 amavisd_init.sh %{buildroot}%{_initrddir}/amavisd +#install -D -m0755 amavisd_init.sh %{buildroot}%{_initrddir}/amavisd install -D -m0640 amavisd.conf %{buildroot}%{_sysconfdir}/amavisd.conf install -d %{buildroot}/var/virusmails +install -D -m0644 %{SOURCE1} %{buildroot}%{_unitdir}/amavisd.service %clean [ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +%postun +%systemd_postun_with_restart amavisd + %pre +if [ $1 -gt 1 ]; then + /sbin/chkconfig --del amavisd 2>/dev/null +fi if [ $1 -ge 1 ]; then /usr/sbin/groupadd vscan -g %{vscan_gid} 2>/dev/null /usr/sbin/useradd -u %{vscan_uid} -c 'Virus Scan user' -d /var/amavis -g vscan -s /bin/false vscan 2>/dev/null /usr/sbin/usermod clamav -G vscan fi -exit 0 +: %post if [ $1 -ge 1 ]; then @@ -84,8 +93,6 @@ if [ $1 -ge 1 ]; then #sed -i "s|# \$myhostname.*|\$myhostname = '$FQDN';|" %{_sysconfdir}/amavisd.conf DOMAIN=`hostname -d` sed -i "s|# \$mydomain = .*|\$mydomain = '$DOMAIN';|" %{_sysconfdir}/amavisd.conf - /sbin/chkconfig --add amavisd - /sbin/service amavisd restart postconf -e "strict_rfc821_envelopes = yes" sudo postconf -e "content_filter = smtp-amavis:[127.0.0.1]:10024" [ "`grep amavisfeed %{_sysconfdir}/postfix/master.cf`" ] || { @@ -118,15 +125,15 @@ smtp-amavis unix - - n - 2 smtp -o local_header_rewrite_clients= # END of amavisd-new configuration _EOF + %systemd_post amavisd postfix reload } fi exit 0 %preun +%systemd_preun amavisd if [ $1 -eq 0 ]; then - /sbin/chkconfig --del amavisd - /sbin/service amavisd stop /usr/sbin/userdel vscan 2>/dev/null /usr/sbin/groupdel vscan 2>/dev/null fi @@ -135,13 +142,17 @@ exit 0 %files %defattr(-,root,root) %attr(0640,root,vscan) %config(noreplace) %{_sysconfdir}/amavisd.conf -%{_initrddir}/amavisd %{_sbindir}/amavisd +%{_unitdir}/amavisd.service %attr(0750,vscan,vscan) /var/virusmails %attr(0750,vscan,vscan) /var/amavis %doc LICENSE TODO %changelog +* Fri Oct 24 2014 Silvan Calarco 2.10.0-1mamba +- update to 2.10.0 +- systemd switch + * Thu Jul 24 2014 Silvan Calarco 2.9.1-2mamba - small fixes to amavisd.conf and postfix configuration changes upon first install