Blob Blame History Raw
%if %{?fedora}%{?rhel} >= 5
%define useselinux 1
%else
%define useselinux 0
%endif

Name:           glpi
Version:        0.71.5
Release:        3%{?dist}
Summary:        Free IT asset management software
Summary(fr):    Gestion Libre de Parc Informatique

Group:          Applications/Internet
License:        GPLv2+
URL:            http://www.glpi-project.org/
Source0:        http://www.glpi-project.org/IMG/gz/%{name}-%{version}.tar.gz

Source1:        glpi-httpd.conf
Source2:        glpi-config_path.php
Source3:        glpi-logrotate

# Avoid SELinux AVC when testing write access to log file.
# backport from 0.72 (Changeset 7208)
Patch0:         glpi-check.patch

# Post 0.71.5 patches from SVN
# https://dev.indepnet.net/glpi/changeset?format=diff&new=8236&old=7910&new_path=branches/0.71-bugfixes&old_path=branches/0.71-bugfixes
Patch1:         glpi-0.71.5.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch:      noarch

Requires:       php, php-mysql, httpd, php-gd, php-ldap, php-imap
%if 0%{?rhel} == 4
Requires:       php-domxml
%else
Requires:       php-xml
Requires:       php-pear(Cache_Lite) >= 1.7.4
%endif
Requires:       %{_sysconfdir}/logrotate.d
Requires(postun): /sbin/service
Requires(post): /sbin/service
BuildRequires:  dos2unix
%if %{useselinux}
Requires:       policycoreutils
%endif
Requires:       %{_sysconfdir}/cron.d


%description
GLPI is the Information Resource-Manager with an additional Administration-
Interface. You can use it to build up a database with an inventory for your 
company (computer, software, printers...). It has enhanced functions to make
the daily life for the administrators easier, like a job-tracking-system with
mail-notification and methods to build a database with basic information 
about your network-topology.


%description -l fr
GLPI est une application libre, distribuée sous licence GPL destinée à la
gestion de parc informatique et de helpdesk.

GLPI est composé d’un ensemble de services web écrits en PHP qui permettent
de recenser et de gérer l’intégralité des composantes matérielles ou 
logicielles d’un parc informatique, et ainsi d’optimiser le travail des
techniciens grâce à une maintenance plus cohérente.


%prep
%setup -q -n glpi

%patch0 -p0
%patch1 -p2

%if 0%{?rhel} == 4

# use bundled lib
mv lib/cache_lite/LICENSE   LICENSE.cache_lite
grep -v GLPI_CACHE_LITE_DIR %{SOURCE2} >config/config_path.php 

%else

# Use system lib
rm -rf lib/cache_lite
cp %{SOURCE2} config/config_path.php 

%endif

mv lib/phpmailer/LICENSE    LICENSE.phpmailer
mv lib/tiny_mce/license.txt LICENSE.tiny_mce
dos2unix -o LICENSE.phpmailer LICENSE.tiny_mce
iconv -f ISO-8859-15 -t UTF-8 LISEZMOI.txt >a && mv a LISEZMOI.txt
iconv -f ISO-8859-15 -t UTF-8 README.txt   >a && mv a README.txt

cat >cron <<EOF
# GLPI core
# Run cron from to execute task even when no user connected
*/4 * * * * apache %{_bindir}/php %{_datadir}/%{name}/front/cron.php
EOF


%build
# empty build


%install
rm -rf %{buildroot} 

# ===== application =====
mkdir -p %{buildroot}/%{_datadir}/%{name}
cp -a *.php *.js %{buildroot}/%{_datadir}/%{name}/

for i in ajax css front help inc install lib locales pics plugins scripts
do   cp -ar $i %{buildroot}/%{_datadir}/%{name}/$i
done

find %{buildroot}/%{_datadir}/%{name} -type f -exec chmod 644 {} \; 
# chmod 755 %{buildroot}/%{_datadir}/%{name}/scripts/*.sh

# ===== apache =====
mkdir -p %{buildroot}/%{_sysconfdir}/httpd/conf.d/
install --mode 644 %{SOURCE1} %{buildroot}/%{_sysconfdir}/httpd/conf.d/glpi.conf

# ===== config =====
cp -ar config %{buildroot}/%{_datadir}/%{name}/config

