comparison syslog2iptables.spec.in @ 71:79f310d1bc46

RHEL7 systemd and /var/run on tmpfs
author Carl Byington <carl@five-ten-sg.com>
date Thu, 09 Feb 2017 12:44:31 -0800
parents 0e736950a117
children 4685767c0c85
comparison
equal deleted inserted replaced
70:e841d8422b74 71:79f310d1bc46
1 %define localstatedir /var/lib 1 %define localstatedir /var/lib
2 2
3 Summary: Syslog to iptables dynamic firewall 3 Summary: Syslog to iptables dynamic firewall
4 Name: @PACKAGE@ 4 Name: @PACKAGE@
5 Version: @VERSION@ 5 Version: @VERSION@
6 Release: 3%{?dist} 6 Release: 1%{?dist}
7 License: GPLv3+ 7 License: GPLv3+
8 Group: System Environment/Daemons 8 Group: System Environment/Daemons
9 Source: http://www.five-ten-sg.com/%{name}/packages/%{name}-%{version}.tar.gz 9 Source: http://www.five-ten-sg.com/%{name}/packages/%{name}-%{version}.tar.gz
10 BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) 10 BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
11 URL: http://www.five-ten-sg.com/%{name}/ 11 URL: http://www.five-ten-sg.com/%{name}/
13 Requires(post,preun): /sbin/chkconfig 13 Requires(post,preun): /sbin/chkconfig
14 Requires(post,preun): /sbin/service 14 Requires(post,preun): /sbin/service
15 Requires: iptables 15 Requires: iptables
16 Requires: coreutils 16 Requires: coreutils
17 BuildRequires: gcc gcc-c++ 17 BuildRequires: gcc gcc-c++
18 %if "%{?dist}" == ".el7"
19 Requires(pre): systemd-sysv, shadow-utils
20 Requires(post): systemd-units
21 Requires(preun): systemd-units
22 Requires(postun): systemd-units
23 Requires: coreutils
24 Requires: systemd-units
25 BuildRequires: systemd-units
26 %endif
18 27
19 28
20 %description 29 %description
21 This is a simple adaptive firewall. It maintains the INPUT chain 30 This is a simple adaptive firewall. It maintains the INPUT chain
22 of the iptables firewall set based on syslog entries. 31 of the iptables firewall set based on syslog entries.
26 35
27 %build 36 %build
28 %configure 37 %configure
29 make %{?_smp_mflags} 38 make %{?_smp_mflags}
30 39
31
32 %install 40 %install
33 rm -rf $RPM_BUILD_ROOT 41 rm -rf %{buildroot}
34 make DESTDIR=$RPM_BUILD_ROOT install 42 make DESTDIR=%{buildroot} install
35 mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d 43 %if "%{?dist}" == ".el7"
36 mv -f $RPM_BUILD_ROOT%{_sysconfdir}/%{name} $RPM_BUILD_ROOT/etc/rc.d/init.d 44 install -m 644 -D %{buildroot}%{_sysconfdir}/%{name}.service \
37 rm -f $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.conf 45 %{buildroot}%{_unitdir}/%{name}.service
46 %else
47 install -m 755 -D %{buildroot}%{_sysconfdir}/%{name} \
48 %{buildroot}%{_initrddir}/%{name}
49 %endif
50 rm -f %{buildroot}%{_sysconfdir}/%{name}
51 rm -f %{buildroot}%{_sysconfdir}/%{name}.service
38 52
39 53
40 %clean 54 %clean
41 rm -rf $RPM_BUILD_ROOT 55 rm -rf %{buildroot}
42 56
43 57
44 %pre 58 %pre
45 59
46 60
47 %post 61 %post
48 /sbin/chkconfig --add %{name} 62 if [ $1 = 1 ]; then
49 (cd %{_sysconfdir}; ./%{name}.conf.make) 63 # initial install
50 64 %if "%{?dist}" == ".el7"
65 /bin/systemctl daemon-reload &>/dev/null || :
66 %else
67 /sbin/chkconfig --add %{name}
68 %endif
69 (cd %{_sysconfdir}; ./%{name}.conf.make)
70 fi
51 71
52 %preun 72 %preun
53 [ $1 = 0 ] && /sbin/service %{name} stop || : 73 if [ $1 = 0 ]; then
74 # package removal, not upgrade
75 %if "%{?dist}" == ".el7"
76 /bin/systemctl --no-reload disable %{name}.service &>/dev/null || :
77 /bin/systemctl stop %{name}.service &>/dev/null || :
78 %else
79 /sbin/service %{name} stop || :
80 /sbin/chkconfig --del %{name}
81 %endif
82 fi
54 83
55 84
56 %postun 85 %postun
57 [ $1 = 0 ] && /sbin/chkconfig --del %{name} || : 86 if [ $1 -ge 1 ]; then
87 # package upgrade, not uninstall
88 %if "%{?dist}" == ".el7"
89 /bin/systemctl try-restart %{name}.service &>/dev/null || :
90 %else
91 /sbin/service %{name} restart || :
92 %endif
93 fi
58 94
59 95
60 %files 96 %files
61 %defattr(-,root,root,-) 97 %defattr(-,root,root,-)
62 %{_sbindir}/* 98 %{_sbindir}/*
66 %{_datadir}/doc/%{name}-%{version} 102 %{_datadir}/doc/%{name}-%{version}
67 %config(noreplace) %{_sysconfdir}/%{name}.conf.top 103 %config(noreplace) %{_sysconfdir}/%{name}.conf.top
68 %config(noreplace) %{_sysconfdir}/%{name}.conf.httpd 104 %config(noreplace) %{_sysconfdir}/%{name}.conf.httpd
69 %config(noreplace) %{_sysconfdir}/%{name}.conf.bottom 105 %config(noreplace) %{_sysconfdir}/%{name}.conf.bottom
70 %attr(750,root,root) %{_sysconfdir}/%{name}.conf.make 106 %attr(750,root,root) %{_sysconfdir}/%{name}.conf.make
71 /etc/rc.d/init.d/%{name} 107 %if "%{?dist}" == ".el7"
108 %{_unitdir}/%{name}.service
109 %else
110 %{_initrddir}/%{name}
111 %endif
72 112
73 113
74 %changelog 114 %changelog
115 * Thu Feb 09 2017 Carl Byington <carl@five-ten-sg.com> - 1.17-1
116 - RHEL7 systemd and /var/run is on tmpfs
117
75 * Mon Dec 21 2015 Carl Byington <carl@five-ten-sg.com> - 1.16-3 118 * Mon Dec 21 2015 Carl Byington <carl@five-ten-sg.com> - 1.16-3
76 - fix post uninstall script 119 - fix post uninstall script
77 - allow config bucket count zero to disable a pattern 120 - allow config bucket count zero to disable a pattern
78 121
79 * Sat Dec 19 2015 Carl Byington <carl@five-ten-sg.com> - 1.16-2 122 * Sat Dec 19 2015 Carl Byington <carl@five-ten-sg.com> - 1.16-2