1 |
# $Id: ocsinventory.spec,v 1.2 2009/03/02 23:53:29 slords Exp $ |
2 |
# Authority: vip-ire |
3 |
# Name: Daniel Berteaud |
4 |
|
5 |
%if %{?fedora}%{?rhel} >= 5 |
6 |
%define useselinux 1 |
7 |
%else |
8 |
%define useselinux 0 |
9 |
%endif |
10 |
|
11 |
%define tarname OCSNG_UNIX_SERVER_1.02RC3 |
12 |
|
13 |
Name: ocsinventory |
14 |
Summary: Open Computer and Software Inventory Next Generation |
15 |
|
16 |
Version: 1.02 |
17 |
Release: 0.10.rc3%{?dist}.2 |
18 |
|
19 |
Group: Applications/Internet |
20 |
License: GPLv2 |
21 |
URL: http://www.ocsinventory-ng.org/ |
22 |
|
23 |
Source0: http://downloads.sourceforge.net/%{name}/%{tarname}.tar.gz |
24 |
Source1: ocsinventory-reports.conf |
25 |
|
26 |
# Database Schema |
27 |
# http://ocsinventory.svn.sourceforge.net/viewvc/ocsinventory/trunk/server/ocsreports/files/ocsbase.sql?r1=1390&r2=1413&view=patch |
28 |
Patch0: ocsinventory-r1413.patch |
29 |
# Update Script |
30 |
# http://ocsinventory.svn.sourceforge.net/viewvc/ocsinventory/trunk/server/ocsreports/install.php?r1=1108&r2=1423&view=patch |
31 |
Patch1: ocsinventory-r1423.patch |
32 |
# Missing Include |
33 |
# http://ocsinventory.svn.sourceforge.net/viewvc/ocsinventory/trunk/server/Apache/Ocsinventory/Server/Inventory.pm?r1=1035&r2=1447&pathrev=1447&sortby=date&view=patch |
34 |
Patch2: ocsinventory-r1447.patch |
35 |
# Clean XML |
36 |
# http://ocsinventory.svn.sourceforge.net/viewvc/ocsinventory/trunk/server/Apache/Ocsinventory/Interface/Inventory.pm?r1=981&r2=1462&pathrev=1462&sortby=date&view=patch |
37 |
Patch3: ocsinventory-r1462.patch |
38 |
|
39 |
BuildArch: noarch |
40 |
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) |
41 |
BuildRequires: perl(ExtUtils::MakeMaker) |
42 |
BuildRequires: perl(Apache::DBI) |
43 |
BuildRequires: perl(DBD::mysql) |
44 |
BuildRequires: perl(Net::IP) |
45 |
BuildRequires: perl(XML::Simple) |
46 |
|
47 |
# Main package is a dummy package |
48 |
Requires: ocsinventory-server = %{version}-%{release} |
49 |
Requires: ocsinventory-reports = %{version}-%{release} |
50 |
Requires: mysql-server |
51 |
|
52 |
|
53 |
%description |
54 |
Open Computer and Software Inventory Next Generation is an application |
55 |
designed to help a network or system administrator keep track of the |
56 |
computers configuration and software that are installed on the network. |
57 |
|
58 |
OCS Inventory is also able to detect all active devices on your network, |
59 |
such as switch, router, network printer and unattended devices. |
60 |
|
61 |
OCS Inventory NG includes package deployment feature on client computers. |
62 |
|
63 |
ocsinventory is a metapackage that will install the communication server, |
64 |
the administration console and the database server (MySQL). |
65 |
|
66 |
%description -l fr |
67 |
Open Computer and Software Inventory Next Generation est une application |
68 |
destinée à aider l'administrateur système ou réseau à garder un oeil |
69 |
sur la configuration des machines du réseau et sur les logiciels qui y |
70 |
sont installés. |
71 |
|
72 |
OCS Inventory est aussi capable de détecter tout périphérique actif sur |
73 |
le réseau, comme les commutateurs, routeurs, imprimantes et autres matériels |
74 |
autonomes. |
75 |
|
76 |
OCS Inventory NG intègre des fonctionnalités de télédiffusion de paquets |
77 |
sur les machines clients. |
78 |
|
79 |
ocsinventory est un metapaquet qui installera le serveur de communication, |
80 |
la console d'administration et le serveur de base de données (MySQL). |
81 |
|
82 |
%package server |
83 |
Group: Applications/Internet |
84 |
Summary: OCS Inventory NG - Communication server |
85 |
Requires: mod_perl |
86 |
%if 0%{?rhel} != 4 |
87 |
# when use with mod_perl2 |
88 |
Requires: perl(SOAP::Transport::HTTP2) |
89 |
%endif |
90 |
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) |
91 |
# Required by the original setup script, but not detected automatically : |
92 |
# Apache::DBI drags in DBI |
93 |
Requires: perl(Apache::DBI) |
94 |
Requires: perl(Net::IP) |
95 |
Requires: perl(DBD::mysql) |
96 |
# Optional, not detected automatically : |
97 |
Requires: perl(SOAP::Lite) |
98 |
Requires: perl(XML::Entities) |
99 |
%if %{useselinux} |
100 |
Requires: policycoreutils |
101 |
%endif |
102 |
|
103 |
%description server |
104 |
This package provides the Communication server, which will handle HTTP |
105 |
communications between database server and agents. |
106 |
|
107 |
%description -l fr server |
108 |
Ce paquet fournit le serveur de communication (Communication server), |
109 |
qui gère les communications HTTP entre les agents et le serveur de base |
110 |
de données. |
111 |
|
112 |
|
113 |
%package reports |
114 |
Group: Applications/Internet |
115 |
Summary: OCS Inventory NG - Communication server |
116 |
# From PHP_Compat : date, mysql, ereg, pcre, zip, hash, xml, gd, zlib |
117 |
Requires: php |
118 |
Requires: php-mysql php-zip php-gd |
119 |
%if 0%{?rhel} == 4 |
120 |
Requires: php-domxml |
121 |
%else |
122 |
Requires: php-xml |
123 |
%endif |
124 |
# Required by the original setup script, but not detected automatically : |
125 |
Requires: perl(DBD::mysql) |
126 |
# Required by ipdiscover-util.pl (nmap and nmblookup) |
127 |
Requires: nmap samba-client |
128 |
%if %{useselinux} |
129 |
Requires: policycoreutils |
130 |
%endif |
131 |
|
132 |
%description reports |
133 |
This package provides the Administration console, which will allow |
134 |
administrators to query the database server through their favorite browser. |
135 |
|
136 |
%description -l fr reports |
137 |
Ce paquet fournit la console d'administration (Administration console), |
138 |
qui autorise les administrateurs à interroger la base de données via leur |
139 |
navigateur favori. |
140 |
|
141 |
|
142 |
%prep |
143 |
%setup -q -n %{tarname} |
144 |
|
145 |
%patch0 -p2 |
146 |
%patch1 -p2 |
147 |
%patch2 -p2 |
148 |
%patch3 -p2 |
149 |
|
150 |
|
151 |
%build |
152 |
cd Apache |
153 |
%{__perl} Makefile.PL INSTALLDIRS=vendor |
154 |
make %{?_smp_mflags} |
155 |
|
156 |
|
157 |
%install |
158 |
rm -rf %{buildroot} |
159 |
|
160 |
# --- ocsinventory-server --- communication server |
161 |
cd Apache |
162 |
make pure_install PERL_INSTALL_ROOT=%{buildroot} |
163 |
find %{buildroot} -type f -name .packlist -exec rm -f {} ';' |
164 |
find %{buildroot} -type d -depth -exec rmdir {} 2>/dev/null ';' |
165 |
|
166 |
chmod -R u+rwX,go+rX,go-w %{buildroot}/* |
167 |
find %{buildroot}%{perl_vendorlib}/Apache -name \*.pm -exec chmod -x {} \; |
168 |
|
169 |
%if 0%{?rhel} == 4 |
170 |
# To avoid bad dependency on perl(mod_perl2) |
171 |
rm -f %{buildroot}%{perl_vendorlib}/Apache/Ocsinventory/Server/Modperl2.pm |
172 |
%else |
173 |
# To avoid bad dependency on perl(mod_perl) : RHEL >= 5 && Fedora >= 4 |
174 |
rm -f %{buildroot}%{perl_vendorlib}/Apache/Ocsinventory/Server/Modperl1.pm |
175 |
%endif |
176 |
|
177 |
%{__mkdir_p} %{buildroot}%{_localstatedir}/log/ocsinventory-server |
178 |
|
179 |
%{__mkdir_p} %{buildroot}%{_sysconfdir}/logrotate.d |
180 |
%{__sed} -e 's;PATH_TO_LOG_DIRECTORY;%{_localstatedir}/log/ocsinventory-server;' \ |
181 |
./etc/logrotate.d/ocsinventory-server >%{buildroot}%{_sysconfdir}/logrotate.d/ocsinventory-server |
182 |
|
183 |
# default configuration (localhost) should work on "simple" installation |
184 |
%{__mkdir_p} %{buildroot}%{_sysconfdir}/httpd/conf.d |
185 |
%{__sed} -e "s;DATABASE_SERVER;localhost;g" \ |
186 |
-e "s;DATABASE_PORT;3306;g" \ |
187 |
%if 0%{?rhel} == 4 |
188 |
-e "s;VERSION_MP;1;g" \ |
189 |
%else |
190 |
-e "s;VERSION_MP;2;g" \ |
191 |
%endif |
192 |
-e "s;PATH_TO_LOG_DIRECTORY;%{_localstatedir}/log/ocsinventory-server;g" \ |
193 |
./etc/ocsinventory/ocsinventory-server.conf | \ |
194 |
grep -v IfModule >%{buildroot}%{_sysconfdir}/httpd/conf.d/ocsinventory-server.conf |
195 |
cd .. |
196 |
|
197 |
# --- ocsinventory-reports --- administration console |
198 |
|
199 |
%{__mkdir_p} %{buildroot}/%{_datadir}/ocsinventory-reports |
200 |
cp -ar ocsreports %{buildroot}/%{_datadir}/ocsinventory-reports |
201 |
find %{buildroot}/%{_datadir}/ocsinventory-reports \( -name \*.php -o -name \*.css \) -exec chmod -x {} \; |
202 |
|
203 |
%{__mkdir_p} %{buildroot}/%{_sysconfdir}/ocsinventory/ocsinventory-reports |
204 |
|
205 |
mv %{buildroot}/%{_datadir}/ocsinventory-reports/ocsreports/dbconfig.inc.php \ |
206 |
%{buildroot}/%{_sysconfdir}/ocsinventory/ocsinventory-reports/dbconfig.inc.php |
207 |
ln -s ../../../../%{_sysconfdir}/ocsinventory/ocsinventory-reports/dbconfig.inc.php %{buildroot}/%{_datadir}/ocsinventory-reports/ocsreports/dbconfig.inc.php |
208 |
|
209 |
%{__mkdir_p} %{buildroot}%{_localstatedir}/lib/ocsinventory-reports/{download,ipd} |
210 |
|
211 |
%{__install} -pm 755 Apache/binutils/ipdiscover-util.pl %{buildroot}/%{_datadir}/ocsinventory-reports/ocsreports/ipdiscover-util.pl |
212 |
|
213 |
%{__mkdir_p} %{buildroot}%{_sysconfdir}/httpd/conf.d |
214 |
%{__sed} -e "s;OCSREPORTS_ALIAS;/ocsreports;g" \ |
215 |
-e "s;PATH_TO_OCSREPORTS_DIR;%{_datadir}/ocsinventory-reports/ocsreports;g" \ |
216 |
-e "s;PACKAGES_ALIAS;/download;g" \ |
217 |
-e "s;PATH_TO_PACKAGES_DIR;%{_localstatedir}/lib/ocsinventory-reports/download;g" \ |
218 |
%{SOURCE1} >%{buildroot}%{_sysconfdir}/httpd/conf.d/ocsinventory-reports.conf |
219 |
|
220 |
|
221 |
%clean |
222 |
rm -rf %{buildroot} |
223 |
|
224 |
|
225 |
%post server |
226 |
%if %{useselinux} |
227 |
( |
228 |
# New File context |
229 |
semanage fcontext -a -s system_u -t httpd_log_t -r s0 "%{_localstatedir}/log/ocsinventory-server(/.*)?" |
230 |
# files created by app |
231 |
restorecon -R %{_localstatedir}/log/ocsinventory-server |
232 |
) &>/dev/null ||: |
233 |
%endif |
234 |
|
235 |
|
236 |
%post reports |
237 |
%if %{useselinux} |
238 |
( |
239 |
# New File context |
240 |
semanage fcontext -a -s system_u -t httpd_sys_script_rw_t -r s0 "%{_sysconfdir}/ocsinventory/ocsinventory-reports(/.*)?" |
241 |
semanage fcontext -a -s system_u -t httpd_sys_script_rw_t -r s0 "%{_localstatedir}/lib/ocsinventory-reports(/.*)?" |
242 |
# files created by app |
243 |
restorecon -R %{_sysconfdir}/ocsinventory/ocsinventory-reports |
244 |
restorecon -R %{_localstatedir}/lib/ocsinventory-reports |
245 |
) &>/dev/null ||: |
246 |
%endif |
247 |
|
248 |
|
249 |
%postun server |
250 |
%if %{useselinux} |
251 |
if [ "$1" -eq "0" ]; then |
252 |
# Remove the File Context |
253 |
semanage fcontext -d "%{_localstatedir}/log/ocsinventory-server(/.*)?" &>/dev/null || : |
254 |
fi |
255 |
%endif |
256 |
|
257 |
|
258 |
%postun reports |
259 |
%if %{useselinux} |
260 |
if [ "$1" -eq "0" ]; then |
261 |
# Remove the File Context |
262 |
semanage fcontext -d "%{_sysconfdir}/ocsinventory/ocsinventory-reports(/.*)?" &>/dev/null ||: |
263 |
semanage fcontext -d "%{_localstatedir}/lib/ocsinventory-reports(/.*)?" &>/dev/null ||: |
264 |
fi |
265 |
%endif |
266 |
|
267 |
|
268 |
%files |
269 |
%defattr(-, root, root, -) |
270 |
|
271 |
|
272 |
%files server |
273 |
%defattr(-, root, root, -) |
274 |
%doc LICENSE.txt README |
275 |
%config(noreplace) %{_sysconfdir}/logrotate.d/ocsinventory-server |
276 |
%config(noreplace) %{_sysconfdir}/httpd/conf.d/ocsinventory-server.conf |
277 |
%attr(755,www,root) %{_localstatedir}/log/ocsinventory-server |
278 |
%{perl_vendorlib}/Apache |
279 |
|
280 |
|
281 |
%files reports |
282 |
%defattr(-, root, root, -) |
283 |
%doc LICENSE.txt README |
284 |
%dir %{_sysconfdir}/ocsinventory |
285 |
%dir %{_sysconfdir}/ocsinventory/ocsinventory-reports |
286 |
%attr(640,www,root) %config(noreplace) %{_sysconfdir}/ocsinventory/ocsinventory-reports/dbconfig.inc.php |
287 |
%config(noreplace) %{_sysconfdir}/httpd/conf.d/ocsinventory-reports.conf |
288 |
%{_datadir}/ocsinventory-reports |
289 |
%attr(755,www,root) %dir %{_localstatedir}/lib/ocsinventory-reports |
290 |
%attr(755,www,root) %dir %{_localstatedir}/lib/ocsinventory-reports/ipd |
291 |
%attr(755,www,root) %dir %{_localstatedir}/lib/ocsinventory-reports/download |
292 |
|
293 |
|
294 |
%changelog |
295 |
* Wed Mar 13 2009 Daniel B. <daniel@firewall-services.com> 1.02-0.10.rc3.el4.2 |
296 |
- Changes for SME Server (apache=>www) |
297 |
|
298 |
* Sun Jan 18 2009 Remi Collet <Fedora@famillecollet.com> 1.02-0.10.rc3.el4.1 |
299 |
- fix php-xml > php-domxml in EL-4 |
300 |
|
301 |
* Sun Jan 11 2009 Remi Collet <Fedora@famillecollet.com> 1.02-0.10.rc3 |
302 |
- add r1447 and r1462 patch |
303 |
- change log selinux context (httpd_log_t) |
304 |
|
305 |
* Fri Oct 17 2008 Remi Collet <Fedora@famillecollet.com> 1.02-0.9.rc3 |
306 |
- upstream r1423 patch - migration script |
307 |
|
308 |
* Sat Oct 11 2008 Remi Collet <Fedora@famillecollet.com> 1.02-0.8.rc3 |
309 |
- upstream r1413 patch - database schema |
310 |
|
311 |
* Sat Oct 11 2008 Remi Collet <Fedora@famillecollet.com> 1.02-0.7.rc3 |
312 |
- update to RC3 |
313 |
|
314 |
* Tue Jul 22 2008 Remi Collet <Fedora@famillecollet.com> 1.02-0.6.rc2 |
315 |
- add missing requires perl(SOAP::Transport::HTTP2) (with mod_perl2) |
316 |
- AddDefaultCharset ISO-8859-1 in httpd config |
317 |
- fix SElinux path |
318 |
|
319 |
* Sat Jun 14 2008 Remi Collet <Fedora@famillecollet.com> 1.02-0.5.rc2 |
320 |
- change dir from /var/lib/ocsinventory-server to /var/lib/ocsinventory-reports |
321 |
- add Requires nmap and samba-client (nmblookup) |
322 |
|
323 |
* Sun May 18 2008 Remi Collet <Fedora@famillecollet.com> 1.02-0.4.rc2 |
324 |
- remove <IfModule> from ocsinventory-server.conf |
325 |
- change perm to 755 on /var/lib/ocsinventory-server |
326 |
- metapackage description closer to upstream components name |
327 |
- add BR perl(DBD::mysql) to avoid build warning |
328 |
|
329 |
* Fri May 16 2008 Xavier Bachelot <xavier@bachelot.org> 1.02-0.3.rc2.1 |
330 |
- Fix BuildRequires and Requires. |
331 |
- Fix %%description french translations and a few typos. |
332 |
- Rename apache confs. |
333 |
|
334 |
* Sat May 10 2008 Remi Collet <Fedora@famillecollet.com> 1.02-0.3.rc2 |
335 |
- add missing requires for php extensions (from PHP_Compat result) |
336 |
- add selinux stuff |
337 |
|
338 |
* Thu May 08 2008 Remi Collet <Fedora@famillecollet.com> 1.02-0.2.rc2 |
339 |
- update to RC2 |
340 |
|
341 |
* Sun Mar 15 2008 Remi Collet <Fedora@famillecollet.com> 1.02-0.2.rc1 |
342 |
- fix download dir |
343 |
|
344 |
* Sat Mar 8 2008 Remi Collet <Fedora@famillecollet.com> 1.02-0.1.rc1 |
345 |
- Initial RPM |
346 |
|