3 %bcond_without pa # without plugin archidecture patch
6 %include /usr/lib/rpm/macros.perl
7 Summary: Cacti is a PHP frontend for rrdtool
8 Summary(pl.UTF-8): Cacti - frontend w PHP do rrdtoola
13 Group: Applications/WWW
14 Source0: http://www.cacti.net/downloads/%{name}-%{version}.tar.gz
15 # Source0-md5: 58c9371341f49a190ae11a85118e598d
16 Source2: %{name}.crontab
17 Source3: %{name}-apache.conf
18 Source4: %{name}-lighttpd.conf
19 Source5: %{name}-rrdpath.sql
20 Source6: %{name}-pa.sql
21 Source7: %{name}.logrotate
22 # http://docs.cacti.net/manual:087:1_installation.9_pia
23 Source8: http://www.cacti.net/downloads/pia/%{name}-plugin-%{version}-PA-v%{pia_ver}.tar.gz
24 # Source8-md5: 1f45a65dc76dee368b11f2c78ae89dfb
25 # NOTE: update provides: cacti(pia) when updating the patch
26 Patch0: %{name}-PA.patch
27 Patch1: %{name}-config.patch
28 Patch2: %{name}-adodb.patch
29 Patch3: %{name}-ioerror.patch
30 Patch4: %{name}-webroot.patch
31 Patch5: %{name}-linux_memory.patch
32 Patch6: %{name}-log-verbosity.patch
33 Patch7: %{name}-ss_disk-array-indices.patch
34 Patch8: host_name-url.patch
35 # http://www.cacti.net/download_patches.php
37 URL: http://www.cacti.net/
38 BuildRequires: rpm-perlprov
39 BuildRequires: sed >= 4.0
40 Requires(postun): /usr/sbin/userdel
41 Requires(pre): /bin/id
42 Requires(pre): /usr/sbin/useradd
43 Requires: adodb >= 4.67-1.17
46 Requires: net-snmp-utils
48 Requires: php-common >= 4:5.2.13-10
57 Requires: webserver(access)
58 Requires: webserver(alias)
59 Requires: webserver(indexfile)
60 Requires: webserver(php)
63 Provides: cacti(pia) = %{pia_ver}
65 Obsoletes: cacti-add_template
66 Obsoletes: cacti-plugin-update
68 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
70 %define _webapps /etc/webapps
71 %define _webapp %{name}
72 %define _sysconfdir %{_webapps}/%{_webapp}
73 %define _appdir /usr/share/%{name}
76 Cacti is a complete frondend to rrdtool, it stores all of the
77 nessesary information to create graphs and populate them with data in
80 The frontend is completely PHP driven. Along with being able to
81 maintain Graphs, Data Sources, and Round Robin Archives in a database,
82 cacti handles the data gathering also. There is also SNMP support for
83 those used to creating traffic graphs with MRTG.
85 %description -l pl.UTF-8
86 Cacti to pełny frontend do rrdtoola, zapamiętujący wszystkie
87 informacje potrzebne do tworzenia wykresów i wypełniające je danymi w
90 Frontend jest w pełni oparty na PHP. Oprócz zarządzania wykresami,
91 źródłami danych, archiwami Round Robin w bazie danych, cacti obsługuje
92 także gromadzenie danych. Ma także obsługę SNMP przydatną przy
93 tworzeniu wykresów ruchu przy użyciu MRTG.
96 Summary: Cacti setup package
97 Summary(pl.UTF-8): Pakiet do wstępnej konfiguracji Cacti
98 Group: Applications/WWW
99 Requires: %{name} = %{version}-%{release}
100 Suggests: %{name}-doc = %{version}-%{release}
103 Install this package to configure initial Cacti installation. You
104 should uninstall this package when you're done, as it considered
105 insecure to keep the setup files in place.
107 %description setup -l pl.UTF-8
108 Ten pakiet należy zainstalować, aby wstępnie skonfigurować instalację
109 Cacti. Po tym pakiet powinien zostać odinstalowany, jako że jego
110 obecność może być niebezpieczna.
113 Summary: HTML Documentation for Cacti
114 Summary(pl.UTF-8): Dokumentacja do Cacti w formacie HTML
116 Requires: %{name} = %{version}-%{release}
119 HTML Documentation for Cacti.
121 %description doc -l pl.UTF-8
122 Dokumentacja do Cacti w formacie HTML.
125 %setup -q %{?with_pa:-a8}
131 # copy images and drop the rest
132 mv cacti-plugin-arch/files/images/* images
133 %{__rm} -r cacti-plugin-arch
147 # you should run this sql if your database contains path to %{_datadir}...
152 %{__rm} log/.htaccess
153 %{__rm} cli/.htaccess
154 %{__rm} rra/.htaccess
156 # must require libs to get fatals on missing files, not include
158 s,include(dirname(__FILE__)."/../include/global.php");,require(dirname(__FILE__)."/../include/global.php");,
159 s,include_once,require_once,
162 # make sure scripts have php shebang
164 /bin.php/!i#!%{_bindir}/php
165 }' scripts/*.php cli/*.php
167 chmod a+rx scripts/*.php cli/*.php
169 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
171 # make sure cacti runs out of the box
172 %{__sed} -i -e 's,new_install,%{version},' sql/cacti.sql
175 rm -rf $RPM_BUILD_ROOT
176 install -d $RPM_BUILD_ROOT{%{_sysconfdir}/%{name},%{_appdir}/{docs,plugins},/etc/{cron.d,logrotate.d},%{_sbindir}}
177 install -d $RPM_BUILD_ROOT/var/{log,{lib,cache}/%{name}}
179 cp -p *.php $RPM_BUILD_ROOT%{_appdir}
180 cp -a cli images include install lib resource scripts sql $RPM_BUILD_ROOT%{_appdir}
181 cp -a docs/html $RPM_BUILD_ROOT%{_appdir}/docs/html
182 mv $RPM_BUILD_ROOT{%{_appdir}/poller.php,%{_sbindir}/cacti-poller}
184 cp -a log $RPM_BUILD_ROOT/var/log/%{name}
185 install -d $RPM_BUILD_ROOT/var/log/archive/%{name}
186 cp -a rra $RPM_BUILD_ROOT/var/lib/%{name}
188 mv $RPM_BUILD_ROOT{%{_appdir}/include,%{_sysconfdir}}/config.php
189 cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/cron.d/%{name}
190 cp -p %{SOURCE7} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
192 cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf
193 cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf
194 cp -p %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/lighttpd.conf
197 rm -rf $RPM_BUILD_ROOT
200 %useradd -u 184 -d /var/lib/%{name} -g http -c "Cacti User" cacti
203 if [ ! -f /var/log/%{name}/cacti.log ]; then
204 install -m660 -oroot -ghttp /dev/null /var/log/%{name}/cacti.log
207 %{_appdir}/cli/upgrade_database.php || :
210 if [ "$1" = "0" ]; then
214 %triggerin -- apache1 < 1.3.37-3, apache1-base
215 %webapp_register apache %{_webapp}
217 %triggerun -- apache1 < 1.3.37-3, apache1-base
218 %webapp_unregister apache %{_webapp}
220 %triggerin -- apache < 2.2.0, apache-base
221 %webapp_register httpd %{_webapp}
223 %triggerun -- apache < 2.2.0, apache-base
224 %webapp_unregister httpd %{_webapp}
226 %triggerin -- lighttpd
227 %webapp_register lighttpd %{_webapp}
229 %triggerun -- lighttpd
230 %webapp_unregister lighttpd %{_webapp}
232 %triggerpostun -- %{name} < 0.8.7b-9.5
233 if [ -f /etc/cacti/cacti.cfg.rpmsave ]; then
234 cp -f %{_sysconfdir}/config.php{,.rpmnew}
235 mv /etc/cacti/cacti.cfg.rpmsave %{_sysconfdir}/config.php
239 %defattr(644,root,root,755)
240 %doc docs/CHANGELOG docs/CONTRIB docs/README docs/txt/manual.txt
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}
247 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name}
248 %attr(755,root,root) %{_sbindir}/cacti-poller
250 %exclude %{_appdir}/install
251 %exclude %{_appdir}/docs
261 %attr(755,root,root) %{_appdir}/cli/*
263 %dir %{_appdir}/scripts
264 %attr(755,root,root) %{_appdir}/scripts/*
266 %attr(750,root,http) %dir /var/lib/%{name}
267 %attr(770,root,http) %dir /var/lib/%{name}/rra
268 %attr(730,root,http) %dir /var/log/%{name}
269 %attr(750,root,logs) %dir /var/log/archive/%{name}
270 %attr(660,root,http) %ghost /var/log/%{name}/cacti.log
271 %attr(730,root,http) %dir /var/cache/%{name}
274 %defattr(644,root,root,755)
278 %defattr(644,root,root,755)