diff syslog2iptables.spec.in @ 77:c6ba792f1a9a

systemd only
author Carl Byington <carl@five-ten-sg.com>
date Wed, 15 Jul 2020 13:58:42 -0700
parents c6c8a2102a3e
children cc01f2caff37
line wrap: on
line diff
--- a/syslog2iptables.spec.in	Wed Jul 15 13:38:43 2020 -0700
+++ b/syslog2iptables.spec.in	Wed Jul 15 13:58:42 2020 -0700
@@ -10,18 +10,14 @@
 BuildRoot:          %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 URL:                http://www.five-ten-sg.com/%{name}/
 
-Requires(post,preun):   /sbin/chkconfig
-Requires(post,preun):   /sbin/service
 Requires:               iptables, coreutils
 BuildRequires:          gcc gcc-c++
-%if "%{?dist}" == ".el7"
 Requires(pre):  systemd-sysv, shadow-utils
 Requires(post): systemd-units
 Requires(preun):  systemd-units
 Requires(postun): systemd-units
 Requires:       rsyslog, systemd-units
 BuildRequires:  systemd-units
-%endif
 
 
 %description
@@ -38,13 +34,7 @@
 %install
 rm -rf %{buildroot}
 make DESTDIR=%{buildroot} install
-%if "%{?dist}" == ".el7"
-install -m 644 -D %{buildroot}%{_sysconfdir}/%{name}.service \
-    %{buildroot}%{_unitdir}/%{name}.service
-%else
-install -m 755 -D %{buildroot}%{_sysconfdir}/%{name} \
-    %{buildroot}%{_initrddir}/%{name}
-%endif
+install -m 644 -D %{buildroot}%{_sysconfdir}/%{name}.service %{buildroot}%{_unitdir}/%{name}.service
 rm -f  %{buildroot}%{_sysconfdir}/%{name}
 rm -f  %{buildroot}%{_sysconfdir}/%{name}.service
 
@@ -59,24 +49,15 @@
 %post
 if [ $1 = 1 ]; then
     # initial install
-%if "%{?dist}" == ".el7"
     /bin/systemctl daemon-reload &>/dev/null || :
-%else
-    /sbin/chkconfig --add %{name}
-%endif
     (cd %{_sysconfdir}; ./%{name}.conf.make)
 fi
 
 %preun
 if [ $1 = 0 ]; then
     # package removal, not upgrade
-%if "%{?dist}" == ".el7"
     /bin/systemctl --no-reload disable %{name}.service &>/dev/null || :
     /bin/systemctl stop %{name}.service &>/dev/null || :
-%else
-    /sbin/service %{name} stop || :
-    /sbin/chkconfig --del %{name}
-%endif
 fi
 
 
@@ -84,11 +65,7 @@
 if [ $1 -ge 1 ]; then
     # package upgrade, not uninstall
     (cd %{_sysconfdir}; ./%{name}.conf.make)
-%if "%{?dist}" == ".el7"
     /bin/systemctl try-restart %{name}.service &>/dev/null || :
-%else
-    /sbin/service %{name} restart || :
-%endif
 fi
 
 
@@ -103,11 +80,7 @@
 %config(noreplace) %{_sysconfdir}/%{name}.conf.httpd
 %config(noreplace) %{_sysconfdir}/%{name}.conf.bottom
 %attr(750,root,root) %{_sysconfdir}/%{name}.conf.make
-%if "%{?dist}" == ".el7"
 %{_unitdir}/%{name}.service
-%else
-%{_initrddir}/%{name}
-%endif
 
 
 %changelog