summaryrefslogtreecommitdiffstats
path: root/nagios-plugins.spec.in
diff options
context:
space:
mode:
Diffstat (limited to 'nagios-plugins.spec.in')
-rw-r--r--nagios-plugins.spec.in146
1 files changed, 132 insertions, 14 deletions
diff --git a/nagios-plugins.spec.in b/nagios-plugins.spec.in
index 523d7c38..17a44c36 100644
--- a/nagios-plugins.spec.in
+++ b/nagios-plugins.spec.in
@@ -1,6 +1,23 @@
1# Macros
2%define isaix %(test "`uname -s`" = "AIX" && echo "1" || echo "0")
3%define islinux %(test "`uname -s`" = "Linux" && echo "1" || echo "0")
4%define isredhatfamily %(test -f /etc/redhat-release && echo "1" || echo "0")
5
6%if %{isaix}
7 %define _prefix /opt/nagios
8# %define _defaultdocdir %{_datadir}/doc
9%else
10 %define _libexecdir %{_exec_prefix}/lib/nagios/plugins
11%endif
12%define _sysconfdir /etc/nagios
13
14%define npusr nagios
15%define nphome /opt/nagios
16%define npgrp nagios
17
1Name: nagios-plugins 18Name: nagios-plugins
2Version: %%{VERSION} 19Version: @PACKAGE_VERSION@
3Release: %%{RELEASE} 20Release: @RELEASE@
4Summary: Host/service/network monitoring program plugins for Nagios 21Summary: Host/service/network monitoring program plugins for Nagios
5 22
6Group: Applications/System 23Group: Applications/System
@@ -9,7 +26,13 @@ URL: http://nagiosplug.sourceforge.net/
9Source0: http://dl.sf.net/sourceforge/nagiosplug/%{name}-%{version}.tar.gz 26Source0: http://dl.sf.net/sourceforge/nagiosplug/%{name}-%{version}.tar.gz
10BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 27BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
11 28
29%define npdir %{_builddir}/%{name}-%{version}
30
31%if %{isaix}
32Prefix: %{_prefix}
33%else
12Prefix: %{_prefix}/lib/nagios/plugins 34Prefix: %{_prefix}/lib/nagios/plugins
35%endif
13Packager: Karl DeBisschop <kdebisschop@users.sourceforge.net> 36Packager: Karl DeBisschop <kdebisschop@users.sourceforge.net>
14Vendor: Nagios Plugin Development Group 37Vendor: Nagios Plugin Development Group
15Provides: nagios-plugins 38Provides: nagios-plugins
@@ -19,6 +42,60 @@ Obsoletes: nagios-plugins-custom nagios-plugins-extras
19 42
20 43
21# Requires 44# Requires
45%if %{isaix}
46Requires: fping
47Requires: gawk
48Requires: net-snmp
49Requires: net-snmp-perl
50Requires: net-snmp-utils
51Requires: openldap
52Requires: openssl
53Requires: perl
54Requires: python
55Requires: openssl
56BuildRequires: fping
57BuildRequires: gawk
58BuildRequires: net-snmp
59BuildRequires: net-snmp-perl
60BuildRequires: net-snmp-utils
61BuildRequires: openldap-devel
62%endif
63%if %{isredhatfamily}
64Requires: bind-utils
65Requires: coreutils
66Requires: fping
67Requires: gawk
68Requires: grep
69Requires: iputils
70Requires: mysql
71Requires: net-snmp-utils
72Requires: ntp
73Requires: openldap
74Requires: openssl
75Requires: openssh-clients
76Requires: perl
77Requires: postgresql-libs
78Requires: procps
79Requires: python
80Requires: samba-client
81Requires: shadow-utils
82Requires: traceroute
83Requires: /usr/bin/mailq
84BuildRequires: bind-utils
85BuildRequires: coreutils
86BuildRequires: iputils
87BuildRequires: mysql-devel
88BuildRequires: net-snmp-utils
89BuildRequires: net-tools
90BuildRequires: ntp
91BuildRequires: openldap-devel
92BuildRequires: openssh-clients
93BuildRequires: openssl-devel
94BuildRequires: postgresql-devel
95BuildRequires: procps
96BuildRequires: samba-client
97BuildRequires: /usr/bin/mailq
98%endif
22 99
23 100
24%description 101%description
@@ -37,38 +114,79 @@ contains those plugins.
37 114
38 115
39%build 116%build
40./configure \ 117%{?isaix: MAKE=gmake} ./configure \
41--prefix=%{_prefix} \ 118--prefix=%{_prefix} \
42--exec-prefix=%{_exec_prefix} \ 119--exec-prefix=%{_exec_prefix} \
43--libexecdir=%{_exec_prefix}/lib/nagios/plugins \ 120--libexecdir=%{_libexecdir} \
44--sysconfdir=%{_sysconfdir}/nagios \ 121--sysconfdir=%{_sysconfdir} \
45--datadir=%{_datadir} \ 122--datadir=%{_datadir} \
46--with-cgiurl=/nagios/cgi-bin 123--with-cgiurl=/nagios/cgi-bin
124ls -1 %{npdir}/plugins > %{npdir}/ls-plugins-before
125ls -1 %{npdir}/plugins-root > %{npdir}/ls-plugins-root-before
126ls -1 %{npdir}/plugins-scripts > %{npdir}/ls-plugins-scripts-before
47make %{?_smp_mflags} 127make %{?_smp_mflags}
48 128ls -1 %{npdir}/plugins > %{npdir}/ls-plugins-after
129ls -1 %{npdir}/plugins-root > %{npdir}/ls-plugins-root-after
130ls -1 %{npdir}/plugins-scripts > %{npdir}/ls-plugins-scripts-after
131
132%pre
133# Create `nagios' group on the system if necessary
134%if %{isaix}
135lsgroup %{npgrp} > /dev/null 2> /dev/null
136if [ $? -eq 2 ] ; then
137 mkgroup %{npgrp} || %nnmmsg Unexpected error adding group "%{npgrp}". Aborting install process.
138fi
139%endif
140%if %{islinux}
141getent group %{npgrp} > /dev/null 2> /dev/null
142if [ $? -ne 0 ] ; then
143 groupadd %{npgrp} || %nnmmsg Unexpected error adding group "%{npgrp}". Aborting install process.
144fi
145%endif
146
147# Create `nagios' user on the system if necessary
148%if %{isaix}
149lsuser %{npusr} > /dev/null 2> /dev/null
150if [ $? -eq 2 ] ; then
151 useradd -d %{nphome} -c "%{npusr}" -g %{npgrp} %{npusr} || \
152 %nnmmsg Unexpected error adding user "%{npusr}". Aborting install process.
153fi
154%endif
155%if %{islinux}
156getent passwd %{npusr} > /dev/null 2> /dev/null
157if [ $? -ne 0 ] ; then
158 useradd -r -d %{nshome} -c "%{npusr}" -g %{npgrp} %{npusr} || \
159 %nnmmsg Unexpected error adding user "%{npusr}". Aborting install process.
160fi
161%endif
49 162
50%install 163%install
51rm -rf $RPM_BUILD_ROOT 164rm -rf $RPM_BUILD_ROOT
52make AM_INSTALL_PROGRAM_FLAGS="" DESTDIR=${RPM_BUILD_ROOT} install 165make AM_INSTALL_PROGRAM_FLAGS="" DESTDIR=${RPM_BUILD_ROOT} install
53install -d ${RPM_BUILD_ROOT}/etc/nagios 166build-aux/install-sh -c -d ${RPM_BUILD_ROOT}%{_sysconfdir}
54install -m 664 command.cfg ${RPM_BUILD_ROOT}/etc/nagios 167build-aux/install-sh -c -m 664 command.cfg ${RPM_BUILD_ROOT}%{_sysconfdir}
55%find_lang %{name} 168%find_lang %{name}
56 169echo "%defattr(755,%{npusr},%{npgrp})" >> %{name}.lang
170comm -13 %{npdir}/ls-plugins-before %{npdir}/ls-plugins-after | egrep -v "\.o$|^\." | gawk -v libexecdir=%{_libexecdir} '{printf( "%s/%s\n", libexecdir, $0);}' >> %{name}.lang
171echo "%defattr(755,root,root)" >> %{name}.lang
172comm -13 %{npdir}/ls-plugins-root-before %{npdir}/ls-plugins-root-after | egrep -v "\.o$|^\." | gawk -v libexecdir=%{_libexecdir} '{printf( "%s/%s\n", libexecdir, $0);}' >> %{name}.lang
173echo "%defattr(755,%{npusr},%{npgrp})" >> %{name}.lang
174comm -13 %{npdir}/ls-plugins-scripts-before %{npdir}/ls-plugins-scripts-after | egrep -v "\.o$|^\." | gawk -v libexecdir=%{_libexecdir} '{printf( "%s/%s\n", libexecdir, $0);}' >> %{name}.lang
175echo "%{_libexecdir}/utils.pm" >> %{name}.lang
176echo "%{_libexecdir}/utils.sh" >> %{name}.lang
57 177
58%clean 178%clean
59rm -rf $RPM_BUILD_ROOT 179rm -rf $RPM_BUILD_ROOT
60 180
61 181
62%files -f %{name}.lang 182%files -f %{name}.lang
63%defattr(-,root,root) 183%config(missingok,noreplace) %{_sysconfdir}/command.cfg
64%config(missingok,noreplace) /etc/nagios/command.cfg
65%doc CODING COPYING FAQ INSTALL LEGAL README REQUIREMENTS SUPPORT THANKS 184%doc CODING COPYING FAQ INSTALL LEGAL README REQUIREMENTS SUPPORT THANKS
66%doc ChangeLog command.cfg 185%doc ChangeLog command.cfg
67%defattr(775,root,root) 186%if ! %{isaix}
68%dir %{_exec_prefix}/lib/nagios/plugins
69%{_datadir}/locale/de/LC_MESSAGES/nagios-plugins.mo 187%{_datadir}/locale/de/LC_MESSAGES/nagios-plugins.mo
70%{_datadir}/locale/fr/LC_MESSAGES/nagios-plugins.mo 188%{_datadir}/locale/fr/LC_MESSAGES/nagios-plugins.mo
71%{_exec_prefix}/lib/nagios/plugins 189%endif
72 190
73%changelog 191%changelog
74* Mon May 23 2005 Sean Finney <seanius@seanius.net> - cvs head 192* Mon May 23 2005 Sean Finney <seanius@seanius.net> - cvs head