]> git.pld-linux.org Git - SPECS.git/blob - nagios-ndoutils.spec
SPECS updated Wed 28 Jul 14:48:01 CEST 2021
[SPECS.git] / nagios-ndoutils.spec
1 # TODO
2 # - ndo2db is unable to start, if there's stale socket:
3 #   srwxr-xr-x 1 nagios nagios 0 Jan 15  2012 /var/lib/nagios/ndo.sock=
4 # - enabling with ssl fails to build due conflicting headers for pqueue_*
5 #
6 # Conditional build:
7 %bcond_with     pgsql   # build without pgsql support (does not seem to work)
8 %bcond_without  mysql   # build without mysql support
9 %bcond_with     ssl     # build without ssl support
10
11 %define         addon   ndoutils
12 Summary:        NDOUTILS (Nagios Data Output Utils) addon
13 Summary(pl.UTF-8):      Dodatek NDOUTILS (Nagios Data Output Utils)
14 Name:           nagios-%{addon}
15 Version:        2.0.0
16 Release:        2
17 License:        GPL v2
18 Group:          Networking
19 Source0:        http://downloads.sourceforge.net/nagios/%{addon}-%{version}.tar.gz
20 # Source0-md5:  93561584f0fa7582a795e795306a3b35
21 Source1:        ndo2db.init
22 Patch0:         config.patch
23 Patch1:         format-security.patch
24 URL:            http://sourceforge.net/projects/nagios/
25 %{?with_mysql:BuildRequires:    mysql-devel}
26 %{?with_ssl:BuildRequires:      openssl-devel}
27 %{?with_pgsql:BuildRequires:    postgresql-devel}
28 BuildRequires:  rpmbuild(macros) >= 1.268
29 Requires:       nagios >= 4.0
30 Requires(post,preun):   /sbin/chkconfig
31 Requires:       rc-scripts
32 Suggests:       perl-DBD-mysql
33 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
34
35 %define         _sysconfdir     /etc/nagios
36 %define         _libdir         %{_prefix}/%{_lib}/nagios
37
38 %description
39 The NDOUTILS (Nagios Data Output Utils) addon allows you to move
40 status and event information from Nagios to a database for later
41 retrieval and processing.
42
43 %description -l pl.UTF-8
44 Dodatek NDOUTILS (Nagios Data Output Utils) pozwala przenosić
45 informacje o stanie i zdarzeniach z Nagiosa do bazy danych w celu
46 późniejszego odczytu i przetwarzania.
47
48 %prep
49 %setup -q -n %{addon}-%{version}
50 %patch0 -p1
51 %patch1 -p1
52
53 # some typo ;)
54 grep -r 20052-2009 -l . | xargs sed -i -e 's,20052-2009,2005-2009,'
55
56 %build
57 %configure \
58         --bindir=%{_sbindir} \
59         --localstatedir=/var/lib/nagios \
60         --with-init-dir=/etc/rc.d/init.d \
61         %{?with_mysql:--enable-mysql} \
62         %{?with_pgsql:--enable-pgsql} \
63         %{?with_ssl:--enable-ssl} \
64         --enable-nanosleep \
65         %{nil}
66 %{__make}
67
68 %install
69 rm -rf $RPM_BUILD_ROOT
70 install -d $RPM_BUILD_ROOT{%{_libdir},%{_sysconfdir},%{_sbindir},%{_datadir}/%{addon}}
71
72 %{__make} fullinstall \
73         INSTALL_OPTS="" \
74         INIT_OPTS="" \
75         DESTDIR=$RPM_BUILD_ROOT
76
77 install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/ndo2db
78
79 mv $RPM_BUILD_ROOT{%{_sbindir},%{_libdir}}/ndomod.o
80
81 for sample in $RPM_BUILD_ROOT%{_sysconfdir}/*-sample; do
82         cfg=${sample%%-sample}
83         mv $sample $cfg
84 done
85
86 # sample line that should be added to nagios.cfg for this module to work
87 echo 'broker_module=%{_libdir}/ndomod.o config_file=%{_sysconfdir}/ndomod.cfg' \
88         > $RPM_BUILD_ROOT%{_sysconfdir}/ndomod-load.cfg
89
90 install -d $RPM_BUILD_ROOT%{_datadir}/%{addon}
91 cp -a db/* $RPM_BUILD_ROOT%{_datadir}/%{addon}
92
93 %clean
94 rm -rf $RPM_BUILD_ROOT
95
96 %post
97 /sbin/chkconfig --add ndo2db
98 %service ndo2db restart
99 %service -q nagios restart
100
101 %preun
102 if [ "$1" = "0" ]; then
103         %service -q ndo2db stop
104         /sbin/chkconfig --del ndo2db
105 fi
106
107 %files
108 %defattr(644,root,root,755)
109 %doc README REQUIREMENTS TODO UPGRADING
110 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/ndo2db.cfg
111 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/ndomod-load.cfg
112 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/ndomod.cfg
113 %attr(754,root,root) /etc/rc.d/init.d/ndo2db
114 %attr(755,root,root) %{_sbindir}/file2sock
115 %attr(755,root,root) %{_sbindir}/log2ndo
116 %attr(755,root,root) %{_sbindir}/ndo2db
117 %attr(755,root,root) %{_sbindir}/sockdebug
118 %attr(755,root,root) %{_libdir}/ndomod.o
119 %dir %{_datadir}/%{addon}
120 %{_datadir}/%{addon}/README
121 %{_datadir}/%{addon}/*.sql
122 %{_datadir}/%{addon}/queries
123 %attr(755,root,root) %{_datadir}/%{addon}/upgradedb
124 %attr(755,root,root) %{_datadir}/%{addon}/installdb
125 %attr(755,root,root) %{_datadir}/%{addon}/prepsql
This page took 0.28611 seconds and 3 git commands to generate.