rpms/bandwidthd/devel bandwidthd, NONE, 1.1 bandwidthd-destdir.patch, NONE, 1.1 bandwidthd-pgsql.patch, NONE, 1.1 bandwidthd.spec, NONE, 1.1 import.log, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2

Ján ONDREJ ondrejj at fedoraproject.org
Sun Dec 14 10:18:24 UTC 2008


Author: ondrejj

Update of /cvs/pkgs/rpms/bandwidthd/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv14673/devel

Modified Files:
	.cvsignore sources 
Added Files:
	bandwidthd bandwidthd-destdir.patch bandwidthd-pgsql.patch 
	bandwidthd.spec import.log 
Log Message:
Initial import for bandwidthd.


--- NEW FILE bandwidthd ---
#! /bin/bash
#
# bandwidthd
#
# chkconfig: - 90 26
# description: Activates/Deactivates bandwidthd network traffic monitor
PROGNAME=/usr/sbin/bandwidthd

# Source function library.
. /etc/init.d/functions

if [ ! -f /etc/sysconfig/network ]; then
    exit 0
fi

. /etc/sysconfig/network

if [ -f /etc/sysconfig/bandwidthd ]; then
    . /etc/sysconfig/bandwidthd
fi



# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0



# See how we were called.
case "$1" in
  start)
	
        #Register to dns
        echo -n $"Starting Bandwidthd network traffic monitor: "
	daemon $PROGNAME $OPTIONS
	RETVAL=$?
	echo
	
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/bandwidthd
	exit $RETVAL
        ;;

  stop)
        echo -n $"Shuting down Bandwidthd network traffic monitor: "
	killproc `basename $PROGNAME`
        RETVAL=$?
	echo

        [ $RETVAL -eq 0 ] && success || failure        
	echo
	
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/bandwidthd
	exit $RETVAL
        ;;

  status)
	status $PROGNAME
	;;

  condrestart)
        if [ -f /var/lock/subsys/bandwidthd ]; then
            $0 stop
            $0 start
        fi
        ;;

  restart|reload)
	$0 stop
	$0 start
	;;
  *)
        echo $"Usage: $0 {start|stop|restart|reload|status}"
        exit 1
esac

exit 0

bandwidthd-destdir.patch:

--- NEW FILE bandwidthd-destdir.patch ---
diff -ru bandwidthd-2.0.1/bandwidthd.c bandwidthd-2.0.1.new/bandwidthd.c
--- bandwidthd-2.0.1/bandwidthd.c	2005-01-11 22:27:26.000000000 +0100
+++ bandwidthd-2.0.1.new/bandwidthd.c	2005-06-19 03:23:49.000000000 +0200
@@ -255,22 +255,29 @@
 
 	openlog("bandwidthd", LOG_CONS, LOG_DAEMON);
 
-	if (stat("./etc/bandwidthd.conf", &StatBuf))
+	if (stat("/etc/bandwidthd.conf", &StatBuf))
 		{
 		chdir(INSTALL_DIR);
 		if (stat("./etc/bandwidthd.conf", &StatBuf))
 			{
-			printf("Cannot find ./etc/bandwidthd.conf or %s/etc/bandwidthd.conf\n", INSTALL_DIR);
-			syslog(LOG_ERR, "Cannot find ./etc/bandwidthd.conf or %s/etc/bandwidthd.conf", INSTALL_DIR);
+			printf("Cannot find /etc/bandwidthd.conf or %s/etc/bandwidthd.conf\n", INSTALL_DIR);
+			syslog(LOG_ERR, "Cannot find /etc/bandwidthd.conf or %s/etc/bandwidthd.conf", INSTALL_DIR);
 			exit(1);
 			}
+		else
+		        {
+		        bdconfig_in = fopen("./etc/bandwidthd.conf", "rt");
+                        }	
 		}
-
-	bdconfig_in = fopen("./etc/bandwidthd.conf", "rt");
+	else
+	        {
+			bdconfig_in = fopen("/etc/bandwidthd.conf", "rt");
+		}
+		
 	if (!bdconfig_in)
 		{
 		syslog(LOG_ERR, "Cannot open bandwidthd.conf");
-		printf("Cannot open ./etc/bandwidthd.conf\n");
+		printf("Cannot open bandwidthd.conf\n");
 		exit(1);
 		}
 	bdconfig_parse();
@@ -290,6 +297,7 @@
 		(unsigned long) (0-1), (unsigned long long) (0-1));
 		exit(1);
 	*/
