File icingaweb2.spec of Package icingaweb2
#
# spec file for package icingaweb2
#
# Copyright (c) 2013-2015 Icinga Development Team | GPLv2+
#
# 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 http://bugs.opensuse.org/
#
%define sversion 2.5.3
Name: icingaweb2
Version: 2.5.3
Release: 0
License: GPL-2.0+ and MIT and BSD-3-Clause
Summary: Icinga Web 2
Url: https://icinga.org
Group: System/Monitoring
Source: https://github.com/Icinga/icingaweb2/archive/v%{sversion}.tar.gz
Source99: %{name}-rpmlintrc
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%if 0%{?fedora} || 0%{?rhel} || 0%{?amzn}
%define php php
%define php_cli php-cli
%define wwwconfigdir %{_sysconfdir}/httpd/conf.d
%define wwwdir %{_sysconfdir}/httpd
%define wwwuser apache
#%%define zend php-ZendFramework
%endif
%if 0%{?suse_version}
%if 0%{?suse_version} > 1500
BuildRequires: user(wwwrun)
Requires(pre): user(wwwrun)
%endif
BuildRequires: nagios-rpm-macros
BuildRequires: fdupes
BuildRequires: apache2-devel
%define wwwconfigdir %{_sysconfdir}/apache2/conf.d
%define wwwdir %{_sysconfdir}/apache2
%define wwwuser wwwrun
#%%define zend php-ZendFramework
%define php php
Requires: mod_php_any
%endif
Requires: %{name}-common = %{version}
Requires: %{name}-vendor-HTMLPurifier
Requires: %{name}-vendor-JShrink
Requires: %{name}-vendor-Parsedown
Requires: %{name}-vendor-dompdf
Requires: %{name}-vendor-lessphp
Requires: %{name}-vendor-zf1
Recommends: %{name}-icingacli = %{version}
Requires: php-Icinga = %{version}
%{?amzn:Requires(pre): shadow-utils}
%{?fedora:Requires(pre): shadow-utils}
%{?rhel:Requires(pre): shadow-utils}
%{?suse_version:Requires(pre): pwdutils}
%description
Icinga Web 2 is the a monitoring web interface, framework and
command-line interface supporting Icinga 2, Icinga Core and any other
monitoring backend compatible with the IDO database.
%define basedir %{_datadir}/%{name}
%define bindir %{_bindir}
%define configdir %{_sysconfdir}/%{name}
%define logdir %{_localstatedir}/log/%{name}
%define phpdir %{_datadir}/php
%define icingawebgroup icingaweb2
%define docsdir %{_datadir}/doc/%{name}
%package common
Summary: Common files for Icinga Web 2 and the Icinga CLI
Group: System/Monitoring
%{?amzn:Requires(pre): shadow-utils}
%{?fedora:Requires(pre): shadow-utils}
%{?rhel:Requires(pre): shadow-utils}
%{?suse_version:Requires(pre): pwdutils}
%description common
Common files for Icinga Web 2 and the Icinga CLI that are shared
between all other icingaweb2 packages.
%package -n php-Icinga
Summary: PHP bindings for Icinga
Group: Development/Libraries/PHP
Requires: %{php} >= 5.6.0
Requires: %{php}-gd
Requires: %{php}-intl
#Requires: %%{zend} >= 1.12.18
#Requires: %%{zend}-Db-Adapter-Pdo-Mysql
#Requires: %%{zend}-Db-Adapter-Pdo-Pgsql
%{?amzn:Requires: %{php}-pecl-imagick}
%{?fedora:Requires: php-pecl-imagick}
%{?rhel:Requires: php-pecl-imagick}
%{?suse_version:Requires: %{php}-gettext %{php}-json %{php}-openssl %{php}-posix}
%description -n php-Icinga
PHP bindings library for Icinga2 Web.
%package icingacli
Summary: Icinga2 CLI
Group: System/Monitoring
Requires: %{name}-common = %{version}
Requires: php-Icinga = %{version}
%{?amzn:Requires: %{php_cli} >= 5.6.0 bash-completion}
%{?fedora:Requires: %{php_cli} >= 5.6.0 bash-completion}
%{?rhel:Requires: %{php_cli} >= 5.6.0 bash-completion}
%{?suse_version:Requires: %{php} >= 5.6.0}
%description icingacli
Command line interface for Icinga2.
%package vendor-dompdf
Version: 0.6.1
Release: 1
License: LGPL-2.1
Summary: Vendor lib dompdf for Icinga Web 2
Group: System/Monitoring
Requires: %{php} >= 5.6.0
%description vendor-dompdf
Vendor library dompdf for Icinga Web 2.
%package vendor-HTMLPurifier
Version: 4.6.0
Release: 1
License: LGPL-2.1
Summary: Vendor lib HTMLPurifier for Icinga Web 2
Group: System/Monitoring
Requires: %{php} >= 5.6.0
%description vendor-HTMLPurifier
Vendor library HTMLPurifier for Icinga Web 2.
%package vendor-JShrink
Version: 1.0.1
Release: 1
License: BSD-3-Clause
Summary: Vendor lib JShrink for Icinga Web 2
Group: System/Monitoring
Requires: %{php} >= 5.6.0
%description vendor-JShrink
Vendor library JShrink for Icinga Web 2.
%package vendor-lessphp
Version: 0.4.0
Release: 1
License: MIT
Summary: Vendor lib lessphp for Icinga Web 2
Group: System/Monitoring
Requires: %{php} >= 5.6.0
%description vendor-lessphp
Vendor library lessphp for Icinga Web 2.
%package vendor-Parsedown
Version: 1.0.0
Release: 1
License: MIT
Summary: Vendor lib Parsedown for Icinga Web 2
Group: System/Monitoring
Requires: %{php} >= 5.6.0
%description vendor-Parsedown
Vendor library Parsedown for Icinga Web 2.
%package vendor-zf1
Version: 1.12.20
Release: 1
License: MIT
Summary: Vendor lib zf1 for Icinga Web 2
Group: System/Monitoring
Requires: %{php} >= 5.6.0
%description vendor-zf1
Vendor library zf1 for Icinga Web 2.
%prep
%setup -q -n %{name}-%{sversion}
# rpmlint
chmod -x ./library/vendor/HTMLPurifier/DefinitionCache/Serializer/README
find . -type f -name *svg | xargs chmod -x
find . -type f -name *css | xargs chmod -x
%build
%install
mkdir -p %{buildroot}{%{basedir}/{modules,library/vendor,public},%{bindir},%{configdir}/modules,%{logdir},%{phpdir},%{wwwconfigdir},%{_sysconfdir}/bash_completion.d,%{docsdir}}
cp -prv application doc %{buildroot}%{basedir}
cp -pv etc/bash_completion.d/icingacli %{buildroot}%{_sysconfdir}/bash_completion.d/icingacli
cp -prv modules/{doc,monitoring,setup,test,translation} %{buildroot}%{basedir}/modules
cp -prv library/Icinga %{buildroot}%{phpdir}
cp -prv library/vendor/{HTMLPurifier,JShrink,Parsedown,dompdf,lessphp,HTMLPurifier.autoload.php,HTMLPurifier.php,Zend} %{buildroot}%{basedir}/library/vendor
cp -prv public/{css,font,img,js,error_norewrite.html,index.php} %{buildroot}%{basedir}/public
cp -pv packages/files/apache/icingaweb2.conf %{buildroot}%{wwwconfigdir}/icingaweb2.conf
cp -pv packages/files/bin/icingacli %{buildroot}%{bindir}
cp -pv packages/files/public/index.php %{buildroot}%{basedir}/public
cp -prv etc/schema %{buildroot}%{docsdir}
cp -prv packages/files/config/modules/{setup,translation} %{buildroot}%{configdir}/modules
%if 0%{?suse_version}
%fdupes %{buildroot}/%{basedir}/library
%endif
%find_lang icinga
%pre
getent group icingacmd >/dev/null || groupadd -r icingacmd
%if 0%{?suse_version}
%if 0%{?suse_version} == 1110
usermod -A icingacmd,%{icingawebgroup} %{wwwuser}
%else
usermod -a -G icingacmd,%{icingawebgroup} %{wwwuser}
%endif
if [ "$1" = "1" ]; then
# enable env, php5 and rewrite in apache on new installations
if [ -x %{_sbindir}/a2enmod ]; then
%{_sbindir}/a2enmod env >/dev/null
%{_sbindir}/a2enmod php5 >/dev/null
%{_sbindir}/a2enmod php7 >/dev/null
%{_sbindir}/a2enmod rewrite >/dev/null
fi
fi
%endif
%files
%defattr(-,root,root)
%{basedir}/application/controllers
%{basedir}/application/fonts
%{basedir}/application/forms
%{basedir}/application/layouts
%{basedir}/application/views
%{basedir}/application/VERSION
%{basedir}/doc
%{basedir}/modules
%{basedir}/public
%dir %{wwwdir}
%dir %{wwwconfigdir}
%config(noreplace) %{wwwconfigdir}/icingaweb2.conf
%attr(0775,root,%{icingawebgroup}) %dir %{logdir}
%attr(0770,root,%{icingawebgroup}) %config(noreplace) %dir %{configdir}/modules/setup
%attr(0660,root,%{icingawebgroup}) %config(noreplace) %{configdir}/modules/setup/config.ini
%attr(0770,root,%{icingawebgroup}) %config(noreplace) %dir %{configdir}/modules/translation
%attr(0660,root,%{icingawebgroup}) %config(noreplace) %{configdir}/modules/translation/config.ini
%{docsdir}
%docdir %{docsdir}
%pre common
getent group %{icingawebgroup} >/dev/null || groupadd -r %{icingawebgroup}
%files common -f icinga.lang
%defattr(-,root,root)
%{basedir}/application/locale
%dir %{basedir}
%dir %{basedir}/application
%dir %{basedir}/modules
%dir %{basedir}/library
%dir %{basedir}/library/vendor
%attr(0770,root,%{icingawebgroup}) %config(noreplace) %dir %{configdir}
%attr(0770,root,%{icingawebgroup}) %config(noreplace) %dir %{configdir}/modules
%files -n php-Icinga
%defattr(-,root,root)
%dir %{phpdir}
%{phpdir}/Icinga
%files icingacli
%defattr(-,root,root)
%{basedir}/application/clicommands
%config %{_sysconfdir}/bash_completion.d/icingacli
%attr(0755,root,root) %{bindir}/icingacli
%files vendor-dompdf
%defattr(-,root,root)
%{basedir}/library/vendor/dompdf
%files vendor-HTMLPurifier
%defattr(-,root,root)
%{basedir}/library/vendor/HTMLPurifier
%{basedir}/library/vendor/HTMLPurifier*.php
%files vendor-JShrink
%defattr(-,root,root)
%{basedir}/library/vendor/JShrink
%files vendor-lessphp
%defattr(-,root,root)
%{basedir}/library/vendor/lessphp
%files vendor-Parsedown
%defattr(-,root,root)
%{basedir}/library/vendor/Parsedown
%files vendor-zf1
%defattr(-,root,root)
%{basedir}/library/vendor/Zend
%changelog