File bpview.spec of Package BPView

#
# spec file for package bpview
#
# 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/
#


%define         apacheuser wwwrun
%define         apachegroup www
Name:           bpview
Version:        0.12.1
Release:        0
Summary:        Business Process view for Nagios/Icinga
Group:          System/Monitoring
License:        GPL-3.0-or-later
URL:            https://github.com/BPView/BPView
Source:         BPView-%{name}-%{version}.tar.bz2
Source1:        bpviewd
Source2:        bpview.logrotate
Source10:       bpview-rpmlintrc
Patch1:         bpview-0.12.1-Makefile.patch
BuildRequires:  autoconf
BuildRequires:  autoconf-archive
BuildRequires:  automake
BuildRequires:  libtool
BuildRequires:  perl-libwww-perl
BuildRequires:  pkgconfig
%if ! 0%{?suse_version}
BuildRequires:  selinux-policy
%endif
BuildRequires:  perl(CGI)
BuildRequires:  perl(DBD::Pg)
BuildRequires:  perl(DBI)
BuildRequires:  perl(Data::Dumper)
BuildRequires:  perl(JSON::PP)
BuildRequires:  perl(YAML::Syck)
Requires:       apache2-mod_fcgid
Requires:       logrotate
Requires:       perl-base
Requires:       sudo
Requires:       perl(CGI)
Requires:       perl(CGI::Carp)
Requires:       perl(CGI::Fast)
Requires:       perl(Crypt::SSLeay)
Requires:       perl(DBD::Pg)
Requires:       perl(DBI)
Requires:       perl(Data::Dumper)
Requires:       perl(File::Copy::Recursive)
Requires:       perl(File::Spec)
Requires:       perl(HTTP::Request)
Requires:       perl(HTTP::Request::Common)
Requires:       perl(JSON::PP)
Requires:       perl(JSON::XS)
Requires:       perl(LWP::UserAgent)
Requires:       perl(Log4perl)
Requires:       perl(Template)
Requires:       perl(Tie::IxHash)
Requires:       perl(Time::HiRes)
Requires:       perl(YAML::Syck)
Requires(pre):  %fillup_prereq
Requires(pre):  %insserv_prereq
Recommends:     icinga
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
BPView is the short name for Business Process View. This Tool
for Nagios and Icinga is used to display a combination of Checks
in a Business Process.

%prep
%setup -q -n BPView-%{name}-%{version}
%patch1 -p1

%build
aclocal
automake --force-missing --add-missing
autoconf
%configure \
  --sbindir=%{_libdir}/%{name} \
  --libdir=%{perl_vendorlib} \
  --sysconfdir=%{_sysconfdir}/%{name} \
  --datarootdir=%{_datarootdir}/%{name} \
  --docdir=%{_defaultdocdir}/%{name} \
  --with-web-user=%{apacheuser} \
  --with-web-group=%{apachegroup} \
  --with-web-conf=%{_sysconfdir}/apache2/conf.d/%{name}.conf

make %{?_smp_mflags} all

%install
make install DESTDIR=%{buildroot} INSTALL_OPTS="" INSTALL_OPTS_WEB=""

# backup folder
mkdir -p %{buildroot}/%{_sysconfdir}/%{name}/backup

%if 0%{?suse_version}
test -f %{buildroot}/%{_sysconfdir}/init.d/bpviewd && rm %{buildroot}/%{_sysconfdir}/init.d/bpviewd
install -Dm755 %{SOURCE1} %{buildroot}/%{_sysconfdir}/init.d/bpviewd
mkdir -p  %{buildroot}/%{_sbindir}
pushd %{buildroot}/%{_sbindir} >/dev/null
ln -s %{_sysconfdir}/init.d/bpviewd rcbpviewd
popd
install -Dm 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
%endif

%preun
%stop_on_removal bpviewd

%postun
%restart_on_update bpviewd
%insserv_cleanup

%files
%defattr(0644,root,root,0755)
%license COPYING
%doc AUTHORS ChangeLog NEWS README.md sample-config selinux
%config(noreplace) %{_sysconfdir}/%{name}/bpview.yml
%config(noreplace) %{_sysconfdir}/%{name}/bpviewd.yml
%config(noreplace) %{_sysconfdir}/%{name}/datasource.yml
%config(noreplace) %{_sysconfdir}/%{name}/mappings.yml
%config(noreplace) %{_sysconfdir}/%{name}/views/example.yml
%config(noreplace) %{_sysconfdir}/%{name}/backup
%config(noreplace) %{_sysconfdir}/%{name}/bp-config
%config(noreplace) %{_sysconfdir}/apache2/conf.d/%{name}.conf
%config(noreplace) %{_sysconfdir}/sudoers.d/%{name}
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%dir %{_sysconfdir}/apache2
%dir %{_sysconfdir}/apache2/conf.d
%dir %{_sysconfdir}/%{name}
%dir %{_sysconfdir}/sudoers.d
%dir %{_libdir}/%{name}
%dir %{_datadir}/%{name}
%{perl_vendorlib}
%attr(0755,root,root) %{_libdir}/%{name}/bpview.pl
%attr(0755,root,root) %{_bindir}/bpviewd
%attr(0755,root,root) %{_bindir}/bpview_reload
%attr(0775,root,%{apachegroup}) %{_sysconfdir}/%{name}/bp-config
%attr(0775,root,%{apachegroup}) %{_sysconfdir}/%{name}/views
%attr(0775,root,%{apachegroup}) %{_sysconfdir}/%{name}/backup
%attr(0775,root,root) %{_sysconfdir}/init.d/bpviewd
%if 0%{?suse_version}
%attr(0755,root,root) %{_sbindir}/rcbpviewd
%endif
%{_datarootdir}/%{name}/css
%{_datarootdir}/%{name}/images
%{_datarootdir}/%{name}/javascript
%{_datarootdir}/%{name}/src
%attr(0755,%{apacheuser},%{apachegroup}) %{_localstatedir}/log/%{name}
%attr(0644,%{apacheuser},%{apachegroup}) %{_localstatedir}/log/%{name}/bpview.log

%changelog