Blob Blame History Raw
%if 0%{?fedora} >= 17 || 0%{?rhel} >= 7
%global with_systemd 1
%global clamupdateuser clamupdate
%global clamupdategrp  clamupdate
%else
%global with_systemd 0
%global clamupdateuser clam-update
%global clamupdategrp  clam-update
%endif
Name:           clamav-unofficial-sigs
Version:        5.6.2
Release:        6%{?dist}
Summary:        Scripts to download unofficial clamav signatures 
Group:          Applications/System
License:        BSD
URL:            https://github.com/extremeshok/%{name}
Source0:        https://github.com/extremeshok/%{name}/archive/%{version}.tar.gz
BuildArch:      noarch
BuildRequires:  bind-utils
BuildRequires:  rsync
%if %{with_systemd}
BuildRequires:  systemd
%endif
Requires:       clamav clamav-update rsync gnupg diffutils curl bind-utils

%description
This package contains scripts and configuration files
that provide the capability to download, test, and 
update the 3rd-party signature databases provide by 
Sanesecurity, SecuriteInfo, MalwarePatrol, OITC, 
INetMsg and ScamNailer.

%prep
%setup -qn %{name}-%{version}
sed -i -e '/user_configuration_complete/ s/^#//' config/user.conf
sed -i -e '/ExecStart/ s^/usr/local/sbin^/usr/sbin^' systemd/clamav-unofficial-sigs.service
# Just for generating cron, logrotate and man files
grep version config/master.conf > build.conf
cat << EOF >> build.conf
clamscan_bin="/usr/bin/clamscan"
rsync_bin="/usr/bin/rsync"
clam_user=root
clam_group=root
work_dir="."
clam_dbs="."
man_dir="."
cron_filename="%{name}.cron"
cron_dir="."
logrotate_filename="%{name}.logrotate"
logrotate_dir="."
log_file_path="."
user_configuration_complete="yes"
EOF

%build
bash clamav-unofficial-sigs.sh -c ./build.conf --install-all
%if 0%{?rhel} <= 7
sed -i -e '/^#pkg_mgr/ s/^#//;s/""/"yum"/' config/master.conf
%else
sed -i -e '/^#pkg_mgr/ s/^#//;s/""/"dnf"/' config/master.conf
%endif
# Disable yara rules
sed -i -e '/^enable_yararules/ s/yes/no/' config/master.conf
sed -i -e '/^clamd_restart_opt/ s/systemctl restart/systemctl try-restart/' config/os.centos7.conf
sed -i -e 's^%{_builddir}/%{name}-%{version}^%{_sbindir}^g' clamav-unofficial-sigs.cron
sed -i -e 's^\./^%{_localstatedir}/log/clamav-unofficial-sigs/*.log^' clamav-unofficial-sigs.logrotate

%install
rm -rf %{buildroot}
install -d -p %{buildroot}%{_unitdir}
install -d -p %{buildroot}%{_sysconfdir}/%{name}
install -d -p %{buildroot}%{_sbindir}
install -d -p %{buildroot}%{_localstatedir}/log/%{name}
install -d -p %{buildroot}%{_localstatedir}/lib/%{name}
install -d -p %{buildroot}%{_sysconfdir}/cron.d
install -d -p %{buildroot}%{_sysconfdir}/logrotate.d
install -d -p %{buildroot}%{_mandir}/man8
install -p -m0755 clamav-unofficial-sigs.sh %{buildroot}%{_sbindir}/clamav-unofficial-sigs.sh
# config/os.centos7.conf file is for epel and fedora
%if 0%{?fedora} >= 17 || 0%{?rhel} >= 7
install -p -m0644 config/os.centos7.conf %{buildroot}%{_sysconfdir}/%{name}/os.conf
%else
install -p -m0644 config/os.centos6.conf %{buildroot}%{_sysconfdir}/%{name}/os.conf
%endif
install -p -m0644 config/user.conf %{buildroot}%{_sysconfdir}/%{name}/user.conf
install -p -m0644 config/master.conf %{buildroot}%{_sysconfdir}/%{name}/master.conf
install -Dp -m 0644 systemd/clamav-unofficial-sigs.service %{buildroot}%{_unitdir}/clamav-unofficial-sigs.service
install -Dp -m 0644 systemd/clamav-unofficial-sigs.timer %{buildroot}%{_unitdir}/clamav-unofficial-sigs.timer
install -p -m0644 clamav-unofficial-sigs.cron %{buildroot}%{_sysconfdir}/cron.d/clamav-unofficial-sigs
install -p -m0644 clamav-unofficial-sigs.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/clamav-unofficial-sigs
install -p -m0644 clamav-unofficial-sigs.8 %{buildroot}%{_mandir}/man8/clamav-unofficial-sigs.8

