]> granicus.if.org Git - icinga2/blob - icinga2.spec
Add missing files in the spec file.
[icinga2] / icinga2.spec
1 #/******************************************************************************
2 # * Icinga 2                                                                   *
3 # * Copyright (C) 2012-2014 Icinga Development Team (http://www.icinga.org)    *
4 # *                                                                            *
5 # * This program is free software; you can redistribute it and/or              *
6 # * modify it under the terms of the GNU General Public License                *
7 # * as published by the Free Software Foundation; either version 2             *
8 # * of the License, or (at your option) any later version.                     *
9 # *                                                                            *
10 # * This program is distributed in the hope that it will be useful,            *
11 # * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
12 # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
13 # * GNU General Public License for more details.                               *
14 # *                                                                            *
15 # * You should have received a copy of the GNU General Public License          *
16 # * along with this program; if not, write to the Free Software Foundation     *
17 # * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
18 # ******************************************************************************/
19
20 %define revision 1
21
22 %if "%{_vendor}" == "redhat"
23 %define el5_boost_version 141
24 %define el5_boost_libs %{_libdir}/boost%{el5_boost_version}
25 %define el5_boost_includes /usr/include/boost%{el5_boost_version}
26 %define apachename httpd
27 %define apacheconfdir %{_sysconfdir}/httpd/conf.d
28 %define apacheuser apache
29 %define apachegroup apache
30 %endif
31 %if "%{_vendor}" == "suse"
32 # opensuse 13
33 %if 0%{?suse_version} >= 1310
34 %define opensuse_boost_version 1_53_0
35 %else
36 %define opensuse_boost_version 1_49_0
37 %endif
38 %define sles_boost_version 1_54_0
39 %define apachename apache2
40 %define apacheconfdir  %{_sysconfdir}/apache2/conf.d
41 %define apacheuser wwwrun
42 %define apachegroup www
43 %endif
44
45 %define icinga_user icinga
46 %define icinga_group icinga
47 %define icingacmd_group icingacmd
48 %define icingaweb2name icingaweb2
49 %define icingaweb2version 2.0.0
50
51 %define icingaclassicconfdir %{_sysconfdir}/icinga
52
53 %define logmsg logger -t %{name}/rpm
54
55 Summary: Network monitoring application
56 Name: icinga2
57 Version: 0.0.9
58 Release: %{revision}%{?dist}
59 License: GPLv2+
60 Group: Applications/System
61 Source: %{name}-%{version}.tar.gz
62 URL: http://www.icinga.org/
63 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
64
65 Requires: %{name}-bin = %{version}
66 #Requires: %{name}-ido-mysql = %{version}
67 #Requires: %{icingaweb2name} >= %{icingaweb2version}
68
69 %description
70 Meta package for Icinga 2 Core, DB IDO and Web.
71
72 %package bin
73 Summary:      Icinga 2 binaries and libraries
74 Group:        Applications/System
75
76 BuildRequires: doxygen
77 BuildRequires: pandoc
78 BuildRequires: python-sphinx
79 BuildRequires: openssl-devel
80 BuildRequires: gcc-c++
81 BuildRequires: libstdc++-devel
82 BuildRequires: cmake
83 BuildRequires: flex >= 2.5.35
84 BuildRequires: bison
85
86 # redhat
87 %if "%{_vendor}" == "redhat"
88 %if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5"
89 # el5 requires EPEL
90 BuildRequires: boost%{el5_boost_version}-devel
91 BuildRequires: boost%{el5_boost_version}
92 Requires: boost%{el5_boost_version}-program-options
93 Requires: boost%{el5_boost_version}-system
94 Requires: boost%{el5_boost_version}-test
95 Requires: boost%{el5_boost_version}-thread
96 Requires: boost%{el5_boost_version}-regex
97 %else
98 BuildRequires: boost-devel >= 1.41
99 Requires: boost-program-options >= 1.41
100 Requires: boost-system >= 1.41
101 Requires: boost-test >= 1.41
102 Requires: boost-thread >= 1.41
103 Requires: boost-regex >= 1.41
104 %endif
105 %endif
106 #redhat
107
108 # suse
109 %if "%{_vendor}" == "suse"
110 # sles
111 # note: sles_version macro is not set in SLES11 anymore
112 # note: sles service packs are not under version control
113 %if 0%{?suse_version} == 1110
114 BuildRequires: gcc-fortran
115 BuildRequires: libgfortran43
116 BuildRequires: boost-license%{sles_boost_version}
117 BuildRequires: boost-devel >= 1.41
118 Requires: boost-license%{sles_boost_version}
119 Requires: libboost_program_options%{sles_boost_version}
120 Requires: libboost_system%{sles_boost_version}
121 Requires: libboost_test%{sles_boost_version}
122 Requires: libboost_thread%{sles_boost_version}
123 Requires: libboost_regex%{sles_boost_version}
124 %endif
125 # opensuse
126 %if 0%{?suse_version} >= 1210
127 BuildRequires: boost-devel >= 1.41
128 Requires: libboost_program_options%{opensuse_boost_version}
129 Requires: libboost_system%{opensuse_boost_version}
130 Requires: libboost_test%{opensuse_boost_version}
131 Requires: libboost_thread%{opensuse_boost_version}
132 Requires: libboost_regex%{opensuse_boost_version}
133 %endif
134 %endif
135 # suse
136
137 Requires: %{name}-common = %{version}
138
139 %description bin
140 Icinga 2 is a general-purpose network monitoring application.
141 Provides binaries and libraries for Icinga 2 Core.
142
143 %package common
144 Summary:      Common Icinga 2 configuration
145 Group:        Applications/System
146 %if "%{_vendor}" == "redhat"
147 Requires(pre): shadow-utils
148 Requires(post): shadow-utils
149 %endif
150
151 %description common
152 Provides common directories, uid and gid among Icinga 2 related
153 packages.
154
155
156 %package doc
157 Summary:      Documentation for Icinga 2
158 Group:        Applications/System
159 Requires:     %{name} = %{version}-%{release}
160
161 %description doc
162 Documentation for Icinga 2
163
164
165 %package ido-mysql
166 Summary:      IDO MySQL database backend for Icinga 2
167 Group:        Applications/System
168 %if "%{_vendor}" == "suse"
169 BuildRequires: libmysqlclient-devel
170 %if 0%{?suse_version} >= 1210
171 Requires: libmysqlclient18
172 %else
173 Requires: libmysqlclient15
174 %endif
175 %endif
176 %if "%{_vendor}" == "redhat"
177 # el5 only provides mysql package
178 %if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5"
179 BuildRequires: mysql
180 %else
181 BuildRequires: mysql-libs
182 BuildRequires: mysql
183 %endif
184 BuildRequires: mysql-devel
185 Requires: mysql
186 %endif
187 Requires: %{name} = %{version}-%{release}
188
189 %description ido-mysql
190 Icinga 2 IDO mysql database backend. Compatible with Icinga 1.x
191 IDOUtils schema >= 1.10
192
193
194 %package ido-pgsql
195 Summary:      IDO PostgreSQL database backend for Icinga 2
196 Group:        Applications/System
197 %if "%{_vendor}" == "suse"
198 BuildRequires: postgresql-libs
199 %endif
200 %if "%{_vendor}" == "redhat"
201 # el5 only provides mysql package
202 %if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5"
203 BuildRequires: postgresql84
204 %endif
205 %endif
206 BuildRequires: postgresql-devel
207 Requires: postgresql-libs
208 Requires: %{name} = %{version}-%{release}
209
210 %description ido-pgsql
211 Icinga 2 IDO PostgreSQL database backend. Compatible with Icinga 1.x
212 IDOUtils schema >= 1.10
213
214
215 %package classicui-config
216 Summary:      Icinga 2 Classic UI Standalone configuration
217 Group:        Applications/System
218 BuildRequires: %{apachename}
219 Requires:     %{apachename}
220 Requires:     %{name} = %{version}-%{release}
221 Provides:     icinga-classicui-config
222 Conflicts:    icinga-gui-config
223
224 %description classicui-config
225 Icinga 1.x Classic UI Standalone configuration with locations
226 for Icinga 2.
227
228
229 %prep
230 %setup -q -n %{name}-%{version}
231
232 %build
233 CMAKE_OPTS="-DCMAKE_INSTALL_PREFIX=/usr \
234          -DCMAKE_INSTALL_SYSCONFDIR=/etc \
235                  -DCMAKE_INSTALL_LOCALSTATEDIR=/var \
236          -DCMAKE_BUILD_TYPE=RelWithDebInfo \
237          -DICINGA2_USER=%{icinga_user} \
238          -DICINGA2_GROUP=%{icinga_group} \
239              -DICINGA2_COMMAND_USER=%{icinga_user} \
240              -DICINGA2_COMMAND_GROUP=%{icingacmd_group}"
241 %if "%{_vendor}" == "redhat"
242 %if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5"
243 # Boost_VERSION 1.41.0 vs 101400 - disable build tests
244 # details in https://dev.icinga.org/issues/5033
245 CMAKE_OPTS="$CMAKE_OPTS -DBOOST_LIBRARYDIR=/usr/lib/boost141 \
246  -DBOOST_INCLUDEDIR=/usr/include/boost141 \
247  -DBoost_ADDITIONAL_VERSIONS='1.41;1.41.0' \
248  -DBoost_NO_SYSTEM_PATHS=TRUE \
249  -DBUILD_TESTING=FALSE \
250  -DBoost_NO_BOOST_CMAKE=TRUE"
251 %endif
252 %endif
253
254 cmake $CMAKE_OPTS .
255
256 make %{?_smp_mflags}
257
258 %install
259 [ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot}
260 make install \
261         DESTDIR="%{buildroot}"
262
263 # install classicui config
264 install -D -m 0644 etc/icinga/icinga-classic.htpasswd %{buildroot}%{icingaclassicconfdir}/passwd
265 install -D -m 0644 etc/icinga/cgi.cfg %{buildroot}%{icingaclassicconfdir}/cgi.cfg
266 install -D -m 0644 etc/icinga/icinga-classic-apache.conf %{buildroot}%{apacheconfdir}/icinga.conf
267
268 # fix plugin path on x64
269 %if "%{_vendor}" != "suse"
270 sed -i 's@PluginDir = .*@PluginDir = "%{_libdir}/nagios/plugins"@' %{buildroot}/%{_sysconfdir}/%{name}/constants.conf
271 %endif
272
273 # remove features-enabled symlinks
274 rm -f %{buildroot}/%{_sysconfdir}/%{name}/features-enabled/*.conf
275
276 %clean
277 [ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot}
278
279 %pre common
280 getent group %{icinga_group} >/dev/null || %{_sbindir}/groupadd -r %{icinga_group}
281 getent group %{icingacmd_group} >/dev/null || %{_sbindir}/groupadd -r %{icingacmd_group}
282 getent passwd %{icinga_user} >/dev/null || %{_sbindir}/useradd -c "icinga" -s /sbin/nologin -r -d %{_localstatedir}/spool/%{name} -G %{icingacmd_group} -g %{icinga_group} %{icinga_user}
283 exit 0
284
285 # suse
286 %if 0%{?suse_version}
287 %post
288 %{fillup_and_insserv icinga2}
289
290 if [ ${1:-0} -eq 1 ]
291 then
292         # initial installation, enable default features
293         %{_sbindir}/icinga2-enable-feature checker
294         %{_sbindir}/icinga2-enable-feature notification
295         %{_sbindir}/icinga2-enable-feature mainlog
296 fi
297
298 exit 0
299 %postun
300 %restart_on_update icinga2
301 %insserv_cleanup
302
303 if [ "$1" = "0" ]; then
304         # deinstallation of the package - remove enabled features
305         rm -rf %{_sysconfdir}/%{name}/features-enabled
306 fi
307
308 exit 0
309
310 %preun
311 %stop_on_removal icinga2
312
313 # rhel
314 %else
315
316 %post
317 /sbin/chkconfig --add icinga2
318
319 if [ ${1:-0} -eq 1 ]
320 then
321         # initial installation, enable default features
322         %{_sbindir}/icinga2-enable-feature checker
323         %{_sbindir}/icinga2-enable-feature notification
324         %{_sbindir}/icinga2-enable-feature mainlog
325 fi
326
327 exit 0
328
329 %postun
330 if [ "$1" -ge  "1" ]; then
331         /sbin/service icinga2 condrestart >/dev/null 2>&1 || :
332 fi
333
334 if [ "$1" = "0" ]; then
335         # deinstallation of the package - remove enabled features
336         rm -rf %{_sysconfdir}/%{name}/features-enabled
337 fi
338
339 exit 0
340 %preun
341 if [ "$1" = "0" ]; then
342         /sbin/service icinga2 stop > /dev/null 2>&1
343         /sbin/chkconfig --del icinga2
344 fi
345
346 %endif
347 # suse/rhel
348
349 %post ido-mysql
350 if [ ${1:-0} -eq 1 ]
351 then
352         # initial installation, enable ido-mysql feature
353         %{_sbindir}/icinga2-enable-feature ido-mysql
354 fi
355
356 exit 0
357
358 %postun ido-mysql
359 if [ "$1" = "0" ]; then
360         # deinstallation of the package - remove feature
361         test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature ido-mysql
362 fi
363
364 exit 0
365
366 %post ido-pgsql
367 if [ ${1:-0} -eq 1 ]
368 then
369         # initial installation, enable ido-pgsql feature
370         %{_sbindir}/icinga2-enable-feature ido-pgsql
371 fi
372
373 exit 0
374
375 %postun ido-pgsql
376 if [ "$1" = "0" ]; then
377         # deinstallation of the package - remove feature
378         test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature ido-pgsql
379 fi
380
381 exit 0
382
383 %post classicui-config
384 if [ ${1:-0} -eq 1 ]
385 then
386         # initial installation, enable features
387         %{_sbindir}/icinga2-enable-feature statusdata
388         %{_sbindir}/icinga2-enable-feature compatlog
389         %{_sbindir}/icinga2-enable-feature command
390 fi
391
392 exit 0
393
394 %postun classicui-config
395 if [ "$1" = "0" ]; then
396         # deinstallation of the package - remove feature
397         test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature statusdata
398         test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature compatlog
399         test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature command
400 fi
401
402 exit 0
403
404 %files
405
406 %files bin
407 %defattr(-,root,root,-)
408 %doc COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog
409 %attr(755,-,-) %{_sysconfdir}/init.d/%{name}
410 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}
411 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/conf.d
412 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/conf.d/hosts
413 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/conf.d/hosts/localhost
414 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/features-available
415 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/features-enabled
416 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/scripts
417 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/%{name}.conf
418 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/constants.conf
419 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/conf.d/*.conf
420 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/conf.d/hosts/*.conf
421 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/conf.d/hosts/localhost/*.conf
422 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-available/*.conf
423 %config(noreplace) %{_sysconfdir}/%{name}/scripts/*
424 %{_sbindir}/%{name}
425 %{_bindir}/%{name}-migrate-config
426 %{_bindir}/%{name}-build-ca
427 %{_bindir}/%{name}-build-key
428 %{_bindir}/%{name}-sign-key
429 %{_sbindir}/%{name}-enable-feature
430 %{_sbindir}/%{name}-disable-feature
431 %{_sbindir}/%{name}-setup-agent
432 %{_sbindir}/%{name}-discover-agent
433 %{_sbindir}/%{name}-forget-agent
434 %{_sbindir}/%{name}-list-agents
435 %exclude %{_libdir}/%{name}/libdb_ido_mysql*
436 %exclude %{_libdir}/%{name}/libdb_ido_pgsql*
437 %{_libdir}/%{name}
438 %{_datadir}/%{name}
439 %exclude %{_datadir}/%{name}/itl
440 %{_mandir}/man8/%{name}.8.gz
441
442 %attr(0755,%{icinga_user},%{icinga_group}) %{_localstatedir}/cache/%{name}
443 %attr(0755,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/log/%{name}
444 %attr(0755,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/log/%{name}/compat
445 %attr(0755,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/log/%{name}/compat/archives
446 %attr(0755,%{icinga_user},%{icinga_group}) %ghost %{_localstatedir}/run/%{name}
447 %attr(0750,%{icinga_user},%{icinga_group}) %{_localstatedir}/lib/%{name}
448
449 %attr(2755,%{icinga_user},%{icingacmd_group}) %ghost %{_localstatedir}/run/icinga2/cmd
450
451 %files common
452 %defattr(-,root,root,-)
453 %doc COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog
454 %attr(755,-,-) %{_sysconfdir}/logrotate.d/%{name}
455 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}
456 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}/perfdata
457 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}/tmp
458 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_datadir}/%{name}/itl
459 %{_datadir}/%{name}/itl
460
461 %files doc
462 %defattr(-,root,root,-)
463 %doc COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog
464 %{_datadir}/doc/%{name}
465 %docdir %{_datadir}/doc/%{name}
466
467 %files ido-mysql
468 %defattr(-,root,root,-)
469 %doc components/db_ido_mysql/schema COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog
470 %{_libdir}/%{name}/libdb_ido_mysql*
471
472 %files ido-pgsql
473 %defattr(-,root,root,-)
474 %doc components/db_ido_pgsql/schema COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog
475 %{_libdir}/%{name}/libdb_ido_pgsql*
476
477 %files classicui-config
478 %defattr(-,root,root,-)
479 %attr(0751,%{icinga_user},%{icinga_group}) %dir %{icingaclassicconfdir}
480 %config(noreplace) %{icingaclassicconfdir}/cgi.cfg
481 %config(noreplace) %{apacheconfdir}/icinga.conf
482 %config(noreplace) %attr(0640,root,%{apachegroup}) %{icingaclassicconfdir}/passwd
483
484
485 %changelog