--- bwbar-1.2.3.orig/debian/README.Debian
+++ bwbar-1.2.3/debian/README.Debian
@@ -0,0 +1,4 @@
+There is a /etc/default/bwbar file to configure before this package will
+work.
+
+Scott Dier <sdier@debian.org>
--- bwbar-1.2.3.orig/debian/postinst
+++ bwbar-1.2.3/debian/postinst
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+set -e
+
+update-rc.d bwbar defaults >/dev/null
+invoke-rc.d bwbar start
+
+#DEBHELPER#
+
+exit 0
--- bwbar-1.2.3.orig/debian/rules
+++ bwbar-1.2.3/debian/rules
@@ -0,0 +1,17 @@
+#!/usr/bin/make -f
+
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/class/autotools.mk
+include /usr/share/cdbs/1/rules/simple-patchsys.mk
+
+DEB_MAKE_INSTALL_TARGET = 
+
+cleanbuilddir::
+	rm -f config.log config.status
+
+common-install-arch common-install-indep:: common-install-impl
+common-install-impl::
+	cp $(CURDIR)/bwbar $(CURDIR)/debian/bwbar/usr/sbin/
+	cp $(CURDIR)/debian/otherfiles/bwbar $(CURDIR)/debian/bwbar/etc/init.d/
+	cp $(CURDIR)/debian/otherfiles/bwbar-default $(CURDIR)/debian/bwbar/etc/default/bwbar
+	chmod 755 $(CURDIR)/debian/bwbar/etc/init.d/bwbar
--- bwbar-1.2.3.orig/debian/changelog
+++ bwbar-1.2.3/debian/changelog
@@ -0,0 +1,111 @@
+bwbar (1.2.3-2) unstable; urgency=low
+
+  * Fix FTBFS with libpng 1.5,
+    thanks to Nobuhiro Iwamatsu<iwamatsu@nigauri.org>
+    (Closes: #635742)
+  * Update dh compat to 7
+  * Bump standards version
+
+ -- Julien Danjou <acid@debian.org>  Thu, 28 Jul 2011 16:13:14 +0200
+
+bwbar (1.2.3-1) unstable; urgency=low
+
+  * New upstream release
+  * Bump standards version
+  * Add LSB section to init script
+  * Enhance init script
+
+ -- Julien Danjou <acid@debian.org>  Mon, 11 Sep 2006 14:05:37 +0200
+
+bwbar (1.2.2-4) unstable; urgency=low
+
+  * New maintainer
+  * Bump standards version
+  * Use debhelper 4
+  * Remove http://www.kernel.org from description since this is no more
+    accurate
+  * Update README.Debian
+  * Rework patches
+    - Handle new options correctly (Closes: #313231)
+  * Add manpage (Closes: #129668)
+  * Fix {pre,post}{rm,inst} scripts to use invoke-rc.d
+
+ -- Julien Danjou <acid@debian.org>  Sun, 23 Apr 2006 13:11:09 +0200
+
+bwbar (1.2.2-3.1) unstable; urgency=low
+
+  * NMU
+  * Fix a wrong setting in rules, causing FTBFS (Closes: #358940)
+
+ -- Julien Danjou <acid@debian.org>  Fri, 21 Apr 2006 18:03:11 +0200
+
+bwbar (1.2.2-3) unstable; urgency=low
+
+  * Applied patch from Adrian Reber that fixed the short flag (d) for
+    directory. (Closes: #260999)
+
+ -- Scott M. Dier <sdier@debian.org>  Sat, 24 Jul 2004 00:20:02 -0500
+
+bwbar (1.2.2-2) unstable; urgency=low
+
+  * Added Build-Depends on cdbs.
+
+ -- Scott M. Dier <sdier@debian.org>  Tue,  8 Jun 2004 07:36:25 -0500
+
+bwbar (1.2.2-1) unstable; urgency=low
+
+  * New upstream release (Closes: #250730)
+  * Converted to cdbs.
+  * Added patch to support {K,M,G}B/s. (Closes: #249852)
+
+ -- Scott M. Dier <sdier@debian.org>  Tue,  1 Jun 2004 15:01:34 -0500
+
+bwbar (1.2-7) unstable; urgency=low
+
+  * Fixed fscanf call in bwbar.c for longer interface names.
+    (Closes: #246054)
+  * Fixed README for inaccurate configuration information. (Closes: #229162)
+
+ -- Scott M. Dier <sdier@debian.org>  Wed, 12 May 2004 01:01:48 -0500
+
+bwbar (1.2-6) unstable; urgency=low
+
+  * Fixed init.d message about being unconfigured. (Closes: #199202)
+  * Recompiled against libpng3. (Closes: #180243)
+
+ -- Scott M. Dier <sdier@debian.org>  Wed, 10 Dec 2003 20:44:05 -0600
+
+bwbar (1.2-5) unstable; urgency=low
+
+  * Fixed that I didn't reperm the init.d script, this causes issues
+  because diffs don't keep permissions.  Closes: #122310
+
+ -- Scott M. Dier <sdier@debian.org>  Tue,  4 Dec 2001 01:08:37 -0600
+
+bwbar (1.2-4) unstable; urgency=low
+
+  * Didn't copy a line right in the init.d script, fixed. Closes: #119536
+
+ -- Scott M. Dier <sdier@debian.org>  Wed, 14 Nov 2001 14:31:34 -0600
+
+bwbar (1.2-3) unstable; urgency=low
+
+  * Fixed build-deps, added libpng2-dev.  closes: #114375
+
+ -- Scott M. Dier <sdier@debian.org>  Sat,  6 Oct 2001 20:27:46 -0500
+
+bwbar (1.2-2) unstable; urgency=low
+
+  * Added --directory function to daemon.
+
+ -- Scott M. Dier <sdier@debian.org>  Mon,  1 Oct 2001 02:00:52 -0500
+
+bwbar (1.2-1) unstable; urgency=low
+
+  * Initial Release.
+
+ -- Scott M. Dier <sdier@debian.org>  Sun, 30 Sep 2001 23:35:14 -0500
+
+Local variables:
+mode: debian-changelog
+End:
--- bwbar-1.2.3.orig/debian/postrm
+++ bwbar-1.2.3/debian/postrm
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = purge ]; then
+	update-rc.d bwbar remove >/dev/null
+fi
+
+#DEBHELPER#
+
--- bwbar-1.2.3.orig/debian/prerm
+++ bwbar-1.2.3/debian/prerm
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+case "$1" in
+    remove|upgrade|deconfigure)
+    	invoke-rc.d bwbar stop
+    ;;
+    failed-upgrade)
+    ;;
+    *)
+	echo "prerm called with unknown argument \`$1'" >&2
+	exit 0
+    ;;
+esac
+
+#DEBHELPER#
+
+exit 0
+
--- bwbar-1.2.3.orig/debian/compat
+++ bwbar-1.2.3/debian/compat
@@ -0,0 +1 @@
+7
--- bwbar-1.2.3.orig/debian/docs
+++ bwbar-1.2.3/debian/docs
@@ -0,0 +1 @@
+README
--- bwbar-1.2.3.orig/debian/manpages
+++ bwbar-1.2.3/debian/manpages
@@ -0,0 +1 @@
+debian/bwbar.8
--- bwbar-1.2.3.orig/debian/copyright
+++ bwbar-1.2.3/debian/copyright
@@ -0,0 +1,15 @@
+This package was debianized by Scott M. Dier <sdier@debian.org> on
+Sun, 30 Sep 2001 23:35:14 -0500.
+
+It was downloaded from http://www.kernel.org/pub/software/web/bwbar/
+
+Upstream Author: Peter Anvin <hpa@zytor.com>
+
+Copyright:
+
+Copyright 1999-2001 H. Peter Anvin - All Rights Reserved
+
+You are free to distribute this software under the terms of
+the GNU General Public License.
+On Debian systems, the complete text of the GNU General Public
+License can be found in /usr/share/common-licenses/GPL file.
--- bwbar-1.2.3.orig/debian/dirs
+++ bwbar-1.2.3/debian/dirs
@@ -0,0 +1,3 @@
+usr/sbin
+etc/init.d
+etc/default
--- bwbar-1.2.3.orig/debian/preinst
+++ bwbar-1.2.3/debian/preinst
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+	upgrade)
+		invoke-rc.d bwbar stop
+	;;
+	install)
+	;;
+	*)
+	echo "preinst called with unknown argument \`$1'" >&2
+	exit 0
+	;;
+esac
+
+#DEBHELPER#
+
+exit 0
--- bwbar-1.2.3.orig/debian/control
+++ bwbar-1.2.3/debian/control
@@ -0,0 +1,16 @@
+Source: bwbar
+Section: net
+Priority: optional
+Maintainer: Julien Danjou <acid@debian.org>
+Build-Depends: debhelper (>> 7.0.0), libpng12-dev, cdbs
+Standards-Version: 3.9.2
+
+Package: bwbar
+Architecture: any
+Depends: ${shlibs:Depends}
+Description: generates text and graphical readout of current bandwidth use
+ This program will output a PNG and a text file that can be used in scripts
+ or be included in web pages to show current bandwidth usage.  The amount
+ of total bandwidth can be customized.  The PNG output appears as a bar graph
+ showing maximum possible usage with the current inbound or outbound usage 
+ shown as a differently colored bar.
--- bwbar-1.2.3.orig/debian/bwbar.8
+++ bwbar-1.2.3/debian/bwbar.8
@@ -0,0 +1,78 @@
+.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.35.
+.TH BWBAR "8" "Apr. 18, 2006" "bwbar 1.2.3"
+.SH NAME
+bwbar \- generates text and graphical readout of current bandwidth use. 
+.SH SYNOPSIS
+.B bwbar
+[\fB\-i|-o\fR] [\fB\-g|-G|-k|-K|-m|-M\fR] [\fIOPTION\fR]... \fIINTERFACE\fR \fIMAX_MBPS\fR
+.SH DESCRIPTION
+Generates text and graphical readout of current bandwidth use.
+.SH OPTIONS
+.TP
+\fB\-b\fR, \fB\-\-border\fR=\fIN\fR 
+Set border width of the graphical bar to N (default 1 pixel).
+.TP
+\fB\-d\fR, \fB\-\-directory\fR=\fIN\fR 
+Output directory is N.
+.TP
+\fB\-f\fR, \fB\-\-text\-file\fR=\fIN\fR
+Set N as name of the text output file (default ubar.txt).
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+Display usage.
+.TP
+\fB\-p\fR, \fB\-\-png\-file\fR=\fIN\fR
+Set N as name of the graphical bar file (default ubar.png).
+.TP
+\fB\-t\fR, \fB\-\-interval\fR=\fIN\fR
+The poll interval in seconds is N (default 15 seconds).
+.TP
+\fB\-x\fR, \fB\-\-width\fR=\fIN\fR
+Set the width of the graphical bar to N (default 600 pixels).
+.TP
+\fB\-y\fR, \fB\-\-height\fR=\fIN\fR
+Set the height of the graphical bar to N (default 4 pixels).
+.SH FLAGS
+.TP
+\fB\-i\fR, \fB\-\-input\fR
+Measure input bandwidth.
+.TP
+\fB\-g\fR, \fB\-\-GBps\fR
+Bandwidth is measured in GB/s.
+.TP
+\fB\-G\fR, \fB\-\-Gbps\fR
+Bandwidth is measured in Gbit/s.
+.TP
+\fB\-k\fR, \fB\-\-kbps\fR
+Bandwidth is measured in kbit/s.
+.TP
+\fB\-K\fR, \fB\-\-KBps\fR
+Bandwidth is measured in KB/s.
+.TP
+\fB\-m\fR, \fB\-\-MBps\fR
+Bandwidth is measured in MB/s.
+.TP
+\fB\-M\fR, \fB\-\-Mbps\fR
+Bandwidth is measured in Mbit/s.
+.TP
+\fB\-o\fR, \fB\-\-output\fR
+Measure output bandwidth.
+.PP
+Default values are \fB\-M\fR and \fB\-o\fR.
+.SH AUTHOR
+Written by Nacho Barrientos Arias <chipi@criptonita.com>.
+.SH BUGS
+Report bugs to <hpa@zytor.com>.
+.SH COPYRIGHT
+Copyright \(co 1999-2001 H. Peter Anvin - All Rights Reserved
+.br
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, Inc.
+.SH "SEE ALSO"
+You can get all the available information for
+.B bwbar
+in:
+.IP
+.B http://www.kernel.org/pub/software/web/bwbar/
+.PP
--- bwbar-1.2.3.orig/debian/otherfiles/bwbar-default
+++ bwbar-1.2.3/debian/otherfiles/bwbar-default
@@ -0,0 +1,6 @@
+# Directory to put files into
+#DIR=/var/www
+# Who to run as
+#RUNAS=www-data
+# What are the options (eth0, scale of 1.5mbps)
+#OPTIONS="eth0 1.5"
--- bwbar-1.2.3.orig/debian/otherfiles/bwbar
+++ bwbar-1.2.3/debian/otherfiles/bwbar
@@ -0,0 +1,59 @@
+#!/bin/sh
+#
+### BEGIN INIT INFO
+# Provides:          bwbar
+# Required-Start:      $local_fs
+# Required-Stop:       $local_fs
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: generates text and graphical readout of current bandwidth use
+# Description:       This program will output a PNG and a text file that can be
+#                    used in scripts or be included in web pages to show current
+#                    bandwidth usage.
+### END INIT INFO
+
+if [ -r /etc/default/bwbar ]; then
+      . /etc/default/bwbar
+fi
+
+# default settings are suggestions, they may or may not fit your situation
+RUNME=/usr/sbin/bwbar
+
+case "$1" in
+	start)
+                if [ -z "$DIR" -a -z "$RUNAS" -a -z "$OPTIONS" ]
+                then
+                        echo "not starting bwbar, please edit /etc/default/bwbar"
+                        exit 0
+                fi
+		echo -n "Starting bandwidth bar daemon: "
+		start-stop-daemon --start -b -c $RUNAS --exec $RUNME -- --directory=$DIR $OPTIONS
+		echo "bwbar."
+		;;
+	stop)
+                if [ -z "$DIR" -a -z "$RUNAS" -a -z "$OPTIONS" ]
+                then
+                        exit 0
+                fi
+		echo -n "Stopping bandwidth bar daemon: "
+		start-stop-daemon --stop -u $RUNAS --exec $RUNME
+		echo "bwbar."
+		;;
+	restart|force-reload)
+                if [ -z "$DIR" -a -z "$RUNAS" -a -z "$OPTIONS" ]
+                then
+                        echo "not starting bwbar, please edit /etc/default/bwbar"
+                        exit 0
+                fi
+		echo -n "Restarting bandwidth bar daemon: "
+		start-stop-daemon --stop -u $RUNAS --exec $RUNME
+		sleep 1
+		start-stop-daemon --start -b -c $RUNAS --exec $RUNME -- --directory=$DIR $OPTIONS
+		echo "bwbar."
+		;;
+	*)
+		echo "Usage: /etc/init.d/bwbar {start|stop|restart|force-reload}"
+		exit 1
+esac
+
+exit 0
--- bwbar-1.2.3.orig/debian/patches/030_newunits.diff
+++ bwbar-1.2.3/debian/patches/030_newunits.diff
@@ -0,0 +1,55 @@
+diff -u bwbar-1.2.orig/bwbar.c bwbar-1.2/bwbar.c
+--- bwbar-1.2.orig/bwbar.c	2004-05-19 16:36:16.000000000 +0200
++++ bwbar-1.2/bwbar.c	2004-05-19 16:38:12.000000000 +0200
+@@ -157,6 +157,9 @@
+   { "kbps",         0, 0, 'k' },
+   { "Mbps",         0, 0, 'M' },
+   { "Gbps",         0, 0, 'G' },
++  { "KBps",         0, 0, 'K' },
++  { "MBps",         0, 0, 'm' },
++  { "GBps",         0, 0, 'g' },
+   { "help",         0, 0, 'h' },
+   { 0, 0, 0, 0 }
+ };
+@@ -180,6 +183,9 @@
+ 	  "   --kbps                -k   Bandwidth is measured in kbit/s\n"
+ 	  "   --Mbps                -M   Bandwidth is measured in Mbit/s (default)\n"
+ 	  "   --Gbps                -G   Bandwidth is measured in Gbit/s\n"
++	  "   --KBps                -K   Bandwidth is measured in KB/s\n"
++	  "   --MBps                -m   Bandwidth is measured in MB/s\n"
++	  "   --GBps                -g   Bandwidth is measured in GB/s\n"
+ 	  "   --help                -h   Display this text\n",
+ 	  program);
+   exit(err);
+@@ -259,6 +265,18 @@
+       unit = 1.0e+9;
+       unit_name = "Gbit/s";
+       break;
++    case 'K':
++      unit = 8.0e+3;
++      unit_name = "KB/s";
++      break;
++    case 'm':
++      unit = 8.0e+6;
++      unit_name = "MB/s";
++      break;
++    case 'g':
++      unit = 8.0e+9;
++      unit_name = "GB/s";
++      break;
+     case 'h':
+       usage(0);
+       break;
+Common subdirectories: bwbar-1.2.orig/debian and bwbar-1.2/debian
+diff -u bwbar-1.2.orig/README bwbar-1.2/README
+--- bwbar-1.2.orig/README	2004-05-19 16:36:16.000000000 +0200
++++ bwbar-1.2/README	2004-05-19 16:38:14.000000000 +0200
+@@ -68,4 +71,8 @@
+    --kbps                -k   Bandwidth is measured in kbit/s
+    --Mbps                -M   Bandwidth is measured in Mbit/s (default)
+    --Gbps                -G   Bandwidth is measured in Gbit/s
++   --KBps                -K   Bandwidth is measured in KB/s
++   --MBps                -m   Bandwidth is measured in MB/s
++   --GBps                -g   Bandwidth is measured in GB/s
+    --help                -h   Display this text
++
--- bwbar-1.2.3.orig/debian/patches/020_proc_net_2.6.x_fix.diff
+++ bwbar-1.2.3/debian/patches/020_proc_net_2.6.x_fix.diff
@@ -0,0 +1,11 @@
+--- bwbar.c	2004-06-01 14:54:12.000000000 -0500
++++ ../tmp/bwbar-1.2/bwbar.c	2004-05-12 00:58:50.000000000 -0500
+@@ -315,7 +315,7 @@
+ 
+     /* Get interface info */
+     do {
+-      if ( fscanf(pnd, " %6[^:]:%u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u",
++      if ( fscanf(pnd, " %8[^:]:%u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u",
+ 		  ifc.name,
+ 		  &ifc.r_bytes, &ifc.r_pkt, &ifc.r_err, &ifc.r_drop,
+ 		  &ifc.r_fifo, &ifc.r_frame, &ifc.r_compr, &ifc.r_mcast,
--- bwbar-1.2.3.orig/debian/patches/010_directory_option.diff
+++ bwbar-1.2.3/debian/patches/010_directory_option.diff
@@ -0,0 +1,76 @@
+--- ./bwbar.c	2001-09-21 17:33:35.000000000 -0500
++++ ../bwbar-1.2/bwbar.c	2003-12-10 20:43:59.000000000 -0600
+@@ -147,6 +147,7 @@
+ const struct option longopts[] = {
+   { "input",        0, 0, 'i' },
+   { "output",       0, 0, 'o' },
++  { "directory",    1, 0, 'd' },
+   { "text-file",    1, 0, 'f' },
+   { "png-file",     1, 0, 'p' },
+   { "interval",     1, 0, 't' },
+@@ -169,6 +170,7 @@
+ 	  "Options: (defaults in parenthesis)\n"
+ 	  "   --input               -i   Measure input bandwidth\n"
+ 	  "   --output              -o   Measure output bandwidth (default)\n"
++	  "   --directory           -d   Output directory\n"
+ 	  "   --text-file <file>    -f   The name of the text output file (ubar.txt)\n"
+ 	  "   --png-file <file>     -p   The name of the graphical bar file (ubar.png)\n"
+ 	  "   --interval <seconds>  -t   The poll interval in seconds (15)\n"
+@@ -205,6 +207,8 @@
+   int measure_input = 0;	/* Input instead of output */
+   char *text_file = "ubar.txt";	/* Text filename */
+   char *graphics_file = "ubar.png"; /* Graphics filename */
++  char *directory = ""; /* Directory name */
++  char *tmp_char;
+   char *unit_name = "Mbit/s";	/* Unit name */
+   double unit = 1.0e+6;		/* Unit multiplier */
+   int interval = 15;		/* Interval between measurements (s) */
+@@ -214,7 +218,7 @@
+ 
+   program = argv[0];
+ 
+-  while ( (opt = getopt_long(argc, argv, "iof:p:t:x:y:b:kMGh", longopts, NULL)) != -1 ) {
++  while ( (opt = getopt_long(argc, argv, "iof:p:t:x:y:b:kMGhd:", longopts, NULL)) != -1 ) {
+     switch ( opt ) {
+     case 'i':
+       measure_input = 1;
+@@ -228,6 +232,9 @@
+     case 'p':
+       graphics_file = optarg;
+       break;
++    case 'd':
++      directory = optarg;
++      break;
+     case 't':
+       interval = atoi(optarg);
+       break;
+@@ -264,6 +271,18 @@
+   if ( argc-optind != 2 )
+     usage(1);
+ 
++  	tmp_char = text_file;
++	text_file = malloc(strlen(text_file) + strlen(directory) + 5);
++	strcpy(text_file, directory);
++	strcat(text_file, "/");
++	strcat(text_file, tmp_char);
++	
++	tmp_char = graphics_file;
++	graphics_file = malloc(strlen(graphics_file) + strlen(directory) + 5);
++	strcpy(graphics_file, directory);
++	strcat(graphics_file, "/");
++	strcat(graphics_file, tmp_char);
++
+   t_tmp = malloc(strlen(text_file) + 5);
+   g_tmp = malloc(strlen(graphics_file) + 5);
+   if ( !t_tmp || !g_tmp ) {
+diff -u bwbar-1.2.orig/README bwbar-1.2/README
+--- bwbar-1.2.orig/README       2004-05-19 16:36:16.000000000 +0200
++++ bwbar-1.2/README    2004-05-19 16:38:14.000000000 +0200
+@@ -59,6 +59,7 @@
+ Options: (defaults in parenthesis)
+    --input               -i   Measure input bandwidth
+    --output              -o   Measure output bandwidth (default)
++   --directory           -d   Output directory
+    --text-file <file>    -f   The name of the text output file (ubar.txt)
+    --png-file <file>     -p   The name of the graphical bar file (ubar.png)
+    --interval <seconds>  -t   The poll interval in seconds (15)