+	chdir(INSTALL_DIR);
 
 	for(Counter = 1; Counter < argc; Counter++)
 		{
diff -ru bandwidthd-2.0.1/bandwidthd.h bandwidthd-2.0.1.new/bandwidthd.h
--- bandwidthd-2.0.1/bandwidthd.h	2005-01-11 22:15:49.000000000 +0100
+++ bandwidthd-2.0.1.new/bandwidthd.h	2005-06-19 03:22:21.000000000 +0200
@@ -100,6 +100,7 @@
 
 #define DB_PGSQL 1
 
+
 struct config
 	{
 	char *dev;
Only in bandwidthd-2.0.1.new/etc: bandwidthd.conf.orig
Only in bandwidthd-2.0.1.new/etc: bandwidthd.conf.rej
diff -ru bandwidthd-2.0.1/Makefile.in bandwidthd-2.0.1.new/Makefile.in
--- bandwidthd-2.0.1/Makefile.in	2005-01-11 22:15:49.000000000 +0100
+++ bandwidthd-2.0.1.new/Makefile.in	2005-06-19 03:32:37.000000000 +0200
@@ -1,10 +1,13 @@
 exec_prefix = @exec_prefix@
 prefix = @prefix@
+datadir = @datadir@
+sbindir = @sbindir@
+
 CC = @CC@
 LDFLAGS = @LDFLAGS@ @LIBS@
 OBS= bandwidthd.o graph.o conf.tab.o conf.l.o
 
-CFLAGS= -Wall @CFLAGS@ @CPPFLAGS@ @DEFS@ -DINSTALL_DIR="\"$(exec_prefix)/bandwidthd\""
+CFLAGS= -Wall @CFLAGS@ @CPPFLAGS@ @DEFS@ -DINSTALL_DIR="\"$(datadir)/bandwidthd\""
 NONWALLCFLAGS= @CFLAGS@ @CPPFLAGS@ @DEFS@
 
 # Debugging stuff
@@ -38,12 +41,13 @@
 	rm -f conf.tab.c conf.tab.h conf.l.c config.h.in configure 
 
 install: all
-	@INSTALL@ -d $(DESTDIR)$(exec_prefix)/bandwidthd/etc
-	@INSTALL@ -d $(DESTDIR)$(exec_prefix)/bandwidthd/htdocs
-	@INSTALL@ -m755 -s bandwidthd $(DESTDIR)$(exec_prefix)/bandwidthd	
-	if [ ! -f $(DESTDIR)$(exec_prefix)/bandwidthd/etc/bandwidthd.conf ] ; then @INSTALL@ -m644 etc/bandwidthd.conf $(DESTDIR)$(exec_prefix)/bandwidthd/etc/ ; fi
-	@INSTALL@ -m644 htdocs/legend.gif $(DESTDIR)$(exec_prefix)/bandwidthd/htdocs
-	@INSTALL@ -m644 htdocs/logo.gif $(DESTDIR)$(exec_prefix)/bandwidthd/htdocs
+	@INSTALL@ -d $(DESTDIR)/etc
+	@INSTALL@ -d $(DESTDIR)$(datadir)/bandwidthd/htdocs
+	@INSTALL@ -d $(DESTDIR)$(sbindir)	
+	@INSTALL@ -m755 bandwidthd $(DESTDIR)$(sbindir)/bandwidthd	
+	if [ ! -f $(DESTDIR)/etc/bandwidthd.conf ] ; then @INSTALL@ -m644 etc/bandwidthd.conf $(DESTDIR)/etc/ ; fi
+	@INSTALL@ -m644 htdocs/legend.gif $(DESTDIR)$(datadir)/bandwidthd/htdocs
+	@INSTALL@ -m644 htdocs/logo.gif $(DESTDIR)$(datadir)/bandwidthd/htdocs
 
 #**** Stuff where -WALL is turned off to reduce the noise in a compile so I can see my own errors *******************
 conf.l.o: conf.l.c

bandwidthd-pgsql.patch:

--- NEW FILE bandwidthd-pgsql.patch ---
--- bandwidthd-2.0.1/configure.in	2005-01-11 22:15:49.000000000 +0100
+++ configure.in	2008-12-08 17:35:42.000000000 +0100
@@ -55,8 +55,8 @@
 	[AC_CHECK_LIB(wpcap, pcap_open_live, ,[AC_MSG_ERROR([Bandwidthd requires but cannot find libpcap])])])
 
 # Optional Library
-AC_CHECK_FILE(/usr/local/pgsql/lib, LDFLAGS="$LDFLAGS -L/usr/local/pgsql/lib")
-AC_CHECK_FILE(/usr/local/pgsql/include, CPPFLAGS="$CPPFLAGS -I/usr/local/pgsql/include")
+AC_CHECK_FILE(/usr/lib, LDFLAGS="$LDFLAGS -L/usr/lib")
+AC_CHECK_FILE(/usr/include/pgsql, CPPFLAGS="$CPPFLAGS -I/usr/include/pgsql")
 AC_CHECK_LIB(pq, PQconnectdb,
 	[AC_CHECK_LIB(pq,PQexecParams, ,AC_MSG_WARN([libpq exists but is too old... bandwidthd requires support for PQexecParams]))])
 


--- NEW FILE bandwidthd.spec ---
# You can compile this without postgresql support by running:
# rpmbuild -ba bandwidthd.spec --without pgsql

Name:           bandwidthd
Version:        2.0.1
Release:        8%{?dist}
Summary:        Tracks network usage and builds html and graphs

Group:          System Environment/Daemons
License:        GPL+
URL:            http://bandwidthd.sourceforge.net/
Source0:        http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tgz
Source1:        %{name}
Patch0:         bandwidthd-destdir.patch
Patch1:         bandwidthd-pgsql.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires:  autoconf, gd-devel
%{?!_without_pgsql:BuildRequires: postgresql-devel}
%if "0%{?dist}" == "0.el4"
BuildRequires:  libpcap
%else
BuildRequires:  libpcap-devel
%endif
Requires(post): /sbin/chkconfig
Requires(preun):/sbin/chkconfig
Requires(preun):/sbin/service

%description
Bandwidthd is a UNIX daemon/Windows service for graphing the traffic
generated by each machine on several configurable subnets.  It is much
easier to configure than MRTG, and provides significantly more useful
information.  MRTG only tells you how much bandwidth you are using,
Bandwidthd tells you that, and who is using it.

Each IP address that has moved any significant volume of traffic has its
own graph.  The graphs are color coded to help you figure out at a glance
if your user is surfing the web, or surfing Kazaa.

Bandwidthd is targeted to run on my routing platforms.  It is very low
overhead.  Easily graphing small business traffic on a 133Mhz Elan 486
every 2.5 minutes. My entire ISP (2000-3000 IP addresses across 4 states)
is graphed on a Celeron 450 every 10 minutes.


%prep
%setup -q
%patch0 -p1 -b .dest
%patch1 -p0 -b .pgsql


%build
autoconf
%configure --prefix=%{_prefix} \
  --exec-prefix=%{_prefix} \
  --sysconfdir=%{_sysconfdir} \
  --bindir=%{_bindir} \
  --datadir=%{_var}/www
make %{?_smp_mflags}


%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
# init script
install -d $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d
install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/
# install apache configuration
install -d $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d
echo "Alias /%{name} %{_var}/www/%{name}/htdocs" \
  > $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/%{name}.conf
# remove execute bit for gif and sh script without #!
chmod -x phphtdocs/*


%clean
rm -rf $RPM_BUILD_ROOT


%post
/sbin/chkconfig --add bandwidthd

%preun
if [ $1 = 0 ]; then
 /sbin/service bandwidthd stop > /dev/null 2>&1
 /sbin/chkconfig --del bandwidthd
fi


%files
%defattr(-,root,root,-)
%doc README CHANGELOG TODO
%{?!_without_pgsql:%doc phphtdocs}
%config(noreplace) %{_sysconfdir}/%{name}.conf
%config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf
%attr(755,root,root) %{_sysconfdir}/rc.d/init.d/%{name}
%{_sbindir}/%{name}
%dir %{_var}/www/%{name}
%{_var}/www/%{name}/*


%changelog
* Sat Dec 13 2008 Jan ONDREJ (SAL) <ondrejj(at)salstar.sk> - 2.0.1-8
- removed dependency on gd
- removed one line of autoconf
- removed dependency on libpng-devel
- phphtdocs added for pgsql build, execute bit for gif and sh removed

* Mon Dec 8 2008 Jan ONDREJ (SAL) <ondrejj(at)salstar.sk> - 2.0.1-7
- changed License to GPL+

* Mon Dec 8 2008 Jan ONDREJ (SAL) <ondrejj(at)salstar.sk> - 2.0.1-6
- buildroot macro replaced by RPM_BUILD_ROOT variable
- added autoconf into build-requires
- by default compiled with postgresql support
- conditional build without postgresql (--without pgsql)
- libpng removed from requires

* Mon Dec 8 2008 Jan ONDREJ (SAL) <ondrejj(at)salstar.sk> - 2.0.1-5
- conditional build for el4

* Sun Sep 9 2007 Jan ONDREJ (SAL) <ondrejj(at)salstar.sk> - 2.0.1-4
- updated license and summary
- changed init script permissions

* Tue Mar 13 2007 Jan ONDREJ (SAL) <ondrejj(at)salstar.sk>
- updated from version by Michal Ambroz <rebus at seznam.cz>
- added apache configuration script
- moved into /var/www/bandwidthd
- spec file name typo fixed


--- NEW FILE import.log ---
bandwidthd-2_0_1-8_fc10:HEAD:bandwidthd-2.0.1-8.fc10.src.rpm:1229249844


Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/bandwidthd/devel/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore	14 Dec 2008 05:28:43 -0000	1.1
+++ .cvsignore	14 Dec 2008 10:17:52 -0000	1.2
@@ -0,0 +1 @@
+bandwidthd-2.0.1.tgz


Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/bandwidthd/devel/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources	14 Dec 2008 05:28:43 -0000	1.1
+++ sources	14 Dec 2008 10:17:52 -0000	1.2
@@ -0,0 +1 @@
+aa79aad7bd489fd2cae1f7dc086ca8b6  bandwidthd-2.0.1.tgz




More information about the fedora-extras-commits mailing list