Sophie

Sophie

distrib > Mandriva > 10.2 > x86_64 > by-pkgid > ba5b2b4a5a981239c00911b43ae0f3f7 > files > 2

nisca-2.5-2mdk.src.rpm

%define name	nisca
%define version 2.5
%define release 2mdk
%define webadminroot /var/www/html/admin

Summary:	Network Interface Statistics Collection Agent (nisca)
Name:		%{name}
Version:	%{version}
Release:	%{release}
License:	GPL
Group:		System/Servers
URL:		http://nisca.sourceforge.net
Source0:	%{name}-%{version}.tar.bz2
Requires:	webserver mysqlserver mod_php php php-common php-gd php-mysql
#Requires:	php-sysvshm php-sysvsem
Requires:	net-snmp-utils net-snmp net-snmp-mibs php-cli
BuildRequires:	perl
BuildRoot:	%{_tmppath}/%{name}-%{version}-buildroot
BuildArch:	noarch
Prefix:		%{webadminroot}

%description
NISCA (Network Interface Statistics Collection Agent) is a more
flexible PHP4-based MRTG replacement. It supports both SNMP and
reading localhost's /proc/net/dev device file directly for
statistics gathering.

It uses MySQL to store collected data in, and stores statistics
for bytes transferred, packets transferred, transfer errors, and
dropped packets separated into a per interface incoming and
outgoing set.

It generates both graphs and a textual report table using the
data from any timeframe contained in the database. The entire
package runs using PHP4; it uses the CGI binary version of PHP
for stats collection (running in the background as a "daemon")
and either the CGI or Apache module versions to generate the
GUI form and reports. It can also import existing MRTG logfiles. 

%prep

%setup -q

%build

# The real ugly stuff begins here..., or if I put it in other
# words, patch files does not really apply well here :)

find * -name '*.phtml' | while read phtml; do
  mv $phtml ${phtml%%.phtml}.php
done

find . -type f -name "*"|xargs perl -p -i -e "s|.phtml|.php|g"

find . -type f -name "*"|xargs perl -p -i -e "s|/usr/local/|/usr/|g"
#find . -type f -name "*"|xargs perl -p -i -e "s|/usr/bin/php|/usr/bin/php-cli|g"

perl -p -i -e "s|/home/httpd/htdocs/nisca|%{webadminroot}/nisca|g" install/nisca.conf
perl -p -i -e "s|\"/nisca\"|\"/admin/nisca\"|g" install/nisca.conf
perl -p -i -e "s|localhost:/tmp/mysql.sock|localhost:/var/lib/mysql/mysql.sock|g" install/db.conf

# 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
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}

install -d %{buildroot}%{_sysconfdir}/%{name}
install -d %{buildroot}%{webadminroot}/%{name}/{help,docs,admin,archive,lib,images}
install -d %{buildroot}%{_sbindir}

install -m0600 install/*.conf %{buildroot}%{_sysconfdir}/%{name}/
install -m0644 lib/*.phps %{buildroot}%{webadminroot}/%{name}/lib/
install -m0644 docs/*.html %{buildroot}%{webadminroot}/%{name}/docs/
install -m0644 docs/*.gif %{buildroot}%{webadminroot}/%{name}/docs/
install -m0644 help/*.html %{buildroot}%{webadminroot}/%{name}/help/
install -m0644 help/*.gif %{buildroot}%{webadminroot}/%{name}/help/
install -m0644 admin/*.php %{buildroot}%{webadminroot}/%{name}/admin/
install -m0644 admin/*.gif %{buildroot}%{webadminroot}/%{name}/admin/
install -m0644 admin/*.html %{buildroot}%{webadminroot}/%{name}/admin/
install -m0744 utils/nisca_check %{buildroot}%{_sbindir}/
install -m0744 utils/collect %{buildroot}%{_sbindir}/
install -m0744 utils/mrtg_import %{buildroot}%{_sbindir}/
install -m0744 utils/nisca_kill %{buildroot}%{_sbindir}/
install -m0744 utils/snmp_collect %{buildroot}%{_sbindir}/
install -m0744 install/create_stats %{buildroot}%{_sbindir}/
install -m0644 images/* %{buildroot}%{webadminroot}/%{name}/images/
install -m0644 *.php %{buildroot}%{webadminroot}/%{name}/
install -m0644 *.ttf %{buildroot}%{webadminroot}/%{name}/
install -m0644 *.gif %{buildroot}%{webadminroot}/%{name}/

%clean
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}

%files
%defattr(-, root, root)
%doc docs/TODO docs/LICENSE docs/README docs/INSTALL docs/CHANGELOG
%doc install/update-to-2.4 install/update-to-2.5 install/nisca.conf.explained
%dir %attr(0755,apache,root) %{_sysconfdir}/%{name}
%config(noreplace) %attr(0640,apache,root) %{_sysconfdir}/%{name}/*.conf
%dir %attr(0755,apache,root) %{webadminroot}/%{name}/archive
%attr(0644,root,root) %{webadminroot}/%{name}/admin/*
%attr(0644,root,root) %{webadminroot}/%{name}/images/*
%attr(0644,root,root) %{webadminroot}/%{name}/docs/*
%attr(0644,root,root) %{webadminroot}/%{name}/help/*
%attr(0644,root,root) %{webadminroot}/%{name}/lib/*.phps
%attr(0644,root,root) %{webadminroot}/%{name}/*.gif
%attr(0644,root,root) %{webadminroot}/%{name}/*.ttf
%attr(0644,root,root) %{webadminroot}/%{name}/*.php
%attr(0744,root,root) %{_sbindir}/*
  
%changelog
* Sat Nov 13 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 2.5-2mdk
- clean deps

* Wed Oct 15 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 2.5-1mdk
- 2.5

* Mon Feb 24 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 2.3.2-1mdk
- 2.3.2

* Wed Feb 19 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 2.3.1-1mdk
- 2.3.1
- don't ever use 2.3, use 2.3.1
- cleaned up the spec file

* Tue Feb 18 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 2.3-2mdk
- add P0
- two important patches are allready applied to this new tar ball, 
  globals-2.3.p1.patch and snmpfix-2.3.p2.patch

* Sat Feb 15 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 2.3-1mdk
- does not require php-snmp anymore
- remove P0

* Thu Jan 16 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 2.2-6mdk
- build release

* Thu Sep 19 2002 Oden Eriksson <oden.eriksson@kvikkjokk.net> 2.2-5mdk
- misc spec file fixes
- install in common and relocatable %%{webadminroot}/ directory

* Wed Sep 18 2002 Oden Eriksson <oden.eriksson@kvikkjokk.net> 2.2-4mdk
- do not require non existant php extensions
- misc spec file fixes

* Sun May 12 2002 Oden Eriksson <oden.eriksson@kvikkjokk.net> 2.2-3mdk
- revoke the mysql "fix".
- require php-sysvsem, php-sysvshm, php-posix

* Sat May 11 2002 Oden Eriksson <oden.eriksson@kvikkjokk.net> 2.2-2mdk
- added P1 to fix mysql connect and query (?)

* Fri Apr 26 2002 Oden Eriksson <oden.eriksson@kvikkjokk.net> 2.2-1mdk
- initial cooker contrib