]> git.pld-linux.org Git - packages/nagios-plugin-check_iptables.git/blame - nagios-plugin-check_iptables.spec
version 0.2; unhardcode tool paths
[packages/nagios-plugin-check_iptables.git] / nagios-plugin-check_iptables.spec
CommitLineData
ac1ff40f
ER
1%define plugin check_iptables
2Summary: Nagios plugin to check count of iptables rules
3Name: nagios-plugin-%{plugin}
164127df
ER
4Version: 0.2
5Release: 1
ac1ff40f
ER
6License: GPL v2
7Group: Networking
77b38ba9 8Source0: %{plugin}.sh
ac1ff40f 9Source1: %{plugin}.cfg
7150e1ba
ER
10BuildRequires: rpmbuild(macros) >= 1.685
11Requires: grep
ac1ff40f
ER
12Requires: iptables
13Requires: nagios-common
f4edd149 14Requires: nagios-plugins-libs
7150e1ba 15Requires: sed >= 4.0
ac1ff40f
ER
16Requires: sudo
17BuildArch: noarch
18BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
19
20%define _sysconfdir /etc/nagios/plugins
7150e1ba 21%define nrpeddir /etc/nagios/nrpe.d
ac1ff40f
ER
22%define plugindir %{_prefix}/lib/nagios/plugins
23
24%description
25Nagios plugin to check count of iptables rules.
26
27%prep
28%setup -qcT
29cp -p %{SOURCE0} %{plugin}
30
31%install
32rm -rf $RPM_BUILD_ROOT
7150e1ba 33install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{nrpeddir},%{plugindir}}
ac1ff40f
ER
34install -p %{plugin} $RPM_BUILD_ROOT%{plugindir}/%{plugin}
35sed -e 's,@plugindir@,%{plugindir},' %{SOURCE1} > $RPM_BUILD_ROOT%{_sysconfdir}/%{plugin}.cfg
7150e1ba 36touch $RPM_BUILD_ROOT%{nrpeddir}/%{plugin}.cfg
ac1ff40f
ER
37
38%clean
39rm -rf $RPM_BUILD_ROOT
40
41%post
42if [ "$1" = 1 ]; then
43 # setup sudo rules on first install
44 %{plugindir}/%{plugin} -S || :
45fi
46
47%postun
48if [ "$1" = 0 ]; then
49 # remove all sudo rules related to us
50 %{__sed} -i -e '/CHECK_IPTABLES/d' /etc/sudoers
51fi
52
53%triggerin -- nagios-nrpe
54%nagios_nrpe -a %{plugin} -f %{_sysconfdir}/%{plugin}.cfg
55
56%triggerun -- nagios-nrpe
57%nagios_nrpe -d %{plugin} -f %{_sysconfdir}/%{plugin}.cfg
58
59%files
60%defattr(644,root,root,755)
61%attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{plugin}.cfg
7150e1ba 62%ghost %{nrpeddir}/%{plugin}.cfg
ac1ff40f 63%attr(755,root,root) %{plugindir}/%{plugin}
This page took 0.068434 seconds and 4 git commands to generate.