-
Notifications
You must be signed in to change notification settings - Fork 30
/
naemon-livestatus.spec
118 lines (100 loc) · 2.82 KB
/
naemon-livestatus.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
Summary: Naemon Livestatus Eventbroker Module
Name: naemon-livestatus
Version: 1.4.2
Release: 0
License: GPL-2.0-only
Group: Applications/System
URL: https://www.naemon.io/
Packager: Naemon Core Development Team <[email protected]>
Vendor: Naemon Core Development Team
Source0: http://labs.consol.de/naemon/download/naemon-livestatus-%{version}.tar.gz
BuildRoot: %{_tmppath}/naemon-%{version}-%{release}
BuildRequires: naemon-devel
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libtool
BuildRequires: gcc-c++
%if 0%{?el8}
BuildRequires: gdb-headless
%endif
%description
Naemon-livestatus is an eventbroker module for naemon which allows
external programs to use the running Nagios daemon as a specialized
database.
%prep
%setup -q
%build
test -f configure || ./autogen.sh
%configure \
--libdir="%{_libdir}/naemon" \
--with-naemon-config-dir="/etc/naemon/module-conf.d"
%{__make}
%install
%{__rm} -rf %{buildroot}
%{__make} install DESTDIR="%{buildroot}"
# We don't really want to distribute this
rm -f %{buildroot}%{_libdir}/naemon/naemon-livestatus/livestatus.la
install -d %{buildroot}%{_localstatedir}/log/naemon
%clean
%{__rm} -rf %{buildroot}
%post
case "$*" in
2)
# Upgrading so try and restart if already running
if [ -e /etc/naemon/naemon.cfg ]; then
# livestatus configuration has been moved to single drop dir file
sed -i /etc/naemon/naemon.cfg -e 's~^\s*\(broker_module=/usr/lib[0-9]*/naemon/naemon-livestatus/livestatus.so.*\)~#\1~'
fi
;;
1)
# First installation, no acton required
:
;;
*) echo case "$*" not handled in postun
esac
%if 0%{?use_systemd}
systemctl condrestart naemon.service
%else
/etc/init.d/naemon condrestart &>/dev/null || :
%endif
exit 0
%preun
case "$*" in
0)
# POSTUN
rm -f /var/log/naemon/livestatus.log
;;
1)
# POSTUPDATE
;;
*) echo case "$*" not handled in postun
esac
exit 0
%postun
case "$*" in
0)
# POSTUN
if [ -e /etc/naemon/naemon.cfg ]; then
sed -i /etc/naemon/naemon.cfg -e 's~^\s*\(broker_module=/usr/lib[0-9]*/naemon/naemon-livestatus/livestatus.so.*\)~#\1~'
fi
rm -f /var/cache/naemon/live
;;
1)
# POSTUPDATE
;;
*) echo case "$*" not handled in postun
esac
exit 0
%files
%attr(0755,root,root) %{_bindir}/unixcat
%attr(0755,naemon,naemon) %dir %{_libdir}/naemon/naemon-livestatus
%attr(0644,root,root) %{_libdir}/naemon/naemon-livestatus/livestatus.so
%attr(0755,naemon,naemon) %dir %{_localstatedir}/log/naemon
%if 0%{?suse_version} >= 1315
%attr(0755,naemon,naemon) %dir %{_sysconfdir}/naemon/
%attr(0755,naemon,naemon) %dir %{_sysconfdir}/naemon/module-conf.d/
%endif
%attr(0644,naemon,naemon) %config(noreplace) %{_sysconfdir}/naemon/module-conf.d/livestatus.cfg
%changelog
* Tue Sep 19 2017 Sven Nierlein <[email protected]> 1.0.7-1
- Decouple core and livestatus