# Copyright (C) 2009 Platform Computing Inc # This program is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License as # published by the Free Software Foundation. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA %define _name cacti %define _datadir /usr/share %define cactivers 0.8.7b Summary: component-cacti package Name: component-cacti Version: 0.8.7b Release: 1 License: LGPL Group: System Environment/Base Vendor: Platform Computing Corporation BuildArch: noarch Requires: cacti >= %{cactivers} Requires: cacti-spine Requires: mysql-server Requires: MySQL-python Requires: httpd Requires: net-snmp-utils Requires: php Requires: php-common Requires: php-cli Requires: rrdtool BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root Requires: component-cacti-monitored-node BuildRequires: python Source0: S02Cacti.rc.py Source1: cacti.kusu.sql Source2: cacti.httpd Source3: cacti.crontab Source4: rebuild_host_snmp_cache.php Source5: rebuild_poller_cache.php Source6: cacti.htaccess.lib Source7: cacti.htaccess.include Source8: kusu-cacti.php %description component associcated with cacti %prep %build %install rm -rf $RPM_BUILD_ROOT install -d $RPM_BUILD_ROOT/etc/rc.kusu.d install -m644 %{SOURCE0} $RPM_BUILD_ROOT/etc/rc.kusu.d install -d $RPM_BUILD_ROOT/usr/share/doc/cacti-config-%{cactivers} install -m644 %{SOURCE1} $RPM_BUILD_ROOT/usr/share/doc/cacti-config-%{cactivers}/cacti.sql install -m644 %{SOURCE2} $RPM_BUILD_ROOT/usr/share/doc/cacti-config-%{cactivers}/cacti.httpd.conf install -m644 %{SOURCE3} $RPM_BUILD_ROOT/usr/share/doc/cacti-config-%{cactivers} install -m644 %{SOURCE5} $RPM_BUILD_ROOT/usr/share/doc/cacti-config-%{cactivers} install -d $RPM_BUILD_ROOT/usr/share/cacti install %{SOURCE4} $RPM_BUILD_ROOT/usr/share/cacti install -d $RPM_BUILD_ROOT/usr/share/cacti/cli install -d $RPM_BUILD_ROOT/usr/share/cacti/images install -d $RPM_BUILD_ROOT/usr/share/cacti/include install -d $RPM_BUILD_ROOT/usr/share/cacti/lib install %{SOURCE6} $RPM_BUILD_ROOT/usr/share/cacti/lib/.htaccess install %{SOURCE7} $RPM_BUILD_ROOT/usr/share/cacti/include/.htaccess # This Python script for the addhost plugin of kit. install -d $RPM_BUILD_ROOT/opt/kusu/lib/cacti install %{SOURCE8} $RPM_BUILD_ROOT/opt/kusu/lib/cacti %pre %post # Skip post section if we are running under the installer. # The RC script will be placed in /etc/rc.kusu.d and # and will be executed on first run. if [ -e /var/lock/subsys/kusu-installer ]; then exit 0; fi # Add cacti user/group getent group cacti >/dev/null || groupadd -r cacti -g 452 getent passwd cacti >/dev/null || useradd -g cacti -u 452 -d %{_datadir}/%{_name} -r -s /sbin/nologin cacti 2> /dev/null || : if [ ! -f "/usr/share/cacti/cli/rebuild_poller_cache.php" ]; then [ -d "/usr/share/cacti/cli" ] || mkdir -p "/usr/share/cacti/cli" install -m644 /usr/share/doc/cacti-config-%{cactivers}/rebuild_poller_cache.php /usr/share/cacti/cli fi # Install cacti.conf # Preconfigure Apache HTTPD to allow access to everybody install -m644 /usr/share/doc/cacti-config-%{cactivers}/cacti.httpd.conf /etc/httpd/conf.d/cacti.conf # Install crontab install -m644 /usr/share/doc/cacti-config-%{cactivers}/cacti.crontab /etc/cron.d/cacti if [ "$1" = 1 ]; then # Only perform this operation on a new install. Hopefully in the # future, this script can handle being called for upgrades if [ -d /opt/kusu/lib ]; then PYTHONPATH=/opt/kusu/lib64/python:/opt/kusu/lib/python export PYTHONPATH fi /opt/kusu/bin/kusurc /etc/rc.kusu.d/S02Cacti.rc.py fi %preun %postun /bin/cat << 'EOF' > /opt/kusu/lib/plugins/cfmclient/component-cacti.remove #!/bin/sh rpm -e cacti cacti-spine > /dev/null 2>&1 rpm -e net-snmp net-snmp-libs net-snmp-utils php-snmp rrdtool > /dev/null 2>&1 rm -f /opt/kusu/lib/plugins/cfmclient/component-cacti.remove EOF %clean rm -rf $RPM_BUILD_ROOT %files /etc/rc.kusu.d/S02Cacti.rc.py /etc/rc.kusu.d/S02Cacti.rc.pyo /etc/rc.kusu.d/S02Cacti.rc.pyc %dir /opt/kusu/lib/cacti /opt/kusu/lib/cacti/kusu-cacti.php %dir /usr/share/doc/cacti-config-%{cactivers} %doc /usr/share/doc/cacti-config-%{cactivers}/cacti.sql %doc /usr/share/doc/cacti-config-%{cactivers}/cacti.httpd.conf %doc /usr/share/doc/cacti-config-%{cactivers}/cacti.crontab %doc /usr/share/doc/cacti-config-%{cactivers}/rebuild_poller_cache.php /usr/share/cacti/rebuild_host_snmp_cache.php /usr/share/cacti/include/.htaccess /usr/share/cacti/lib/.htaccess %changelog * Tue Feb 17 2009 Mark Black 0.8.7b-1 - Merged into OCS SVN * Thu Feb 5 2009 Kunal Chowdhury 0.1-47 - Ported to kit api version 0.2 * Tue Feb 2 2009 Meng Kuan 1.1-46 - Final release of the old-style kits * Fri Jan 30 2009 Hirwan Salleh 1.1-45 - Fix S02Cacti.rc.py to use primitive dispatcher. * Mon Sep 22 2008 Mike Frisch 0.1-44 - Implement security fix for open Cacti directories * Fri Jun 20 2008 Mike Frisch 0.1-41 - Fix problem with Cacti poller cache rebuild (#110640) - Change polling interval to 5 minutes (#110642) * Mon Jun 16 2008 Mike Frisch 0.1-40 - Modified cacti.kusu.sql to support Cacti Spine (instead of cacti-cactid) * Mon May 5 2008 Mike Frisch 0.1-39 - Add missing rebuild_poller_cache.php * Thu Apr 17 2008 Mike Frisch 0.1-38 - Added 'noreplace' to cacti.conf to prevent overwrite (#107213) * Mon Apr 14 2008 Mike Frisch 0.1-37 - Install cacti.conf in install section (Problem #106943) * Thu Mar 27 2008 Mike Frisch 0.1-36 - Removed AutoReq tag at the request of Red Hat * Tue Jan 29 2008 Mike Frisch 0.1-27 - Initial release