%clean
rm -rf %{buildroot}

%files
%doc README.md 
%license LICENSE
%dir %{_sysconfdir}/%{name}
%config %{_sysconfdir}/%{name}/os.conf
%config %{_sysconfdir}/%{name}/master.conf
%config(noreplace) %{_sysconfdir}/%{name}/user.conf
%{_sbindir}/clamav-unofficial-sigs.sh
%attr(0755,%{clamupdateuser},%{clamupdategrp}) %dir %{_localstatedir}/lib/%{name}
%attr(0755,%{clamupdateuser},%{clamupdategrp}) %dir %{_localstatedir}/log/%{name}
%if %{with_systemd}
%{_unitdir}/%{name}.service
%{_unitdir}/%{name}.timer
%endif
%{_sysconfdir}/cron.d/%{name}
%{_sysconfdir}/logrotate.d/%{name}
%{_mandir}/man*/%{name}*

%changelog
* Sun Mar 17 2019 Didier Fabert <didier.fabert@gmail.com> 5.6.2-6
- Fix local state dir owner and group on el6
- Fix typo in summary
- Remove INSTALL from doc

* Thu Mar  7 2019 Tim Landscheidt <tim@tim-landscheidt.de> - 5.6.2-5
- Remove obsolete requirement for %%post scriptlet

* Thu Feb 28 2019 Didier Fabert <didier.fabert@gmail.com> 5.6.2-4
- Fix spec for el6 build

* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 5.6.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Fri Dec 21 2018 Didier Fabert <didier.fabert@gmail.com> 5.6.2-3
- Fix logrotate (files are rotated more than one time)
- Fix clamd_restart_opt with try-restart
- Disable yara rules by default (can be enabled in user.conf to overrride master.conf setting)

* Wed Sep 12 2018 Didier Fabert <didier.fabert@gmail.com> 5.6.2-2
- Generate cron, logrotate and man files

* Wed Sep 12 2018 Didier Fabert <didier.fabert@gmail.com> 5.6.2-1
- Switch to new upstream: extremeshok on github

* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Mon Jul 20 2015 Ján ONDREJ (SAL) <ondrejj(at)salstar.sk> - 3.7.2-1
- Update to upstream
- EPEL7 branch
- New source URL and URL at sourceforge (see also debian bug#734593)

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.7.1-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.7.1-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Wed Aug 07 2013 Pierre-Yves Chibon <pingou@pingoured.fr> - 3.7.1-11
- Add a missing requirement on crontabs to spec file
- Fixes RHBZ#988602

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.7.1-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.7.1-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Sat Aug 04 2012 Andrew Colin Kissa <andrew@topdog.za.net> - 3.7.1-8
- FIX: bugzilla #842180

* Wed Jul 18 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.7.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Thu Jan 12 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.7.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Sat Apr 23 2011 Andrew Colin Kissa <andrew@topdog.za.net> - 3.7.1-5
- FIX: bugzilla #683139

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.7.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Sun Jan 02 2011 Andrew Colin Kissa <andrew@topdog.za.net> - 3.7.1-3
- Fixes requested by reviewer

* Thu Dec 23 2010 Andrew Colin Kissa <andrew@topdog.za.net> - 3.7.1-2
- Fixes requested by reviewer

* Tue Jul 20 2010 Andrew Colin Kissa <andrew@topdog.za.net> - 3.7.1-1
- upgraded to latest upstream

* Thu Apr 22 2010 Andrew Colin Kissa <andrew@topdog.za.net> - 3.7-3
- Fix sed error

* Mon Mar 15 2010 Andrew Colin Kissa <andrew@topdog.za.net> - 3.7-2
- Fix the cron entry

* Tue Mar 09 2010 Andrew Colin Kissa <andrew@topdog.za.net> - 3.7-1
- Initial packaging