File glpi.spec of Package glpi

# spec file for package glpi
# Copyright (c) 2011 SUSE LINUX Products 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

Name:           glpi
Version:        0.83.7
Release:        0
Summary:        A technical management solution of IT assets
License:        GPL-2.0+
Group:          Productivity/Networking/Other
Source:         OCSNG_UNIX_SERVER-%{version}.tar.bz2
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       apache2-mod_php5
Requires:       logrotate
Requires:       mysql-server
Requires:       php5-curl
Requires:       php5-dom
Requires:       php5-gd
Requires:       php5-openssl
Requires:       php5-ldap
Requires:       php5-imap
Requires:       php5-zlib
Requires:       php5-mysql
Requires:       php5-mbstring
Requires:       php5-xml
Requires:       php5-json
BuildArch:      noarch

Open Computers and Software Inventory Next Generation is a technical
management solution of IT assets.

Since 2001, OCS Inventory NG tries to make the automated inventory
of computer hardware more efficiently .
Today, our solution not only extends to the inventory. It includes a
sophisticated deployment system, interfacing with third tier
applications, a network devices scans, and more...

%setup -q -n %{name}
# Fix script-without-shebang.
find -name '*.php' -o -name '*.css' -o -name '*.js' -o -name '*.txt' -o -name '*.sql' | xargs chmod -x

cd Apache
%{__perl} Makefile.PL INSTALLDIRS=vendor
%{__make} %{?_smp_mflags}

pushd Apache

# OCS Inventory NG - Communication Server Setup
# Install log dir.
%{__install} -d %{buildroot}%{_localstatedir}/log/ocsinventory-server
# Apache permissions on log files???

# Logrotate configuration.
%{__sed} -i 's|PATH_TO_LOG_DIRECTORY|%{_localstatedir}/log/ocsinventory-server|' etc/logrotate.d/ocsinventory-server
%{__install} -D -m 644 etc/logrotate.d/ocsinventory-server %{buildroot}%{_sysconfdir}/logrotate.d/ocsinventory-server

# Apache configuration file.
            -e 's|OCS_DB_HOST DATABASE_SERVER|OCS_DB_HOST localhost|' \
            -e 's|OCS_DB_PORT DATABASE_PORT|OCS_DB_PORT 3306|' \
            -e 's|PATH_TO_LOG_DIRECTORY|%{_localstatedir}/log/ocsinventory-server|' etc/ocsinventory/ocsinventory-server.conf

%{__install} -D -m 644 etc/ocsinventory/ocsinventory-server.conf %{buildroot}%{_sysconfdir}/apache2/conf.d/ocsinventory-server.conf

# OCS Inventory NG - Reports Server Setup
%{__install} -d %{buildroot}%{_localstatedir}/lib/ocsinventory-reports/{ipd,download,snmp}
%{__install} -d %{buildroot}/srv/www/htdocs/ocsreports

%{__cp} -r ocsreports/* %{buildroot}/srv/www/htdocs/ocsreports/

%{__install} -m 755 binutils/ %{buildroot}/srv/www/htdocs/ocsreports/
%{__install} -D -m 644 etc/ocsinventory/snmp_com.txt %{buildroot}%{_localstatedir}/lib/ocsinventory-reports/snmp/snmp_com.txt

# Apache configuration file.
%{__sed} -i -e 's|OCSREPORTS_ALIAS|/oscreports|g' \
            -e 's|PATH_TO_OCSREPORTS_DIR|/srv/www/htdocs/oscreports|g' \
            -e 's|PACKAGES_ALIAS|/download|' \
            -e 's|PATH_TO_PACKAGES_DIR|%{_localstatedir}/lib/ocsinventory-reports/download|' etc/ocsinventory/ocsinventory-reports.conf

%{__install} -D -m 644 etc/ocsinventory/ocsinventory-reports.conf %{buildroot}%{_sysconfdir}/apache2/conf.d/ocsinventory-reports.conf

%files -f %{name}.files
%dir /etc/apache2
%dir /etc/apache2/conf.d
%attr(750,root,root) %dir %{_localstatedir}/log/ocsinventory-server
%config(noreplace) %{_sysconfdir}/logrotate.d/ocsinventory-server
%config(noreplace) %{_sysconfdir}/apache2/conf.d/ocsinventory-server.conf
%config(noreplace) %{_sysconfdir}/apache2/conf.d/ocsinventory-reports.conf

%attr(640,wwwrun,root) %config(noreplace) /srv/www/htdocs/ocsreports/
%attr(644,wwwrun,root) %dir %{_localstatedir}/lib/ocsinventory-reports/snmp/snmp_com.txt

%dir %{_localstatedir}/lib/ocsinventory-reports
%dir %{_localstatedir}/lib/ocsinventory-reports/ipd
%dir %{_localstatedir}/lib/ocsinventory-reports/download
%dir %{_localstatedir}/lib/ocsinventory-reports/snmp