Refactor spec file and make rhel rpms work again.

Refs #4075
This commit is contained in:
Michael Friedrich 2014-05-13 00:27:06 +02:00
parent 5da5dde602
commit 0594347566
6 changed files with 147 additions and 100 deletions

1
.gitignore vendored
View File

@ -5,6 +5,7 @@
!.gitattributes !.gitattributes
!.vagrant-puppet !.vagrant-puppet
!public/.htaccess !public/.htaccess
!packages/rhel/usr/share/icingaweb/public/.htaccess
!public/.htaccess.in !public/.htaccess.in
!.gitkeep !.gitkeep

View File

@ -1,14 +1,15 @@
# $Id$ # $Id$
# Authority: The icinga devel team <icinga-devel at lists.sourceforge.net> # Authority: The icinga devel team <icinga-devel at lists.icinga.org>
# Upstream: The icinga devel team <icinga-devel at lists.sourceforge.net> # Upstream: The icinga devel team <icinga-devel at lists.icinga.org>
# ExcludeDist: el4 el3 # ExcludeDist: el4 el3
%define revision 0 %define revision 0
%define configdir %{_sysconfdir}/icingaweb %define configdir %{_sysconfdir}/icingaweb
%define logdir %{_localstatedir}/log/icingaweb
%define sharedir %{_datadir}/icingaweb %define sharedir %{_datadir}/icingaweb
%define prefixdir %{_datadir}/icingaweb %define prefixdir %{_datadir}/icingaweb
%define logdir %{sharedir}/log
#%define logdir %{_localstatedir}/log/icingaweb
%if "%{_vendor}" == "suse" %if "%{_vendor}" == "suse"
%define phpname php5 %define phpname php5
@ -41,7 +42,7 @@
Summary: Open Source host, service and network monitoring Web UI Summary: Open Source host, service and network monitoring Web UI
Name: icingaweb2 Name: icingaweb2
Version: 1.0.0 Version: 0.0.1
Release: %{revision}%{?dist} Release: %{revision}%{?dist}
License: GPLv2 License: GPLv2
Group: Applications/System Group: Applications/System
@ -52,7 +53,7 @@ BuildArch: noarch
AutoReqProv: Off AutoReqProv: Off
%endif %endif
Source0: https://downloads.sourceforge.net/project/icinga/%{name}/%{version}/%{name}-%{version}.tar.gz Source0: icingaweb2-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
@ -92,108 +93,44 @@ Requires: %{phpname}-json
Requires: apache2-mod_php5 Requires: apache2-mod_php5
%endif %endif
Requires: %{name}-doc Requires: %{phpzendname}-Db-Adapter-Pdo
Requires: %{phpzendname}-Db-Adapter-Pdo-Mysql
Requires: php-Icinga
%description %description
IcingaWeb for Icinga 2 or Icinga 1.x using status data, IcingaWeb for Icinga 2 or Icinga 1.x using status data,
IDOUtils or Livestatus as backend provider. IDOUtils or Livestatus as backend provider.
%package config-internal-mysql %package -n icingacli
Summary: config for internal mysql database Summary: Icinga CLI
Group: Applications/System Group: Applications/System
Requires: %{name} = %{version}-%{release} Requires: %{name} = %{version}-%{release}
Requires: %{phpzendname}-Db-Adapter-Pdo Requires: php-Icinga
Requires: %{phpzendname}-Db-Adapter-Pdo-Mysql
%description config-internal-mysql %description -n icingacli
Configuration for internal mysql database. Icinga CLI using php-Icinga Icinga Web 2 backend.
%package config-internal-pgsql %package -n php-Icinga
Summary: config for internal pgsql database Summary: Icinga Web 2 PHP Libraries
Group: Applications/System Group: Applications/System
Requires: %{name} = %{version}-%{release} Requires: %{name} = %{version}-%{release}
Requires: %{phpzendname}-Db-Adapter-Pdo Requires: %{phpname} >= 5.3.0
Requires: %{phpzendname}-Db-Adapter-Pdo-Pgsql Requires: %{phpzendname}
%description config-internal-pgsql
Configuration for internal pgsql database.
%package config-backend-statusdata-1x %description -n php-Icinga
Summary: Backend config for status data Icinga Web 2 PHP Libraries shared with icingacli.
Group: Applications/System
Requires: %{name} = %{version}-%{release}
Provides: %{name}-config-statusdata
%description config-backend-statusdata-1x
Backend config for status data provided by Icinga 1.x Core.
%package config-backend-ido-mysql-1x
Summary: Backend config for icinga 1.x ido mysql database
Group: Applications/System
Requires: %{name} = %{version}-%{release}
Requires: %{phpname}-mysql
Provides: %{name}-config-ido-mysql
%description config-backend-ido-mysql-1x
Backend config for ido mysql database provided by
Icinga 1.x IDOUtils with MySQL.
%package config-backend-ido-pgsql-1x
Summary: Backend config for icinga 1.x ido pgsql database
Group: Applications/System
Requires: %{name} = %{version}-%{release}
Requires: %{phpname}-pgsql
Provides: %{name}-config-ido-pgsql
%description config-backend-ido-pgsql-1x
Backend config for ido mysql database provided by
Icinga 1.x IDOUtils with PostgreSQL.
%package config-backend-livestatus-1x
Summary: Backend config for icinga 1.x livestatus
Group: Applications/System
Requires: %{name} = %{version}-%{release}
Provides: %{name}-config-livestatus
%description config-backend-livestatus-1x
Backend config for livestatus provided by Icinga 1.x
with mk_livestatus NEB module.
%package config-backend-commands-1x
Summary: Backend config for icinga 1.x commands
Group: Applications/System
Requires: %{name} = %{version}-%{release}
Provides: %{name}-config-commands
%description config-backend-commands-1x
Backend config for external command pipe provided by
Icinga 1.x
%prep %prep
%setup -q -n %{name}-%{version} #%setup -q -n %{name}-%{version}
%setup -q -n %{name}
%build %build
%configure \
--prefix="%{prefixdir}" \
--datadir="%{sharedir}" \
--datarootdir="%{sharedir}" \
--sysconfdir="%{configdir}" \
--with-icingaweb-config-path='%{configdir}' \
--with-icingaweb-log-path='%{logdir}' \
--with-web-path='/icingaweb' \
--with-httpd-config-path=%{apacheconfdir} \
--with-web-user='%{apacheuser}' \
--with-web-group='%{apachegroup}' \
--with-internal-db-type='mysql' \
--with-internal-db-name='icingaweb' \
--with-internal-db-host='localhost' \
--with-internal-db-port='3306' \
--with-internal-db-pass='icingaweb' \
--with-internal-db-user='icingaweb' \
--with-internal-authentication=yes \
--with-icinga-commandpipe='%{extcmdfile1x}' \
--with-livestatus-socket='%{livestatussocket1x}'
cat > README.RHEL.SUSE <<"EOF" cat > README.RHEL.SUSE <<"EOF"
IcingaWeb for RHEL and SUSE IcingaWeb for RHEL and SUSE
@ -205,17 +142,40 @@ EOF
%install %install
[ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot} [ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot}
%{__mkdir} -p %{buildroot}/%{apacheconfdir}
%{__make} install \
install-apache-config \
DESTDIR="%{buildroot}" \
INSTALL_OPTS="" \
COMMAND_OPTS="" \
INSTALL_OPTS_WEB="" \
INIT_OPTS=""
# prepare configuration for sub packages # prepare configuration for sub packages
# install rhel apache config
install -D -m0644 packages/rhel/etc/httpd/conf.d/icingaweb.conf %{buildroot}/%{apacheconfdir}/icingaweb.conf
# install public, library, modules
%{__mkdir} -p %{buildroot}/%{sharedir}
%{__mkdir} -p %{buildroot}/%{logdir}
%{__mkdir} -p %{buildroot}/%{_sysconfdir}/icingaweb/enabledModules
%{__cp} -r application library modules public %{buildroot}/%{sharedir}/
# install index.php, .htaccess
install -m0644 packages/rhel/usr/share/icingaweb/public/index.php %{buildroot}/%{sharedir}/public/index.php
install -m0644 packages/rhel/usr/share/icingaweb/public/.htaccess %{buildroot}/%{sharedir}/public/.htaccess
# use the vagrant config for configuration for now - TODO
%{__cp} -r .vagrant-puppet/files/etc/icingaweb %{buildroot}/%{_sysconfdir}/
# we use the default 'icinga' database
sed -i 's/icinga2/icinga/g' %{buildroot}/%{_sysconfdir}/icingaweb/resources.ini
# enable the monitoring module by default
ln -s %{_sysconfdir}/icingaweb/modules/monitoring %{buildroot}/%{_sysconfdir}/icingaweb/enabledModules/monitoring
# install icingacli
install -D -m0755 bin/icingacli %{buildroot}/usr/bin/icingacli
# install sql schema files as example
# delete all *.in files
rm -f %{buildroot}/%{_datadir}/%{name}/public/index.php.in
rm -f %{buildroot}/%{_datadir}/%{name}/public/.htaccess.in
%pre %pre
# Add apacheuser in the icingacmd group # Add apacheuser in the icingacmd group
@ -243,11 +203,9 @@ fi
%files %files
# main dirs # main dirs
%defattr(-,root,root) %defattr(-,root,root)
%doc etc/schema doc README.RHEL.SUSE %doc etc/schema doc packages/rhel/README
%{sharedir}/application %attr(755,%{apacheuser},%{apachegroup}) %{sharedir}/public
%{sharedir}/library %attr(755,%{apacheuser},%{apachegroup}) %{sharedir}/modules
%{sharedir}/public
%{sharedir}/modules
# configs # configs
%defattr(-,root,root) %defattr(-,root,root)
%config(noreplace) %attr(-,root,root) %{apacheconfdir}/icingaweb.conf %config(noreplace) %attr(-,root,root) %{apacheconfdir}/icingaweb.conf
@ -256,7 +214,14 @@ fi
# logs # logs
%attr(2775,%{apacheuser},%{apachegroup}) %dir %{logdir} %attr(2775,%{apacheuser},%{apachegroup}) %dir %{logdir}
%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
%changelog %changelog
* Sun Oct 20 2013 Michael Friedrich <michael.friedrich@netways.de> - 1.0.0-1 * Tue May 11 2014 Michael Friedrich <michael.friedrich@netways.de> - 0.0.1-1
- initial creation - initial creation

