File nsca-ng.spec of Package nsca-ng

#
# spec file for package nsca-ng
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name:           nsca-ng
Version:        1.6
Release:        0
Summary:        A modern replacement for NSCA
License:        BSD-2-Clause
Group:          System/Monitoring
URL:            https://github.com/weiss/nsca-ng
Source:         https://github.com/weiss/nsca-ng/releases/download/v%{version}/nsca-ng-%{version}.tar.gz
Source1:        series
Patch:          cleanup-systemd-unit.patch
BuildRequires:  nagios-rpm-macros
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(libconfuse)
BuildRequires:  pkgconfig(libcrypto) >= 1.0.0
BuildRequires:  pkgconfig(libev)
BuildRequires:  pkgconfig(libsystemd)

%description
The NSCA-ng package provides a client-server pair which makes the "Nagios
command file" accessible to remote systems.  This allows for submitting
passive check results, downtimes, and many other commands to Nagios (or
compatible monitoring solutions).

NSCA-ng supports TLS encryption and shared-secret authentication with
client-specific passwords (based on RFC 4279), as well as fine-grained
authorization control.

%package server
Summary:        NSCA-ng server
Group:          System/Monitoring
Provides:       nsca = 3.0
Obsoletes:      nsca < 2.9
%{?systemd_ordering}

%description server
NSCA-ng provides a client-server pair that makes the Nagios command file accessible to remote systems.

This is the server component of NSCA-ng.

%package client
Summary:        NSCA-ng client
Group:          System/Monitoring
Provides:       nsca-client = 3.0
Obsoletes:      nsca-client < 2.9

%description client
NSCA-ng provides a client-server pair that makes the Nagios command file accessible to remote systems.

This is the client component of NSCA-ng.

%prep
%autosetup -p1

%build
export CFLAGS="%{optflags} -fno-strict-aliasing"
%configure \
    --enable-server \
    --with-systemd=%{_prefix} \
    --disable-silent-rules
make %{?_smp_mflags}

%check
pushd tests
make %{?_smp_mflags} check-local
popd

%install
%make_install
install -D -m 0644 etc/%{name}.service %{buildroot}%{_unitdir}/%{name}.service
install -D -m 0644 etc/%{name}.socket  %{buildroot}%{_unitdir}/%{name}.socket
ln -s -f %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}

%pre client
# Create user and group on the system if necessary
%nagios_user_group_add
%nagios_command_user_group_add

%pre server
# Create user and group on the system if necessary
%nagios_user_group_add
%nagios_command_user_group_add

%service_add_pre %{name}.service %{name}.socket

%preun server
%service_del_preun %{name}.service %{name}.socket

%post server
%service_add_post %{name}.service %{name}.socket

%postun server
%service_del_postun %{name}.service %{name}.socket

%files server
%license COPYING
%doc ChangeLog README
%config(noreplace) %attr(0640,root,%{nagios_group}) %{_sysconfdir}/nsca-ng.cfg
%{_sbindir}/nsca-ng
%{_mandir}/man5/nsca-ng.cfg.5*
%{_mandir}/man8/nsca-ng.8*
%{_unitdir}/%{name}.service
%{_unitdir}/%{name}.socket
%{_sbindir}/rc%{name}

%files client
%config(noreplace) %attr(0640,root,%{nagios_group}) %{_sysconfdir}/send_nsca.cfg
%{_sbindir}/send_nsca
%{_mandir}/man5/send_nsca.cfg.5*
%{_mandir}/man8/send_nsca.8*

%changelog
openSUSE Build Service is sponsored by