%define ver    @VERSION@
%define rel    0
%define prefix /usr

Name:      bandmin
Version:   %{ver}
Release:   %{rel}
Copyright: GPL
Packager:  J. Nick Koston
URL:       http://www.bandmin.org
Source:    ftp://missinglink.darkorb.net/pub/bandmin/bandmin-devel/bandmin-%{version}.tar.gz
Group:     Networking/Utilities
Summary:   Bandmin is a simple set of perl scripts designed to record and log ip accouting data
BuildRoot: /tmp/%{name}-%{version}-root
BuildArchitectures: noarch

%description 
Bandmin is a simple set of perl scripts designed to record and log ip accouting data. It can also display the data that it collects in a set of html pages.   Bandmin currently has support for ipchains, UserIPAcct, ipfwadm, and ipfw. 
       


%prep
%setup


%build
./configure
make

%install
/usr/bin/install -c -m755 -c -d $RPM_BUILD_ROOT/etc/rc.d/init.d
/usr/bin/install -c -m755 -c -d $RPM_BUILD_ROOT/usr/local/bandmin
/usr/bin/install -c -m755 -c -d $RPM_BUILD_ROOT/usr/local/bandmin/htdocs
/usr/bin/install -c -m755 -c -d $RPM_BUILD_ROOT/var/log/bandwidth
/usr/bin/install -c -m744 -c redhat/bandmin.init $RPM_BUILD_ROOT/etc/rc.d/init.d/bandmin
/usr/bin/install -c -m744 -c bandmin $RPM_BUILD_ROOT/usr/local/bandmin/bandmin
/usr/bin/install -c -m744 -c bandminconf $RPM_BUILD_ROOT/usr/local/bandmin/bandminconf
/usr/bin/install -c -m744 -c bandmin.conf $RPM_BUILD_ROOT/usr/local/bandmin/bandmin.conf
/usr/bin/install -c -m744 -c bmversion.pl $RPM_BUILD_ROOT/usr/local/bandmin/bmversion.pl
/usr/bin/install -c -m744 -c bandminstart $RPM_BUILD_ROOT/usr/local/bandmin/bandminstart
/usr/bin/install -c -m744 -c bandminhtml $RPM_BUILD_ROOT/usr/local/bandmin/bandminhtml
/usr/bin/install -c -m744 -c ipaddrmap $RPM_BUILD_ROOT/usr/local/bandmin/ipaddrmap
/usr/bin/install -c -m744 -c upgrade.pl $RPM_BUILD_ROOT/usr/local/bandmin/upgrade.pl
/usr/bin/install -c -m755 -c -d $RPM_BUILD_ROOT/usr/local/bandmin/IP
/usr/bin/install -c -m744 -c perlmod/Acct.pm $RPM_BUILD_ROOT/usr/local/bandmin/IP/Acct.pm
/usr/bin/install -c -m744 -c perlmod/UserAcct.pm $RPM_BUILD_ROOT/usr/local/bandmin/IP/UserAcct.pm
/usr/bin/install -c -m644 -c images/bandmin_Apr.gif $RPM_BUILD_ROOT/usr/local/bandmin/htdocs/bandmin_Apr.gif
/usr/bin/install -c -m644 -c images/bandmin_Aug.gif $RPM_BUILD_ROOT/usr/local/bandmin/htdocs/bandmin_Aug.gif
/usr/bin/install -c -m644 -c images/bandmin_Dec.gif $RPM_BUILD_ROOT/usr/local/bandmin/htdocs/bandmin_Dec.gif
/usr/bin/install -c -m644 -c images/bandmin_Feb.gif $RPM_BUILD_ROOT/usr/local/bandmin/htdocs/bandmin_Feb.gif
/usr/bin/install -c -m644 -c images/bandmin_Jan.gif $RPM_BUILD_ROOT/usr/local/bandmin/htdocs/bandmin_Jan.gif
/usr/bin/install -c -m644 -c images/bandmin_Jul.gif $RPM_BUILD_ROOT/usr/local/bandmin/htdocs/bandmin_Jul.gif
/usr/bin/install -c -m644 -c images/bandmin_Jun.gif $RPM_BUILD_ROOT/usr/local/bandmin/htdocs/bandmin_Jun.gif
/usr/bin/install -c -m644 -c images/bandmin_Mar.gif $RPM_BUILD_ROOT/usr/local/bandmin/htdocs/bandmin_Mar.gif
/usr/bin/install -c -m644 -c images/bandmin_May.gif $RPM_BUILD_ROOT/usr/local/bandmin/htdocs/bandmin_May.gif
/usr/bin/install -c -m644 -c images/bandmin_Nov.gif $RPM_BUILD_ROOT/usr/local/bandmin/htdocs/bandmin_Nov.gif
/usr/bin/install -c -m644 -c images/bandmin_Oct.gif $RPM_BUILD_ROOT/usr/local/bandmin/htdocs/bandmin_Oct.gif
/usr/bin/install -c -m644 -c images/bandmin_Sep.gif $RPM_BUILD_ROOT/usr/local/bandmin/htdocs/bandmin_Sep.gif
/usr/bin/install -c -m644 -c images/bandmin_bar.gif $RPM_BUILD_ROOT/usr/local/bandmin/htdocs/bandmin_bar.gif
/usr/bin/install -c -m644 -c images/bandmin_current.gif $RPM_BUILD_ROOT/usr/local/bandmin/htdocs/bandmin_current.gif
/usr/bin/install -c -m644 -c images/bandmin_daily.gif $RPM_BUILD_ROOT/usr/local/bandmin/htdocs/bandmin_daily.gif
/usr/bin/install -c -m644 -c images/bandmin_day.gif $RPM_BUILD_ROOT/usr/local/bandmin/htdocs/bandmin_day.gif
/usr/bin/install -c -m644 -c images/bandmin_domain.gif $RPM_BUILD_ROOT/usr/local/bandmin/htdocs/bandmin_domain.gif
/usr/bin/install -c -m644 -c images/bandmin_logo.gif $RPM_BUILD_ROOT/usr/local/bandmin/htdocs/bandmin_logo.gif
/usr/bin/install -c -m644 -c images/bandmin_background.gif $RPM_BUILD_ROOT/usr/local/bandmin/htdocs/bandmin_background.gif
/usr/bin/install -c -m644 -c images/bandmin_summary.gif $RPM_BUILD_ROOT/usr/local/bandmin/htdocs/bandmin_summary.gif
/usr/bin/install -c -m644 -c images/bandmin_madeingimp.gif $RPM_BUILD_ROOT/usr/local/bandmin/htdocs/bandmin_madeingimp.gif

%files 
%doc README README.IPFW RELEASE.DATE INSTALL ChangeLog COPYING
/usr/local/bandmin
/etc/rc.d/init.d/bandmin

%changelog
* Sun Apr 17 1999 J. Nick Koston
- First RPM builds


%post
echo "`/usr/bin/crontab -l | /bin/grep -v "^#" | \
grep -v "bandmin" | grep -v "ipaddrmap"`" > ./.crontab
echo "2,58 * * * * /usr/local/bandmin/bandmin" >> ./.crontab
echo "15 * * * * /usr/local/bandmin/bandminhtml" >> ./.crontab
echo "0 0 * * * /usr/local/bandmin/ipaddrmap" >> ./.crontab
/usr/bin/crontab ./.crontab
rm -f ./.crontab
/sbin/chkconfig --add bandmin
perl /usr/local/bandmin/upgrade.pl