mkdir -p %{buildroot}/%{_sysconfdir}/%{name}
touch %{buildroot}%{_sysconfdir}/%{name}/config_db.php

# ===== files =====
mkdir -p %{buildroot}/%{_localstatedir}/lib/%{name}
cp -ar files %{buildroot}/%{_localstatedir}/lib/%{name}/files

# ===== log =====
mkdir -p %{buildroot}%{_localstatedir}/log
mv %{buildroot}/%{_localstatedir}/lib/%{name}/files/_log %{buildroot}%{_localstatedir}/log/%{name}

mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d
install -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}

# ====== Cron =====
mkdir -p %{buildroot}%{_sysconfdir}/cron.d
install -m 644 cron %{buildroot}%{_sysconfdir}/cron.d/%{name}

# cleanup
find %{buildroot} -name remove.txt -exec rm -f {} \; -print

# Directories not in apache space
rm -f %{buildroot}%{_localstatedir}/lib/%{name}/files/.htaccess
# Proctection in /etc/httpd/conf.d/glpi.conf
rm -f %{buildroot}%{_datadir}/%{name}/install/mysql/.htaccess
rm -f %{buildroot}%{_datadir}/%{name}/locales/.htaccess
rm -f %{buildroot}%{_datadir}/%{name}/config/.htaccess
rm -f %{buildroot}%{_datadir}/%{name}/scripts/.htaccess


