File monitorix.spec of Package monitorix

%global __requires_exclude perl\\(Monitorix\\)|perl\\(HTTPServer\\)
%global __provides_exclude perl\\(

Name:              monitorix
Version:           3.10.1
Release:           1%{?dist}
Summary:           A free, open source, lightweight system monitoring tool
License:           GPLv2+
URL:               http://www.monitorix.org
Source0:           http://www.monitorix.org/%{name}-%{version}.tar.gz
BuildArch:         noarch
BuildRequires:     perl
BuildRequires:     systemd
Requires:          logrotate
Requires:          perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
Requires:          perl(DBD::mysql)
Requires:          perl(IO::Socket::SSL)
Requires(post):    systemd
Requires(preun):   systemd
Requires(postun):  systemd

%description
Monitorix is a free, open source, lightweight system monitoring tool designed
to monitor as many services and system resources as possible. It has been
created to be used under production Linux/UNIX servers, but due to its
simplicity and small size may also be used on embedded devices as well.

%prep
%setup -q
sed -i 's|#!/usr/bin/env perl|#!/usr/bin/perl|' %{name}
sed -i 's|#!/usr/bin/env perl|#!/usr/bin/perl|' %{name}.cgi

%build
# Nothing to build.

%install
install -pDm644 docs/%{name}.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/%{name}
mkdir -p %{buildroot}/%{_sysconfdir}/%{name}
mkdir -p %{buildroot}/%{_sysconfdir}/%{name}/conf.d
install -pDm644 %{name}.conf %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf
install -pDm755 %{name} %{buildroot}%{_bindir}/%{name}
mkdir -p %{buildroot}/usr/lib/%{name}
install -pDm644 lib/*.pm %{buildroot}/usr/lib/%{name}
mkdir -p %{buildroot}%{_localstatedir}/lib/%{name}/www
install -pDm644 logo_top.png %{buildroot}%{_localstatedir}/lib/%{name}/www
install -pDm644 logo_bot.png %{buildroot}%{_localstatedir}/lib/%{name}/www
install -pDm644 %{name}ico.png %{buildroot}%{_localstatedir}/lib/%{name}/www
mkdir -p %{buildroot}%{_localstatedir}/lib/%{name}/www/imgs
mkdir -p %{buildroot}%{_localstatedir}/lib/%{name}/www/cgi
install -pDm755 %{name}.cgi %{buildroot}%{_localstatedir}/lib/%{name}/www/cgi
mkdir -p %{buildroot}%{_localstatedir}/lib/%{name}/reports
install -pDm644 reports/*.html %{buildroot}%{_localstatedir}/lib/%{name}/reports
mkdir -p %{buildroot}%{_localstatedir}/lib/%{name}/usage
mkdir -p %{buildroot}%{_mandir}/man5
mkdir -p %{buildroot}%{_mandir}/man8
install -pDm644 man/man5/%{name}.conf.5 %{buildroot}%{_mandir}/man5
install -pDm644 man/man8/%{name}.8 %{buildroot}%{_mandir}/man8
install -pDm644 docs/%{name}.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
install -pDm644 docs/%{name}.service %{buildroot}%{_unitdir}/%{name}.service

%post
%systemd_post %{buildroot}%{_unitdir}/%{name}.service

%preun
%systemd_preun %{buildroot}%{_unitdir}/%{name}.service

%postun
%systemd_postun_with_restart %{buildroot}%{_unitdir}/%{name}.service

%files
%doc Changes COPYING README README.nginx
%doc docs/%{name}-alert.sh docs/%{name}-apache.conf docs/%{name}-lighttpd.conf
%doc docs/htpasswd.pl
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
%dir %{_sysconfdir}/%{name}/conf.d
%dir %{_localstatedir}/lib/%{name}/
%dir %{_localstatedir}/lib/%{name}/www
%dir %{_localstatedir}/lib/%{name}/www/cgi
%dir %{_localstatedir}/lib/%{name}/reports
%{_localstatedir}/lib/%{name}/reports/*.html
%{_mandir}/man5/%{name}.conf.5*
%{_mandir}/man8/%{name}.8*
%{_unitdir}/%{name}.service
%{_bindir}/%{name}
%{_prefix}/lib/%{name}/
%{_localstatedir}/lib/%{name}/www/logo_top.png
%{_localstatedir}/lib/%{name}/www/logo_bot.png
%{_localstatedir}/lib/%{name}/www/%{name}ico.png
%{_localstatedir}/lib/%{name}/www/cgi/%{name}.cgi
%attr(755,nobody,nobody) %{_localstatedir}//lib/%{name}/www/imgs
%attr(755,root,root) %{_localstatedir}/lib/%{name}/usage

%changelog
* Thu Mar 15 2018 Jordi Sanfeliu <jordi@fibranet.cat> - 3.10.1-1
- Updated to 3.10.1.

* Tue Sep 26 2017 Jordi Sanfeliu <jordi@fibranet.cat> - 3.10.0-1
- Updated to 3.10.0.

* Mon Oct 17 2016 Jordi Sanfeliu <jordi@fibranet.cat> - 3.9.0-1
- Updated to 3.9.0.

* Mon Nov 16 2015 Jordi Sanfeliu <jordi@fibranet.cat> - 3.8.1-1
- Urgent security update.

* Thu Sep 17 2015 Jordi Sanfeliu <jordi@fibranet.cat> - 3.8.0-1
- Updated to 3.8.0.

* Thu Mar 12 2015 Jordi Sanfeliu <jordi@fibranet.cat> - 3.7.0-1
- Updated to 3.7.0.

* Wed Aug 20 2014 Jordi Sanfeliu <jordi@fibranet.cat> - 3.6.0-1
- Updated to 3.6.0.

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.5.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Tue May 06 2014 Jordi Sanfeliu <jordi@fibranet.cat> - 3.5.1-1
- Updated to 3.5.1.

* Mon Mar 31 2014 Jordi Sanfeliu <jordi@fibranet.cat> - 3.5.0-1
- Updated to 3.5.0.

* Tue Dec 03 2013 Christopher Meng <rpm@cicku.me> - 3.4.0-1
- Update to 3.4.0

* Sat Nov 23 2013 Christopher Meng <rpm@cicku.me> - 3.3.1-1
- Urgent security update.

* Tue Aug 13 2013 Christopher Meng <rpm@cicku.me> - 3.3.0-1
- New release.

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.2.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Wed Jul 17 2013 Petr Pisar <ppisar@redhat.com> - 3.2.1-2
- Perl 5.18 rebuild

* Wed Jun 05 2013 Christopher Meng <rpm@cicku.me> - 3.2.1-1
- New release.

* Tue May 21 2013 Christopher Meng <rpm@cicku.me> - 3.2.0-2
- Fixes.

* Tue May 14 2013 Christopher Meng <rpm@cicku.me> - 3.2.0-1
- New release.

* Tue Apr 30 2013 Christopher Meng <rpm@cicku.me> - 3.1.0-4
- libdir fixed.

* Sat Apr 06 2013 Christopher Meng <rpm@cicku.me> - 3.1.0-3
- Errors fixed.

* Tue Apr 02 2013 Christopher Meng <rpm@cicku.me> - 3.1.0-2
- Fixed review bugs(BZ#947071)

* Mon Apr 01 2013 Christopher Meng <rpm@cicku.me> - 3.1.0-1
- Initial Package.