2 %define php_min_version 5.2.13-10
3 %include /usr/lib/rpm/macros.php
4 Summary: Cacti is a PHP frontend for rrdtool
5 Summary(pl.UTF-8): Cacti - frontend w PHP do rrdtoola
10 Group: Applications/WWW
11 Source0: http://www.cacti.net/downloads/%{name}-%{version}.tar.gz
12 # Source0-md5: dba0422ba64c6ccc312b74ae2fa58bf5
13 Source2: %{name}.crontab
14 Source3: %{name}-apache.conf
15 Source4: %{name}-lighttpd.conf
16 Source5: %{name}-rrdpath.sql
17 Source7: %{name}.logrotate
19 Patch1: %{name}-config.patch
21 Patch3: %{name}-ioerror.patch
22 Patch4: %{name}-webroot.patch
23 Patch5: %{name}-linux_memory.patch
24 Patch6: %{name}-log-verbosity.patch
25 Patch7: %{name}-ss_disk-array-indices.patch
26 Patch8: host_name-url.patch
27 # http://www.cacti.net/download_patches.php
29 URL: http://www.cacti.net/
30 BuildRequires: sed >= 4.0
31 Requires(postun): /usr/sbin/userdel
32 Requires(pre): /bin/id
33 Requires(pre): /usr/sbin/useradd
34 Requires: cacti-plugin-boost >= 5.0
37 Requires: net-snmp-utils
38 Requires: php(core) >= %{php_min_version}
44 Requires: php(mbstring)
45 Requires: php(openssl)
47 Requires: php(pdo-mysql)
49 Requires: php(session)
50 Requires: php(sockets)
56 Requires: webserver(access)
57 Requires: webserver(alias)
58 Requires: webserver(indexfile)
59 Requires: webserver(php)
65 Provides: cacti(pia) = %{pia_ver}
67 Obsoletes: cacti-add_template
68 Obsoletes: cacti-plugin-update
69 %if "%{pld_release}" != "ac"
70 Conflicts: logrotate < 3.8.0
73 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
75 %define _webapps /etc/webapps
76 %define _webapp %{name}
77 %define _sysconfdir %{_webapps}/%{_webapp}
78 %define _appdir /usr/share/%{name}
81 %define _noautopear pear
83 %define _noautophp php-ftp php-bcmath
85 # put it together for rpmbuild
86 %define _noautoreq %{?_noautophp} %{?_noautopear}
89 Cacti is a complete frondend to rrdtool, it stores all of the
90 nessesary information to create graphs and populate them with data in
93 The frontend is completely PHP driven. Along with being able to
94 maintain Graphs, Data Sources, and Round Robin Archives in a database,
95 cacti handles the data gathering also. There is also SNMP support for
96 those used to creating traffic graphs with MRTG.
98 %description -l pl.UTF-8
99 Cacti to pełny frontend do rrdtoola, zapamiętujący wszystkie
100 informacje potrzebne do tworzenia wykresów i wypełniające je danymi w
103 Frontend jest w pełni oparty na PHP. Oprócz zarządzania wykresami,
104 źródłami danych, archiwami Round Robin w bazie danych, cacti obsługuje
105 także gromadzenie danych. Ma także obsługę SNMP przydatną przy
106 tworzeniu wykresów ruchu przy użyciu MRTG.
109 Summary: Cacti setup package
110 Summary(pl.UTF-8): Pakiet do wstępnej konfiguracji Cacti
111 Group: Applications/WWW
112 Requires: %{name} = %{version}-%{release}
113 Suggests: %{name}-doc = %{version}-%{release}
116 Install this package to configure initial Cacti installation. You
117 should uninstall this package when you're done, as it considered
118 insecure to keep the setup files in place.
120 %description setup -l pl.UTF-8
121 Ten pakiet należy zainstalować, aby wstępnie skonfigurować instalację
122 Cacti. Po tym pakiet powinien zostać odinstalowany, jako że jego
123 obecność może być niebezpieczna.
126 Summary: HTML Documentation for Cacti
127 Summary(pl.UTF-8): Dokumentacja do Cacti w formacie HTML
129 Requires: %{name} = %{version}-%{release}
132 HTML Documentation for Cacti.
134 %description doc -l pl.UTF-8
135 Dokumentacja do Cacti w formacie HTML.
157 # you should run this sql if your database contains path to %{_datadir}...
160 %{__rm} log/.htaccess
161 %{__rm} cli/.htaccess
162 %{__rm} rra/.htaccess
164 # must require libs to get fatals on missing files, not include
166 s,include(dirname(__FILE__)."/../include/global.php");,require(dirname(__FILE__)."/../include/global.php");,
167 s,include_once,require_once,
170 # make sure scripts have php shebang
172 /bin.php/!i#!%{_bindir}/php
173 }' scripts/*.php cli/*.php
175 chmod a+rx scripts/*.php cli/*.php
177 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
179 # make sure cacti runs out of the box
180 %{__sed} -i -e 's,new_install,%{version},' sql/cacti.sql
183 rm -rf $RPM_BUILD_ROOT
184 install -d $RPM_BUILD_ROOT{%{_sysconfdir}/%{name},%{_appdir}/docs,/etc/{cron.d,logrotate.d},%{_sbindir}}
185 install -d $RPM_BUILD_ROOT/var/{log,{lib,cache}/%{name}}
187 cp -p *.php $RPM_BUILD_ROOT%{_appdir}
188 # dirs that contain index.php are likely to be installed
189 # ls -1d */index.php | cut -d"/" -f1 | xargs
190 cp -a cache/* $RPM_BUILD_ROOT/var/cache/%{name}
191 ln -s /var/cache/%{name} $RPM_BUILD_ROOT%{_appdir}/cache
192 cp -a cli formats images include install lib locales mibs plugins resource scripts sql $RPM_BUILD_ROOT%{_appdir}
193 cp -a docs/html $RPM_BUILD_ROOT%{_appdir}/docs/html
194 mv $RPM_BUILD_ROOT{%{_appdir}/poller.php,%{_sbindir}/cacti-poller}
196 cp -a log $RPM_BUILD_ROOT/var/log/%{name}
197 :> $RPM_BUILD_ROOT/var/log/%{name}/%{name}.log
198 install -d $RPM_BUILD_ROOT/var/log/archive/%{name}
199 cp -a rra $RPM_BUILD_ROOT/var/lib/%{name}
201 mv $RPM_BUILD_ROOT{%{_appdir}/include,%{_sysconfdir}}/config.php
202 cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/cron.d/%{name}
203 cp -p %{SOURCE7} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
205 %if "%{pld_release}" == "ac"
206 %{__sed} -i -e '/su/d' $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
209 cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf
210 cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf
211 cp -p %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/lighttpd.conf
214 rm -rf $RPM_BUILD_ROOT
217 %useradd -u 184 -d /var/lib/%{name} -g http -c "Cacti User" cacti
220 if [ -d "%{_appdir}/cache" ] && [ ! -L "%{_appdir}/cache" ]; then
221 mv -v %{_appdir}/cache{,.rpmsave}
226 if [ ! -f /var/log/%{name}/cacti.log ]; then
227 install -m660 -oroot -ghttp /dev/null /var/log/%{name}/cacti.log
231 if [ "$1" = "0" ]; then
236 %{_appdir}/cli/upgrade_database.php || :
238 %triggerin -- apache1 < 1.3.37-3, apache1-base
239 %webapp_register apache %{_webapp}
241 %triggerun -- apache1 < 1.3.37-3, apache1-base
242 %webapp_unregister apache %{_webapp}
244 %triggerin -- apache < 2.2.0, apache-base
245 %webapp_register httpd %{_webapp}
247 %triggerun -- apache < 2.2.0, apache-base
248 %webapp_unregister httpd %{_webapp}
250 %triggerin -- lighttpd
251 %webapp_register lighttpd %{_webapp}
253 %triggerun -- lighttpd
254 %webapp_unregister lighttpd %{_webapp}
256 %triggerpostun -- %{name} < 0.8.7b-9.5
257 if [ -f /etc/cacti/cacti.cfg.rpmsave ]; then
258 cp -f %{_sysconfdir}/config.php{,.rpmnew}
259 mv /etc/cacti/cacti.cfg.rpmsave %{_sysconfdir}/config.php
263 %defattr(644,root,root,755)
264 %doc README.md docs/CHANGELOG docs/txt/manual.txt
265 %dir %attr(750,root,http) %{_sysconfdir}
266 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apache.conf
267 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf
268 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lighttpd.conf
269 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/config.php
270 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name}
271 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name}
272 %attr(755,root,root) %{_sbindir}/cacti-poller
274 %exclude %{_appdir}/install
275 %exclude %{_appdir}/docs
289 %attr(755,root,root) %{_appdir}/cli/*
291 %dir %{_appdir}/scripts
292 %attr(755,root,root) %{_appdir}/scripts/*
294 %attr(750,root,http) %dir /var/lib/%{name}
295 %attr(770,root,http) %dir /var/lib/%{name}/rra
296 %attr(730,root,http) %dir /var/log/%{name}
297 %attr(750,root,logs) %dir /var/log/archive/%{name}
298 %attr(660,root,http) %ghost /var/log/%{name}/cacti.log
299 %attr(730,root,http) %dir /var/cache/%{name}
300 /var/cache/%{name}/index.php
301 %attr(730,root,http) %dir /var/cache/%{name}/boost
302 %attr(730,root,http) %dir /var/cache/%{name}/mibcache
303 %attr(730,root,http) %dir /var/cache/%{name}/realtime
304 %attr(730,root,http) %dir /var/cache/%{name}/spikekill
305 /var/cache/%{name}/*/.htaccess
306 /var/cache/%{name}/*/index.php
309 %defattr(644,root,root,755)
313 %defattr(644,root,root,755)