2014-08-12 15:24:55 +02:00
|
|
|
#/**
|
|
|
|
# * This file is part of Icinga Web 2.
|
|
|
|
# *
|
|
|
|
# * Icinga Web 2 - Head for multiple monitoring backends.
|
|
|
|
# * Copyright (C) 2014 Icinga Development Team
|
|
|
|
# *
|
|
|
|
# * This program is free software; you can redistribute it and/or
|
|
|
|
# * modify it under the terms of the GNU General Public License
|
|
|
|
# * as published by the Free Software Foundation; either version 2
|
|
|
|
# * of the License, or (at your option) any later version.
|
|
|
|
# *
|
|
|
|
# * This program is distributed in the hope that it will be useful,
|
|
|
|
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# * GNU General Public License for more details.
|
|
|
|
# *
|
|
|
|
# * You should have received a copy of the GNU General Public License
|
|
|
|
# * along with this program; if not, write to the Free Software
|
|
|
|
# * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
# *
|
|
|
|
# * @copyright 2014 Icinga Development Team <info@icinga.org>
|
|
|
|
# * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
|
|
|
# * @author Icinga Development Team <info@icinga.org>
|
|
|
|
# *
|
|
|
|
# */
|
2013-10-20 16:00:12 +02:00
|
|
|
|
2014-08-12 13:10:45 +02:00
|
|
|
%define revision 1
|
2013-10-20 16:00:12 +02:00
|
|
|
|
2014-09-13 00:02:55 +02:00
|
|
|
%define configdir %{_sysconfdir}/%{name}
|
|
|
|
%define sharedir %{_datadir}/%{name}
|
|
|
|
%define prefixdir %{_datadir}/%{name}
|
2014-05-28 21:00:37 +02:00
|
|
|
%define usermodparam -a -G
|
2014-09-13 00:02:55 +02:00
|
|
|
%define logdir %{_localstatedir}/log/%{name}
|
2014-11-14 00:27:26 +01:00
|
|
|
%define docdir %{sharedir}/doc
|
2013-10-20 16:00:12 +02:00
|
|
|
|
|
|
|
%if "%{_vendor}" == "suse"
|
|
|
|
%define phpname php5
|
|
|
|
%define phpzendname php5-ZendFramework
|
2014-05-28 21:00:37 +02:00
|
|
|
%define apache2modphpname apache2-mod_php5
|
2013-10-20 16:00:12 +02:00
|
|
|
%endif
|
2014-05-28 21:00:37 +02:00
|
|
|
# SLE 11 = 1110
|
|
|
|
%if 0%{?suse_version} == 1110
|
2014-08-18 21:15:00 +02:00
|
|
|
%define phpname php53
|
2014-05-28 21:00:37 +02:00
|
|
|
%define apache2modphpname apache2-mod_php53
|
|
|
|
%define usermodparam -A
|
|
|
|
%endif
|
|
|
|
|
2014-08-18 21:15:00 +02:00
|
|
|
%if "%{_vendor}" == "redhat"
|
2013-10-20 16:00:12 +02:00
|
|
|
%define phpname php
|
|
|
|
%define phpzendname php-ZendFramework
|
|
|
|
%endif
|
|
|
|
|
|
|
|
# el5 requires newer php53 rather than php (5.1)
|
|
|
|
%if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5"
|
|
|
|
%define phpname php53
|
|
|
|
%endif
|
|
|
|
|
|
|
|
%if "%{_vendor}" == "suse"
|
|
|
|
%define apacheconfdir %{_sysconfdir}/apache2/conf.d
|
|
|
|
%define apacheuser wwwrun
|
|
|
|
%define apachegroup www
|
2014-08-12 13:10:45 +02:00
|
|
|
%define extcmdfile %{_localstatedir}/run/icinga2/cmd/icinga.cmd
|
|
|
|
%define livestatussocket %{_localstatedir}/run/icinga2/cmd/livestatus
|
2013-10-20 16:00:12 +02:00
|
|
|
%endif
|
|
|
|
%if "%{_vendor}" == "redhat"
|
|
|
|
%define apacheconfdir %{_sysconfdir}/httpd/conf.d
|
|
|
|
%define apacheuser apache
|
|
|
|
%define apachegroup apache
|
2014-08-12 13:10:45 +02:00
|
|
|
%define extcmdfile %{_localstatedir}/run/icinga2/cmd/icinga.cmd
|
|
|
|
%define livestatussocket %{_localstatedir}/run/icinga2/cmd/livestatus
|
2013-10-20 16:00:12 +02:00
|
|
|
%endif
|
|
|
|
|
|
|
|
Summary: Open Source host, service and network monitoring Web UI
|
2013-10-22 10:30:41 +02:00
|
|
|
Name: icingaweb2
|
2014-05-13 00:27:06 +02:00
|
|
|
Version: 0.0.1
|
2013-10-20 16:00:12 +02:00
|
|
|
Release: %{revision}%{?dist}
|
|
|
|
License: GPLv2
|
|
|
|
Group: Applications/System
|
|
|
|
URL: http://www.icinga.org
|
|
|
|
BuildArch: noarch
|
|
|
|
|
|
|
|
%if "%{_vendor}" == "suse"
|
|
|
|
AutoReqProv: Off
|
|
|
|
%endif
|
|
|
|
|
2014-08-27 15:02:46 +02:00
|
|
|
Source: icingaweb2-%{version}.tar.gz
|
2013-10-20 16:00:12 +02:00
|
|
|
|
|
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
|
|
|
|
|
|
|
|
BuildRequires: %{phpname} >= 5.3.0
|
|
|
|
BuildRequires: %{phpname}-devel >= 5.3.0
|
|
|
|
BuildRequires: %{phpname}-ldap
|
|
|
|
BuildRequires: %{phpname}-pdo
|
|
|
|
BuildRequires: %{phpzendname}
|
2014-05-28 21:00:37 +02:00
|
|
|
%if "%{_vendor}" != "suse"
|
2013-10-20 16:00:12 +02:00
|
|
|
BuildRequires: %{phpzendname}-Db-Adapter-Pdo
|
|
|
|
BuildRequires: %{phpzendname}-Db-Adapter-Pdo-Mysql
|
|
|
|
BuildRequires: %{phpzendname}-Db-Adapter-Pdo-Pgsql
|
2014-05-28 21:00:37 +02:00
|
|
|
%endif
|
2013-10-20 16:00:12 +02:00
|
|
|
|
|
|
|
%if "%{_vendor}" == "redhat"
|
|
|
|
%endif
|
|
|
|
%if "%{_vendor}" == "suse"
|
|
|
|
Requires: %{phpname}-devel >= 5.3.0
|
|
|
|
BuildRequires: %{phpname}-json
|
|
|
|
BuildRequires: %{phpname}-sockets
|
|
|
|
BuildRequires: %{phpname}-dom
|
|
|
|
%endif
|
|
|
|
|
|
|
|
Requires: %{phpname} >= 5.3.0
|
2014-05-28 21:00:37 +02:00
|
|
|
Requires: %{phpzendname}
|
2013-10-20 16:00:12 +02:00
|
|
|
Requires: %{phpname}-ldap
|
|
|
|
Requires: %{phpname}-pdo
|
|
|
|
%if "%{_vendor}" == "redhat"
|
|
|
|
Requires: %{phpname}-common
|
2014-05-28 21:00:37 +02:00
|
|
|
Requires: %{phpzendname}-Db-Adapter-Pdo
|
|
|
|
Requires: %{phpzendname}-Db-Adapter-Pdo-Mysql
|
2013-10-20 16:00:12 +02:00
|
|
|
Requires: php-pear
|
|
|
|
%endif
|
|
|
|
%if "%{_vendor}" == "suse"
|
|
|
|
Requires: %{phpname}-pear
|
|
|
|
Requires: %{phpname}-dom
|
|
|
|
Requires: %{phpname}-tokenizer
|
|
|
|
Requires: %{phpname}-gettext
|
|
|
|
Requires: %{phpname}-ctype
|
|
|
|
Requires: %{phpname}-json
|
2014-05-28 21:00:37 +02:00
|
|
|
Requires: %{apache2modphpname}
|
2013-10-20 16:00:12 +02:00
|
|
|
%endif
|
|
|
|
|
2014-05-13 00:27:06 +02:00
|
|
|
Requires: php-Icinga
|
2013-10-20 16:00:12 +02:00
|
|
|
|
|
|
|
|
2014-05-13 00:27:06 +02:00
|
|
|
%description
|
2014-08-12 13:10:45 +02:00
|
|
|
Icinga Web 2 for Icinga 2 or Icinga 1.x using multiple backends
|
|
|
|
for example DB IDO.
|
2013-10-20 16:00:12 +02:00
|
|
|
|
2014-05-13 00:27:06 +02:00
|
|
|
%package -n icingacli
|
|
|
|
Summary: Icinga CLI
|
2013-10-20 16:00:12 +02:00
|
|
|
Group: Applications/System
|
|
|
|
Requires: %{name} = %{version}-%{release}
|
2014-05-13 00:27:06 +02:00
|
|
|
Requires: php-Icinga
|
2013-10-20 16:00:12 +02:00
|
|
|
|
2014-05-13 00:27:06 +02:00
|
|
|
%description -n icingacli
|
|
|
|
Icinga CLI using php-Icinga Icinga Web 2 backend.
|
2013-10-20 16:00:12 +02:00
|
|
|
|
2014-05-13 00:27:06 +02:00
|
|
|
%package -n php-Icinga
|
|
|
|
Summary: Icinga Web 2 PHP Libraries
|
2013-10-20 16:00:12 +02:00
|
|
|
Group: Applications/System
|
|
|
|
Requires: %{name} = %{version}-%{release}
|
2014-05-13 00:27:06 +02:00
|
|
|
Requires: %{phpname} >= 5.3.0
|
|
|
|
Requires: %{phpzendname}
|
2013-10-20 16:00:12 +02:00
|
|
|
|
|
|
|
|
2014-05-13 00:27:06 +02:00
|
|
|
%description -n php-Icinga
|
2014-08-12 13:10:45 +02:00
|
|
|
Icinga Web 2 PHP Libraries required by the web frontend and cli tool.
|
2013-10-20 16:00:12 +02:00
|
|
|
|
|
|
|
|
|
|
|
%prep
|
2014-08-12 13:10:45 +02:00
|
|
|
#VERSION=0.0.1; git archive --format=tar --prefix=icingaweb2-$VERSION/ HEAD | gzip >icingaweb2-$VERSION.tar.gz
|
|
|
|
%setup -q -n %{name}-%{version}
|
2013-10-20 16:00:12 +02:00
|
|
|
|
|
|
|
%build
|
2013-10-20 18:44:07 +02:00
|
|
|
|
2013-10-20 16:00:12 +02:00
|
|
|
%install
|
|
|
|
[ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot}
|
|
|
|
|
|
|
|
# prepare configuration for sub packages
|
|
|
|
|
2014-05-13 00:27:06 +02:00
|
|
|
# install rhel apache config
|
2014-08-12 13:10:45 +02:00
|
|
|
install -D -m0644 packages/rpm/etc/httpd/conf.d/icingaweb.conf %{buildroot}/%{apacheconfdir}/icingaweb.conf
|
2014-05-13 00:27:06 +02:00
|
|
|
|
|
|
|
# install public, library, modules
|
|
|
|
%{__mkdir} -p %{buildroot}/%{sharedir}
|
|
|
|
%{__mkdir} -p %{buildroot}/%{logdir}
|
2014-09-13 00:02:55 +02:00
|
|
|
%{__mkdir} -p %{buildroot}/%{docdir}
|
|
|
|
%{__mkdir} -p %{buildroot}/%{_sysconfdir}/%{name}
|
2014-08-12 13:10:45 +02:00
|
|
|
%{__mkdir} -p %{buildroot}/%{_sysconfdir}/dashboard
|
2014-09-13 00:02:55 +02:00
|
|
|
%{__mkdir} -p %{buildroot}/%{_sysconfdir}/%{name}/modules
|
|
|
|
%{__mkdir} -p %{buildroot}/%{_sysconfdir}/%{name}/modules/monitoring
|
|
|
|
%{__mkdir} -p %{buildroot}/%{_sysconfdir}/%{name}/enabledModules
|
2014-05-13 00:27:06 +02:00
|
|
|
|
2014-11-14 00:27:26 +01:00
|
|
|
# make sure to install local icingacli for setup wizard token generation & webserver config
|
|
|
|
%{__cp} -r application doc library modules public bin %{buildroot}/%{sharedir}/
|
2014-05-13 00:27:06 +02:00
|
|
|
|
2014-08-12 13:10:45 +02:00
|
|
|
## config
|
|
|
|
# authentication is db only
|
2014-09-13 00:02:55 +02:00
|
|
|
install -D -m0644 packages/rpm/etc/%{name}/authentication.ini %{buildroot}/%{_sysconfdir}/%{name}/authentication.ini
|
2014-08-12 13:10:45 +02:00
|
|
|
# custom resource paths
|
2014-09-13 00:02:55 +02:00
|
|
|
install -D -m0644 packages/rpm/etc/%{name}/resources.ini %{buildroot}/%{_sysconfdir}/%{name}/resources.ini
|
2014-08-12 13:10:45 +02:00
|
|
|
# monitoring module (icinga2)
|
2014-09-13 00:02:55 +02:00
|
|
|
install -D -m0644 packages/rpm/etc/%{name}/modules/monitoring/backends.ini %{buildroot}/%{_sysconfdir}/%{name}/modules/monitoring/backends.ini
|
|
|
|
install -D -m0644 packages/rpm/etc/%{name}/modules/monitoring/instances.ini %{buildroot}/%{_sysconfdir}/%{name}/modules/monitoring/instances.ini
|
2014-05-13 00:27:06 +02:00
|
|
|
|
|
|
|
# enable the monitoring module by default
|
2014-09-13 00:02:55 +02:00
|
|
|
ln -s %{sharedir}/modules/monitoring %{buildroot}/%{_sysconfdir}/%{name}/enabledModules/monitoring
|
2014-08-12 13:10:45 +02:00
|
|
|
## config
|
2014-05-13 00:27:06 +02:00
|
|
|
|
2014-11-14 00:27:26 +01:00
|
|
|
# symlink icingacli
|
|
|
|
ln -sf %{buildroot}/%{sharedir}/bin/icingacli %{buildroot}/usr/bin/icingacli
|
2013-10-20 18:44:07 +02:00
|
|
|
|
2013-10-20 16:00:12 +02:00
|
|
|
%pre
|
|
|
|
# Add apacheuser in the icingacmd group
|
|
|
|
# If the group exists, add the apacheuser in the icingacmd group.
|
|
|
|
# It is not neccessary that icinga2-web is installed on the same system as
|
|
|
|
# icinga and only on systems with icinga installed the icingacmd
|
|
|
|
# group exists. In all other cases the user used for ssh access has
|
|
|
|
# to be added to the icingacmd group on the remote icinga server.
|
|
|
|
getent group icingacmd > /dev/null
|
|
|
|
|
|
|
|
if [ $? -eq 0 ]; then
|
2014-05-28 21:00:37 +02:00
|
|
|
%{_sbindir}/usermod %{usermodparam} icingacmd %{apacheuser}
|
2013-10-20 16:00:12 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
%preun
|
|
|
|
|
|
|
|
%post
|
|
|
|
|
|
|
|
%clean
|
|
|
|
[ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot}
|
|
|
|
|
|
|
|
%files
|
|
|
|
# main dirs
|
|
|
|
%defattr(-,root,root)
|
2014-08-12 13:10:45 +02:00
|
|
|
%doc etc/schema doc packages/rpm/README.md
|
2014-05-13 00:27:06 +02:00
|
|
|
%attr(755,%{apacheuser},%{apachegroup}) %{sharedir}/public
|
|
|
|
%attr(755,%{apacheuser},%{apachegroup}) %{sharedir}/modules
|
2013-10-20 16:00:12 +02:00
|
|
|
# configs
|
|
|
|
%defattr(-,root,root)
|
|
|
|
%config(noreplace) %attr(-,root,root) %{apacheconfdir}/icingaweb.conf
|
2014-08-12 13:10:45 +02:00
|
|
|
%config(noreplace) %attr(-,%{apacheuser},%{apachegroup}) %{configdir}
|
2013-10-20 16:00:12 +02:00
|
|
|
# logs
|
|
|
|
%attr(2775,%{apacheuser},%{apachegroup}) %dir %{logdir}
|
2014-09-13 00:02:55 +02:00
|
|
|
# shipped docs
|
|
|
|
%attr(755,%{apacheuser},%{apachegroup}) %{sharedir}/doc
|
2013-10-20 16:00:12 +02:00
|
|
|
|
2014-05-13 00:27:06 +02:00
|
|
|
%files -n php-Icinga
|
|
|
|
%attr(755,%{apacheuser},%{apachegroup}) %{sharedir}/application
|
|
|
|
%attr(755,%{apacheuser},%{apachegroup}) %{sharedir}/library
|
|
|
|
|
|
|
|
%files -n icingacli
|
|
|
|
%attr(0755,root,root) /usr/bin/icingacli
|
|
|
|
|
2013-10-20 16:00:12 +02:00
|
|
|
%changelog
|