]> git.pld-linux.org Git - packages/cacti.git/blame - cacti.spec
- upgrade_database.php in %post
[packages/cacti.git] / cacti.spec
CommitLineData
bb0e5568
ER
1#
2# Conditional build:
3%bcond_without pa # without plugin archidecture patch
4
371dd804 5%define pia_ver 3.0
e90043f8 6%include /usr/lib/rpm/macros.perl
9f35c748 7Summary: Cacti is a PHP frontend for rrdtool
bf643d4f 8Summary(pl.UTF-8): Cacti - frontend w PHP do rrdtoola
94614147 9Name: cacti
371dd804 10Version: 0.8.7h
596d03c8 11Release: 2
6587a5d5 12License: GPL
94614147 13Group: Applications/WWW
761b4fb2 14Source0: http://www.cacti.net/downloads/%{name}-%{version}.tar.gz
371dd804 15# Source0-md5: 58c9371341f49a190ae11a85118e598d
a1abeca3 16Source2: %{name}.crontab
de4cec3c
GS
17Source3: %{name}-apache.conf
18Source4: %{name}-lighttpd.conf
19Source5: %{name}-rrdpath.sql
817cc464 20Source6: %{name}-pa.sql
af389505 21Source7: %{name}.logrotate
d7378ed4 22# http://docs.cacti.net/manual:087:1_installation.9_pia
d839b321 23Source8: http://www.cacti.net/downloads/pia/%{name}-plugin-%{version}-PA-v%{pia_ver}.tar.gz
371dd804 24# Source8-md5: 1f45a65dc76dee368b11f2c78ae89dfb
8466638a 25# NOTE: update provides: cacti(pia) when updating the patch
8514c08f 26Patch0: %{name}-PA.patch
de4cec3c
GS
27Patch1: %{name}-config.patch
28Patch2: %{name}-adodb.patch
29Patch3: %{name}-ioerror.patch
30Patch4: %{name}-webroot.patch
31Patch5: %{name}-linux_memory.patch
32Patch6: %{name}-log-verbosity.patch
33Patch7: %{name}-ss_disk-array-indices.patch
ac01d3f9 34Patch8: host_name-url.patch
e79e3b18 35# http://www.cacti.net/download_patches.php
371dd804 36#Patch10: none now
761b4fb2 37URL: http://www.cacti.net/
89aea3b3 38BuildRequires: rpm-perlprov
344e658b 39BuildRequires: sed >= 4.0
f4a0dd1f
ER
40Requires(postun): /usr/sbin/userdel
41Requires(pre): /bin/id
42Requires(pre): /usr/sbin/useradd
f44cea91 43Requires: adodb >= 4.67-1.17
e9300b9e 44Requires: crondaemon
f4a0dd1f 45Requires: group(http)
94614147 46Requires: net-snmp-utils
4e25427a 47Requires: php-cli
c5421ef6 48Requires: php-common >= 4:5.2.13-10
c5421ef6
ER
49Requires: php-mysql
50Requires: php-pcre
51Requires: php-session
52Requires: php-snmp
53Requires: php-xml
c8f292cd 54Requires: rrdtool
4b6cd69a 55Requires: webapps
e4f2f951 56Requires: webserver
cce68540 57Requires: webserver(access)
7d4ec5c1 58Requires: webserver(alias)
09dccb3a 59Requires: webserver(indexfile)
f5a0e42f 60Requires: webserver(php)
578edcb5 61Suggests: cacti-spine
24fa0556 62Suggests: php-gd
d839b321 63Provides: cacti(pia) = %{pia_ver}
f4a0dd1f 64Provides: user(cacti)
33c70cd1 65Obsoletes: cacti-add_template
9f8f6fd2 66Obsoletes: cacti-plugin-update
6587a5d5 67BuildArch: noarch
94614147
JB
68BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
69
4b6cd69a
ER
70%define _webapps /etc/webapps
71%define _webapp %{name}
72%define _sysconfdir %{_webapps}/%{_webapp}
73%define _appdir /usr/share/%{name}
6587a5d5
JB
74
75%description
76Cacti is a complete frondend to rrdtool, it stores all of the
94614147
JB
77nessesary information to create graphs and populate them with data in
78a MySQL database.
6587a5d5 79
94614147
JB
80The frontend is completely PHP driven. Along with being able to
81maintain Graphs, Data Sources, and Round Robin Archives in a database,
82cacti handles the data gathering also. There is also SNMP support for
83those used to creating traffic graphs with MRTG.
6587a5d5 84
41840fab 85%description -l pl.UTF-8
350cedee 86Cacti to pełny frontend do rrdtoola, zapamiętujący wszystkie
bf643d4f
ER
87informacje potrzebne do tworzenia wykresów i wypełniające je danymi w
88bazie MySQL.
c9dfb888 89
350cedee 90Frontend jest w pełni oparty na PHP. Oprócz zarządzania wykresami,
bf643d4f
ER
91źródłami danych, archiwami Round Robin w bazie danych, cacti obsługuje
92także gromadzenie danych. Ma także obsługę SNMP przydatną przy
93tworzeniu wykresów ruchu przy użyciu MRTG.
c9dfb888 94
4b6cd69a
ER
95%package setup
96Summary: Cacti setup package
97Summary(pl.UTF-8): Pakiet do wstępnej konfiguracji Cacti
98Group: Applications/WWW
99Requires: %{name} = %{version}-%{release}
d6d42868 100Suggests: %{name}-doc = %{version}-%{release}
4b6cd69a
ER
101
102%description setup
103Install this package to configure initial Cacti installation. You
104should uninstall this package when you're done, as it considered
105insecure to keep the setup files in place.
106
a40c4ad5
JB
107%description setup -l pl.UTF-8
108Ten pakiet należy zainstalować, aby wstępnie skonfigurować instalację
109Cacti. Po tym pakiet powinien zostać odinstalowany, jako że jego
110obecność może być niebezpieczna.
111
4b6cd69a
ER
112%package doc
113Summary: HTML Documentation for Cacti
a40c4ad5 114Summary(pl.UTF-8): Dokumentacja do Cacti w formacie HTML
4b6cd69a
ER
115Group: Documentation
116Requires: %{name} = %{version}-%{release}
117
118%description doc
119HTML Documentation for Cacti.
120
a40c4ad5
JB
121%description doc -l pl.UTF-8
122Dokumentacja do Cacti w formacie HTML.
123
6587a5d5 124%prep
8466638a 125%setup -q %{?with_pa:-a8}
482f9753 126# official patches
371dd804 127#%patch10 -p1
e79e3b18 128
8466638a
ER
129%if %{with pa}
130%patch0 -p1
131# copy images and drop the rest
371dd804 132mv cacti-plugin-arch/files/images/* images
8466638a
ER
133%{__rm} -r cacti-plugin-arch
134%endif
482f9753 135
0482abbd 136%patch1 -p1
f23be293 137%patch2 -p1
14544804 138%patch3 -p1
d6d42868
ER
139%patch4 -p1
140%patch5 -p1
141%patch6 -p1
5e8efd1f 142%patch7 -p1
de4cec3c 143%patch8 -p1
6587a5d5 144
4b6cd69a
ER
145mkdir -p sql
146mv *.sql sql
86a72dca 147# you should run this sql if your database contains path to %{_datadir}...
3d0c4fef
ER
148cp -p %{SOURCE5} sql
149cp -p %{SOURCE6} sql
4b6cd69a 150
af389505
ER
151%{__rm} -r lib/adodb
152%{__rm} log/.htaccess
153%{__rm} cli/.htaccess
af389505 154%{__rm} rra/.htaccess
344e658b 155
93d2fa9c
ER
156# must require libs to get fatals on missing files, not include
157%{__sed} -i -e '
158 s,include(dirname(__FILE__)."/../include/global.php");,require(dirname(__FILE__)."/../include/global.php");,
159 s,include_once,require_once,
160' cli/*.php
161
c68d3a6e
ER
162# make sure scripts have php shebang
163%{__sed} -i -e '1{
164 /bin.php/!i#!%{_bindir}/php
165}' scripts/*.php cli/*.php
6587a5d5 166
c68d3a6e 167chmod a+rx scripts/*.php cli/*.php
ebacb7e6 168
f4a0dd1f
ER
169find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
170
a0b0ee8a 171# make sure cacti runs out of the box
af389505 172%{__sed} -i -e 's,new_install,%{version},' sql/cacti.sql
a0b0ee8a 173
6587a5d5 174%install
94614147 175rm -rf $RPM_BUILD_ROOT
af389505 176install -d $RPM_BUILD_ROOT{%{_sysconfdir}/%{name},%{_appdir}/{docs,plugins},/etc/{cron.d,logrotate.d},%{_sbindir}}
8c6ff4ca 177install -d $RPM_BUILD_ROOT/var/{log,{lib,cache}/%{name}}
e9300b9e 178
3d0c4fef 179cp -p *.php $RPM_BUILD_ROOT%{_appdir}
de4cec3c 180cp -a cli images include install lib resource scripts sql $RPM_BUILD_ROOT%{_appdir}
4b6cd69a
ER
181cp -a docs/html $RPM_BUILD_ROOT%{_appdir}/docs/html
182mv $RPM_BUILD_ROOT{%{_appdir}/poller.php,%{_sbindir}/cacti-poller}
e9300b9e 183
4b6cd69a 184cp -a log $RPM_BUILD_ROOT/var/log/%{name}
b53d6410 185install -d $RPM_BUILD_ROOT/var/log/archive/%{name}
4b6cd69a 186cp -a rra $RPM_BUILD_ROOT/var/lib/%{name}
e9300b9e 187
caa81993 188mv $RPM_BUILD_ROOT{%{_appdir}/include,%{_sysconfdir}}/config.php
3d0c4fef
ER
189cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/cron.d/%{name}
190cp -p %{SOURCE7} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
4b6cd69a 191
3d0c4fef
ER
192cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf
193cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf
194cp -p %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/lighttpd.conf
6587a5d5
JB
195
196%clean
94614147 197rm -rf $RPM_BUILD_ROOT
6587a5d5 198
f4a0dd1f
ER
199%pre
200%useradd -u 184 -d /var/lib/%{name} -g http -c "Cacti User" cacti
201
4b6cd69a
ER
202%post
203if [ ! -f /var/log/%{name}/cacti.log ]; then
204 install -m660 -oroot -ghttp /dev/null /var/log/%{name}/cacti.log
205fi
206
3d0c4fef
ER
207%{_appdir}/cli/upgrade_database.php || :
208
f4a0dd1f
ER
209%postun
210if [ "$1" = "0" ]; then
211 %userremove cacti
212fi
213
4b6cd69a
ER
214%triggerin -- apache1 < 1.3.37-3, apache1-base
215%webapp_register apache %{_webapp}
216
217%triggerun -- apache1 < 1.3.37-3, apache1-base
218%webapp_unregister apache %{_webapp}
219
220%triggerin -- apache < 2.2.0, apache-base
221%webapp_register httpd %{_webapp}
222
223%triggerun -- apache < 2.2.0, apache-base
224%webapp_unregister httpd %{_webapp}
225
226%triggerin -- lighttpd
227%webapp_register lighttpd %{_webapp}
228
229%triggerun -- lighttpd
230%webapp_unregister lighttpd %{_webapp}
231
232%triggerpostun -- %{name} < 0.8.7b-9.5
233if [ -f /etc/cacti/cacti.cfg.rpmsave ]; then
234 cp -f %{_sysconfdir}/config.php{,.rpmnew}
235 mv /etc/cacti/cacti.cfg.rpmsave %{_sysconfdir}/config.php
236fi
237
6587a5d5 238%files
94614147 239%defattr(644,root,root,755)
e4aad445 240%doc docs/CHANGELOG docs/CONTRIB docs/README docs/txt/manual.txt
4b6cd69a
ER
241%dir %attr(750,root,http) %{_sysconfdir}
242%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apache.conf
243%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf
244%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lighttpd.conf
245%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/config.php
246%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name}
af389505 247%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name}
4b6cd69a 248%attr(755,root,root) %{_sbindir}/cacti-poller
344e658b 249%dir %{_appdir}
4b6cd69a
ER
250%exclude %{_appdir}/install
251%exclude %{_appdir}/docs
344e658b
ER
252%{_appdir}/resource
253%{_appdir}/sql
254%{_appdir}/lib
255%{_appdir}/include
256%{_appdir}/images
344e658b
ER
257%{_appdir}/plugins
258%{_appdir}/*.php
259
ebacb7e6
ER
260%dir %{_appdir}/cli
261%attr(755,root,root) %{_appdir}/cli/*
262
344e658b
ER
263%dir %{_appdir}/scripts
264%attr(755,root,root) %{_appdir}/scripts/*
4b6cd69a 265
ea4c4a5f
AM
266%attr(750,root,http) %dir /var/lib/%{name}
267%attr(770,root,http) %dir /var/lib/%{name}/rra
4b6cd69a 268%attr(730,root,http) %dir /var/log/%{name}
b53d6410 269%attr(750,root,logs) %dir /var/log/archive/%{name}
4b6cd69a 270%attr(660,root,http) %ghost /var/log/%{name}/cacti.log
8c6ff4ca 271%attr(730,root,http) %dir /var/cache/%{name}
4b6cd69a
ER
272
273%files setup
274%defattr(644,root,root,755)
275%{_appdir}/install
276
277%files doc
278%defattr(644,root,root,755)
adf6e05d 279%{_appdir}/docs
This page took 0.176696 seconds and 4 git commands to generate.