# Lang
for i in %{buildroot}%{_datadir}/%{name}/locales/*
do
  lang=$(basename $i)
  echo "%lang(${lang:0:2}) %{_datadir}/%{name}/locales/${lang}"
done >%{name}.lang


%clean
rm -rf %{buildroot} 


%post
%if %{useselinux}
(
# Remove Selinux policy (from previous packaging)
semodule -s targeted -r %{name} &>/dev/null
# Remove old httpd_sys_script_rw_t
semanage fcontext -d "%{_localstatedir}/log/glpi(/.*)?"
# New File context
semanage fcontext -a -s system_u -t httpd_sys_script_rw_t -r s0 "%{_sysconfdir}/glpi(/.*)?" 
semanage fcontext -a -s system_u -t httpd_log_t           -r s0 "%{_localstatedir}/log/glpi(/.*)?"
# keep httpd_sys_script_rw_t (httpd_var_lib_t prevent dir creation)
semanage fcontext -a -s system_u -t httpd_sys_script_rw_t -r s0 "%{_localstatedir}/lib/glpi(/.*)?"
# files created by app
restorecon -R %{_sysconfdir}/%{name}
restorecon -R %{_localstatedir}/lib/%{name}
restorecon -R %{_localstatedir}/log/%{name}
) &>/dev/null
%endif
/sbin/service httpd condrestart > /dev/null 2>&1 || :


%postun
%if %{useselinux}
if [ "$1" -eq "0" ]; then
    # Remove the File Context
    (
    semanage fcontext -d "%{_sysconfdir}/glpi(/.*)?"
    semanage fcontext -d "%{_localstatedir}/log/glpi(/.*)?"
    semanage fcontext -d "%{_localstatedir}/lib/glpi(/.*)?"
    ) &>/dev/null
fi
%endif
/sbin/service httpd condrestart > /dev/null 2>&1 || :


%files -f %{name}.lang
%defattr(-,root,root,-)
%doc *.txt LICENSE.*

%attr(750,apache,root) %dir %{_sysconfdir}/%{name}
%ghost %config(noreplace,missingok) %{_sysconfdir}/%{name}/config_db.php
%config(noreplace) %{_sysconfdir}/httpd/conf.d/glpi.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%config(noreplace) %{_sysconfdir}/cron.d/%{name}

# This folder can contain private information (sessions, docs, ...)
%dir %_localstatedir/lib/%{name}
%attr(750,apache,root) %{_localstatedir}/lib/%{name}/files

%dir %{_datadir}/%{name}
%{_datadir}/%{name}/*.php
%{_datadir}/%{name}/*.js
%{_datadir}/%{name}/ajax
%{_datadir}/%{name}/config
%{_datadir}/%{name}/css
%{_datadir}/%{name}/front
%{_datadir}/%{name}/help
%{_datadir}/%{name}/inc
%{_datadir}/%{name}/install
%{_datadir}/%{name}/lib
%{_datadir}/%{name}/pics
%{_datadir}/%{name}/plugins
%{_datadir}/%{name}/scripts
%attr(750,apache,root) %dir %{_localstatedir}/log/%{name}
%dir %{_datadir}/%{name}/locales


%changelog
* Sun Apr 26 2009 Remi Collet <Fedora@FamilleCollet.com> - 0.71.5-3
- post 0.71.5 patches

* Tue Feb 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.71.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Mon Jan 26 2009 Remi Collet <Fedora@FamilleCollet.com> - 0.71.5-1
- update to 0.71.5 (Fix regression in 0.71.4)

* Mon Jan 26 2009 Remi Collet <Fedora@FamilleCollet.com> - 0.71.4-1
- update to 0.71.4 (Security Release)

* Sun Nov 30 2008 Remi Collet <Fedora@FamilleCollet.com> - 0.71.3-1
- update to 0.71.3 (bugfix release)

* Sun Sep 28 2008 Remi Collet <Fedora@FamilleCollet.com> - 0.71.2-1.el4.1
- Fix MySQL 4.1 compatibility issue

* Mon Sep 15 2008 Remi Collet <Fedora@FamilleCollet.com> - 0.71.2-1
- update to 0.71.2 bugfix

* Sat Aug 09 2008 Remi Collet <Fedora@FamilleCollet.com> - 0.71.1-2
- fix SElinux bug on install test (glpi-check.patch)
- add create option on logrotate conf

* Fri Aug 01 2008 Remi Collet <Fedora@FamilleCollet.com> - 0.71.1-1
- update to 0.71.1 bugfix
- use system cron
- increase memory_limit / max_execution_time for upgrade

* Fri Jul 11 2008 Remi Collet <Fedora@FamilleCollet.com> - 0.71-1
- update to 0.71 stable
- fix bug #452353 (selinux)

* Fri Apr 25 2008 Remi Collet <Fedora@FamilleCollet.com> - 0.70.2-3
- remplace module policy by simple semanage (#442706)

* Mon Jan 28 2008 Remi Collet <Fedora@FamilleCollet.com> - 0.70.2-2
- rebuild (fix sources tarball)

* Sun Jan 27 2008 Remi Collet <Fedora@FamilleCollet.com> - 0.70.2-1
- bugfixes update 

* Mon Jan 15 2008 Remi Collet <Fedora@FamilleCollet.com> - 0.70.1a-1
- update 

* Sun Jan 13 2008 Remi Collet <Fedora@FamilleCollet.com> - 0.70.1-2
- fix typo in lang files

* Sun Jan 13 2008 Remi Collet <Fedora@FamilleCollet.com> - 0.70.1-1
- update to 0.70.1 (0.70 + bugfixes)

* Thu Jan 03 2008 Remi Collet <Fedora@FamilleCollet.com> - 0.70-4
- Changeset 6226 + 6228
- disable SELinux in EL-5

* Sat Dec 29 2007 Remi Collet <Fedora@FamilleCollet.com> - 0.70-3
- Changeset 6191 + 6194 + 6196

* Fri Dec 28 2007 Remi Collet <Fedora@FamilleCollet.com> - 0.70-2
- Changeset 6190

* Fri Dec 21 2007 Remi Collet <Fedora@FamilleCollet.com> - 0.70-1
- 0.70 final

* Fri Nov 16 2007 Remi Collet <Fedora@FamilleCollet.com> - 0.70-0.4.rc3
- Release Candidate 3

* Thu Nov 01 2007 Remi Collet <Fedora@FamilleCollet.com> - 0.70-0.3.rc2
- correct source

* Thu Nov 01 2007 Remi Collet <Fedora@FamilleCollet.com> - 0.70-0.2.rc2
- Release Candidate 2

* Mon Oct 08 2007 Remi Collet <Fedora@FamilleCollet.com> - 0.70-0.2.rc1
- From review #322781 : fix Source0 and macros
- Requires php-domxml for EL4

* Sun Sep 30 2007 Remi Collet <Fedora@FamilleCollet.com> - 0.70-0.1.rc1
- GLPI Version 0.7-RC1
- initial SPEC for Fedora Review

* Thu May 03 2007 Remi Collet <RPMS@FamilleCollet.com> - 0.70-0.beta.20070503
- initial RPM