-Summary: Cacti is a php frontend for rrdtool
+%include /usr/lib/rpm/macros.perl
+Summary: Cacti is a PHP frontend for rrdtool
Summary(pl): Cacti - frontend w PHP do rrdtoola
Name: cacti
-Version: 0.8.1
+Version: 0.8.6g
Release: 1
License: GPL
Group: Applications/WWW
-Source0: http://www.raxnet.net/downloads/%{name}-%{version}.tar.gz
-# Source0-md5: d87613690e82e025412de6d747b0674e
-#Patch0: %{name}-%{version}-paths.patch.bz2
-URL: http://www.raxnet.net/
-BuildRequires: perl
-Requires: libnet-snmp50
-Requires: mysql
+Source0: http://www.cacti.net/downloads/%{name}-%{version}.tar.gz
+# Source0-md5: b3cf31349d2db47d14dcf347b8422bc2
+Patch0: http://www.cacti.net/downloads/patches/0.8.6g/short_open_tag_parse_error.patch
+Patch1: http://www.cacti.net/downloads/patches/0.8.6g/graph_properties_zoom.patch
+Patch2: http://www.cacti.net/downloads/patches/0.8.6g/script_server_snmp_auth.patch
+Patch3: http://www.cacti.net/downloads/patches/0.8.6g/mib_file_loading.patch
+Patch4: %{name}-config.patch
+URL: http://www.cacti.net/
+BuildRequires: rpm-perlprov
+Requires: crondaemon
Requires: net-snmp-utils
-Requires: net-snmp
Requires: php
+Requires: php-cli
Requires: php-gd
Requires: php-mysql
+Requires: php-pcre
Requires: php-snmp
+Requires: php-xml
Requires: rrdtool
Requires: webserver
BuildArch: noarch
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
-%define webadminroot /home/services/httpd
+%define webadminroot /usr/share/%{name}
%description
Cacti is a complete frondend to rrdtool, it stores all of the
those used to creating traffic graphs with MRTG.
%description -l pl
-Cacti to pe³ny frontent do rrdtoola, zapamiêtuj±cy wszystkie
+Cacti to pe³ny frontend do rrdtoola, zapamiêtuj±cy wszystkie
informacje potrzebne do tworzenia wykresów i wype³niaj±ce je danymi w
bazie MySQL.
%prep
%setup -q
-#%patch0 -p1
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
%build
-# clean up CVS stuff
-for i in `find . -type d -name CVS` `find . -type f -name .cvs\*` `find . -type f -name .#\*`; do
- if [ -e "$i" ]; then rm -r $i; fi >&/dev/null
-done
-
-# fix dir perms
-find . -type d | xargs chmod 755
-
-# fix file perms
-find . -type f | xargs chmod 644
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT%{webadminroot}/%{name}
+install -d $RPM_BUILD_ROOT%{webadminroot}
+install -d $RPM_BUILD_ROOT%{_sysconfdir}/{%{name},cron.d}
+install -d $RPM_BUILD_ROOT/var/{log,lib/%{name}}
+
+cp -aRf * $RPM_BUILD_ROOT%{webadminroot}
+ln -s . $RPM_BUILD_ROOT%{webadminroot}/%{name}
+
+cat << EOF > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/%{name}.cfg
+<?php
+\$database_type = "mysql";
+\$database_default = "cacti";
+\$database_hostname = "localhost";
+\$database_username = "cactiuser";
+\$database_password = "cactiuser";
+?>
+EOF
+
+mv $RPM_BUILD_ROOT%{webadminroot}/log $RPM_BUILD_ROOT/var/log/%{name}
+ln -sf /var/log/cacti $RPM_BUILD_ROOT%{webadminroot}/log
+
+mv $RPM_BUILD_ROOT%{webadminroot}/rra $RPM_BUILD_ROOT/var/lib/%{name}
+ln -sf /var/lib/%{name}/rra $RPM_BUILD_ROOT%{webadminroot}/rra
-cp -aRf * $RPM_BUILD_ROOT%{webadminroot}/%{name}
+cat << EOF > $RPM_BUILD_ROOT%{_sysconfdir}/cron.d/%{name}
+*/5 * * * * http umask 022; /usr/bin/php %{webadminroot}/poller.php > /dev/null 2>&1
+EOF
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
%doc docs/CHANGELOG docs/CONTRIB docs/README
-%dir %{webadminroot}/%{name}
-%config(noreplace) %verify(not size mtime md5) %attr(644,http,http) %{webadminroot}/%{name}/log/rrd.log
-%config(noreplace) %verify(not size mtime md5) %{webadminroot}/%{name}/rra/.placeholder
-%config(noreplace) %verify(not size mtime md5) %attr(644,http,http) %{webadminroot}/%{name}/include/config.php
-%{webadminroot}/%{name}/*
+%attr(750,root,http) %dir %{_sysconfdir}/%{name}
+%attr(640,root,http) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/%{name}/%{name}.cfg
+%attr(770,root,http) %dir /var/log/%{name}
+%attr(660,root,http) %ghost /var/log/%{name}/*.log
+%attr(750,root,http) %dir /var/lib/%{name}
+%attr(770,root,http) %dir /var/lib/%{name}/rra
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name}
+%{webadminroot}