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