]> git.pld-linux.org Git - packages/nagios-nrpe.git/blob - nagios-nrpe.spec
- missing user homedir, better upgrade of netsaint-nrpe support, rel. 2
[packages/nagios-nrpe.git] / nagios-nrpe.spec
1 %define         nsusr           nagios
2 %define         nsgrp           nagios
3 Summary:        Nagios remote plugin execution service/plugin
4 Summary(pl):    Demon i wtyczka zdalnego wywo³ywania wtyczek Nagios
5 Name:           nagios-nrpe
6 Version:        2.0
7 Release:        2
8 License:        GPL v2
9 Group:          Networking
10 Source0:        http://dl.sourceforge.net/nagios/nrpe-%{version}.tar.gz
11 # Source0-md5:  70ef9502a3b7e49fa520dbceabfa04d0
12 Source1:        nrpe.init
13 URL:            http://www.nagios.org/
14 BuildRequires:  autoconf
15 BuildRequires:  automake
16 BuildRequires:  rpmbuild(macros) >= 1.159
17 Requires(pre):  /usr/bin/getgid
18 Requires(pre):  /bin/id
19 Requires(pre):  /usr/sbin/groupadd
20 Requires(pre):  /usr/sbin/useradd
21 Requires(post,postun):  /sbin/chkconfig
22 Requires:       nagios-plugins
23 Provides:       group(%{nsgrp})
24 Provides:       user(%{nsusr})
25 Obsoletes:      netsaint-nrpe
26 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
27
28 %define         _sysconfdir     /etc/nagios
29 %define         _datadir        %{_prefix}/share/%{name}
30 %define         _plugindir      %{_libdir}/nagios/plugins
31 %define         _localstatedir  %{_var}/log/nagios
32 %define         nsport          5666
33
34 %description
35 Nagios nrpe allows you to remotely execute plugins on other hosts
36 and report the plugin output back to the monitoring host.
37
38 %description -l pl
39 Nagios npre pozwala zdalnie uruchamiaæ wtyczki na innych hostach,
40 a wynik ich dzia³ania zwracaæ spowrotem do hosta monitoruj±cego.
41
42 %package plugin
43 Summary:        check_nrpe plugin for Nagios
44 Summary(pl):    Wtyczka check_nrpe dla Nagiosa
45 Group:          Networking
46
47 %description plugin
48 check_nrpe plugin for Nagios. This plugin allows running plugins on
49 remote machines using nrpe service.
50
51 %description plugin -l pl
52 Wtyczka check_nrpe dla Nagiosa. Pozwala na zdalne uruchamianie
53 wtyczek na innych komputerach za pomoc± demona nrpe.
54
55 %prep
56 %setup -q -n nrpe-%{version}
57
58 %build
59 %{__aclocal}
60 %{__autoconf}
61
62 %configure \
63         --with-init-dir=/etc/rc.d/init.d \
64         --with-nrpe-port=%{nsport} \
65         --with-nrpe-user=%{nsusr} \
66         --with-nrpe-grp=%{nsgrp} \
67         --prefix=%{_prefix} \
68         --exec-prefix=%{_sbindir} \
69         --bindir=%{_sbindir} \
70         --libexecdir=%{_plugindir} \
71         --datadir=%{_prefix}/share/nagios \
72         --sysconfdir=%{_sysconfdir} \
73         --localstatedir=%{_localstatedir} 
74
75 %{__make} all
76
77 %install
78 rm -rf $RPM_BUILD_ROOT
79 install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,%{_sysconfdir},%{_libdir}/nagios/plugins,%{_sbindir}} \
80         $RPM_BUILD_ROOT%{_localstatedir}
81
82 install nrpe.cfg $RPM_BUILD_ROOT/etc/nagios/nrpe.cfg
83 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/nrpe
84 install src/nrpe $RPM_BUILD_ROOT%{_sbindir}
85 install src/check_nrpe $RPM_BUILD_ROOT%{_plugindir}
86
87 %clean
88 rm -rf $RPM_BUILD_ROOT
89
90 %pre
91 if [ -n "`getgid %{nsgrp}`" ]; then
92         if [ "`getgid %{nsgrp}`" != "72" ]; then
93                 echo "Error: group %{nsgrp} doesn't have gid=72. Correct this before installing %{name}." 1>&2
94                 exit 1
95         fi
96 else
97         if [ -n "`getgid netsaint`" -a "`getgid netsaint`" = "72" ]; then
98                 /usr/sbin/groupmod -n %{nsgrp} netsaint
99         else
100                 /usr/sbin/groupadd -g 72 -f %{nsgrp}
101         fi
102 fi
103 if [ -n "`id -u %{nsusr} 2>/dev/null`" ]; then
104         if [ "`id -u %{nsusr}`" != "72" ]; then
105                 echo "Error: user %{nsusr} doesn't have uid=72. Correct this before installing %{name}." 1>&2
106                 exit 1
107         fi
108 else
109         if [ -n "`id -u netsaint 2>/dev/null`" -a "`id -u netsaint`" = "72" ]; then
110                 /usr/sbin/usermod -d /tmp -l %{nsusr} netsaint
111         else
112                 /usr/sbin/useradd -u 72 -d %{_libdir}/%{nsusr} -s /bin/false -c "%{name} User" -g %{nsgrp} %{nsusr} 1>&2
113         fi
114 fi
115
116 %post
117 /sbin/chkconfig --add %{name}
118 if [ -f /var/lock/subsys/%{name} ]; then
119         /etc/rc.d/init.d/%{name} restart 1>&2
120 fi
121
122 %preun
123 if [ "$1" = "0" ] ; then
124         if [ -f /var/lock/subsys/%{name} ]; then
125                 /etc/rc.d/init.d/%{name} stop 1>&2
126         fi
127         /sbin/chkconfig --del %{name}
128 fi
129
130 %postun
131 if [ "$1" = "0" ]; then
132         %userremove %{nsusr}
133         %groupremove %{nsgrp}
134 fi
135
136 %files
137 %defattr(644,root,root,755)
138 %doc Changelog LEGAL README* SECURITY
139 %attr(754,root,root) /etc/rc.d/init.d/%{name}
140 %attr(751,root,%{nsgrp}) %dir %{_sysconfdir}
141 %attr(644,root,%{nsgrp}) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nrpe.cfg
142 %attr(755,root,root) %{_sbindir}/nrpe
143 %dir %{_libdir}/nagios
144
145 %files plugin
146 %defattr(644,root,root,755)
147 %dir %{_plugindir}
148 %attr(755,root,root) %{_plugindir}/*
This page took 0.041654 seconds and 4 git commands to generate.