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