57
packages/rhel/README Normal file
View File

@ -0,0 +1,57 @@
Requirements
============
Disabled SELinux for sending commands via external command pipe
provided by Icinga (2) Core.
# setenforce 0
Webinterface Login
==================
The default credentials using the internal MySQL database are
icingaadmin:icinga
Internal MySQL DB Setup
=======================
# mysql -u root -p
CREATE USER `icingaweb`@`localhost` IDENTIFIED BY 'icingaweb';
CREATE DATABASE `icingaweb`;
GRANT ALL PRIVILEGES ON `icingaweb`.* TO `icingaweb`@`localhost`;
FLUSH PRIVILEGES;
quit
# mysql icingaweb < /usr/share/doc/icingaweb2-*/schema/accounts.mysql.sql
# mysql icingaweb < /usr/share/doc/icingaweb2-*/schema/preferences.mysql.sql
Modules
=======
The monitoring module is enabled by default.
Backend configuration
=====================
/etc/icingaweb/resources.ini
contains the database backend information. By default
the Icinga IDO DB is used by the monitoring module in
/etc/icingaweb/modules/monitoring/backends.ini
The external command pipe is required for sending commands
and configured for Icinga 2 in
/etc/icingaweb/modules/monitoring/instances.ini
Support
=======
Please use one of the listed support channels at https://support.icinga.org

View File

@ -0,0 +1,12 @@
Alias /icingaweb /usr/share/icingaweb/public
<Directory "/usr/share/icingaweb/public">
Options -Indexes
AllowOverride All
Order allow,deny
Allow from all
EnableSendfile Off
</Directory>

View File

@ -0,0 +1,7 @@
RewriteEngine on
RewriteBase /icingaweb
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

View File

@ -0,0 +1,5 @@
<?php
$_ENV['ICINGAWEB_CONFIGDIR'] = '/etc/icingaweb';
require_once dirname(__DIR__). '/library/Icinga/Application/webrouter.php';