File nagircbot.spec of Package nagircbot

#
# spec file for package nagircbot
#
# 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.

#Compat macro for new _fillupdir macro introduced in Nov 2017
%if ! %{defined _fillupdir}
  %define _fillupdir /var/adm/fillup-templates
%endif

Name:           nagircbot
Summary:        Announces the Nagios status on an IRC channel
Version:        0.0.33
Release:        1
Url:            http://www.vanheusden.com/nagircbot/
License:        GPLv2 or any later
Group:          System/Monitoring
Source0:        http://www.vanheusden.com/nagircbot/%{name}-%{version}.tgz
Source1:        %{name}.1
Source2:        rcnagircbot
Source3:        sysconfig.nagircbot
Patch0:         nagircbot-nodebug.patch
PreReq:         %fillup_prereq %insserv_prereq
BuildRequires:  gcc-c++
BuildRequires:  openssl-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Type:
./nagircbot -h
for a list of options.

Send a private message to nagircbot for:
 - 'statistics' - returns the number criticals/warnings/etc
 - 'reload' - force reloads the nagios status. use this when you altered the
   nagios configuration
 - 'check' - check if nagios is still running
 - 'resend' - resends the problems
 - 'help' - returns the possible commands

%prep
%setup -q
%patch0 -p0 

%build
export CXXFLAGS="%{optflags}"
%{__make} nagircbot

%install
install -Dm755 nagircbot %{buildroot}%{_bindir}/%{name}
install -Dm644 %{S:1}  %{buildroot}%{_mandir}/man1/%{name}.1
install -Dm755 %{S:2}  %{buildroot}%{_sysconfdir}/init.d/%{name}
mkdir %{buildroot}%{_sbindir}
ln -s %{_sysconfdir}/init.d/%{name} %{buildroot}%{_sbindir}/rc%{name}
install -Dm644 %{S:3} %{buildroot}%{_fillupdir}/sysconfig.%{name}

%clean
rm -rf %buildroot

%post
%fillup_and_insserv %{name}

%preun
%stop_on_removal %{name}

%postun
%restart_on_update %{name}
%insserv_cleanup

%files 
%defattr(-,root,root)
%doc license.* *.txt
%{_bindir}/%{name}
%{_sbindir}/rc%{name}
%{_sysconfdir}/init.d/%{name}
%{_mandir}/man1/%{name}.1*
%{_fillupdir}/sysconfig.%{name}

%changelog
openSUSE Build Service is sponsored by