--- rpms/denyhosts/contribs10/denyhosts.spec 2021/03/14 22:32:32 1.1 +++ rpms/denyhosts/contribs10/denyhosts.spec 2021/03/15 05:25:59 1.3 @@ -14,22 +14,13 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # - - -%if 0%{?suse_version} < 1120 -%define python_sitelib %{py_sitedir} -%endif - -%if 0%{?suse_version} >= 1210 -%bcond_without systemd -%else -%bcond_with systemd -%endif - +%define release 12 +%define _unitdir /usr/lib/systemd/system/ +%global with_systemd 1 Name: denyhosts Version: 3.1 -Release: lp152.1.1 +Release: %{release}%{?dist} Summary: Utility to help system administrators thwart brute-force ssh hackers License: GPL-2.0-only Group: Productivity/Networking/Security @@ -46,16 +37,11 @@ Requires: python-ipaddr Requires: logrotate Requires: python Requires: rsyslog -%if %{with systemd} -BuildRequires: systemd-rpm-macros +BuildRequires: python-rpm-macros +#BuildRequires: systemd-rpm-macros +BuildRequires: systemd %{?systemd_requires} -%else -PreReq: %insserv_prereq -%endif -%py_requires -%if 0%{?suse_version} > 1110 BuildArch: noarch -%endif BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -98,7 +84,7 @@ sed -i "s|^#SECURE_LOG = /var/log/messag sed -i "s|/usr/bin/env python|%{_bindir}/python|g" %{buildroot}%{_sbindir}/daemon-control-dist # init script / systemd service -%if %{with systemd} +%if %{with_systemd} install -D -m644 denyhosts.service %{buildroot}%{_unitdir}/denyhosts.service ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcdenyhosts %else @@ -133,31 +119,31 @@ install -m0644 *.txt %{buildroot}%{_def install -m0644 *.md %{buildroot}%{_defaultdocdir}/%{name}/ install -m0644 *.conf %{buildroot}%{_defaultdocdir}/%{name}/ -%if %{with systemd} -%pre -%service_add_pre %{name}.service -%endif - -%post -%if %{with systemd} -%service_add_post %{name}.service -%else -%{fillup_and_insserv -f denyhosts} -%endif - -%preun -%if %{with systemd} -%service_del_preun %{name}.service -%else -%stop_on_removal denyhosts -%endif - -%postun -%if %{with systemd} -%service_del_postun %{name}.service -%else -%insserv_cleanup -%endif +#% if %{with_systemd} +#% pre +#% service_add_pre %{name}.service +#% endif + +#% post +#% if %{with_systemd} +#% service_add_post %{name}.service +#% else +#% {fillup_and_insserv -f denyhosts} +#% endif + +#% preun +#% if %{with_systemd} +#% service_del_preun %{name}.service +#% else +#% stop_on_removal denyhosts +#% endif + +#% postun +#% if %{with_systemd} +#% service_del_postun %{name}.service +#% else +#% insserv_cleanup +#% endif %files @@ -177,13 +163,18 @@ install -m0644 *.conf %{buildroot}%{_def %ghost %config(noreplace) %{_sysconfdir}/blacklist %config(noreplace) %{_sysconfdir}/logrotate.d/denyhosts %config(noreplace) %{_sysconfdir}/denyhosts.conf -%if %{with systemd} +%if %{with_systemd} %{_unitdir}/denyhosts.service %else %attr(755,root,root) %{_sysconfdir}/init.d/denyhosts %endif %changelog +* Sun Mar 14 2021 Jean-Philippe Pialasse 3.1-11.sme +- First release for SME10 [SME: 11459] + imported from opensuse, reworked spec file to build it on CentOS 7 / SME 10 +- remove systemd pre post scriptlet, do not have macros, and we use SME to register service + * Sat Aug 11 2018 javier@opensuse.org - Update to 3.1 + Fixes a bug when moving between Python 2 and Python 3