Parcourir la source

Addition of bandwidthd from the oldpackages

Signed-off-by: Jean-Michel Lacroix lacroix@lepine-lacroix.info
Jean-Michel Lacroix il y a 9 ans
Parent
révision
ca4bdeaba6

+ 65
- 0
utils/bandwidthd/Makefile Voir le fichier

@@ -0,0 +1,65 @@
1
+#
2
+# Copyright (C) 2006-2015 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+include $(TOPDIR)/rules.mk
9
+
10
+PKG_NAME:=bandwidthd
11
+PKG_VERSION:=2.0.1
12
+PKG_RELEASE:=4
13
+
14
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
15
+PKG_SOURCE_URL:=@SF/bandwidthd
16
+PKG_MD5SUM:=aa79aad7bd489fd2cae1f7dc086ca8b6
17
+
18
+PKG_MAINTAINER:=Jean-Michel Lacroix <lacroix@lepine-lacroix.info>
19
+
20
+PKG_LICENSE:=GPL-2.0
21
+PKG_LICENSE_FILES:=
22
+
23
+include $(INCLUDE_DIR)/package.mk
24
+
25
+define Package/bandwidthd
26
+  SECTION:=utils
27
+  CATEGORY:=Utilities
28
+  TITLE:=Bandwidthd
29
+  URL:=http://bandwidthd.sourceforge.net/
30
+  DEPENDS:=+libgd +libpcap
31
+endef
32
+
33
+define Package/bandwidthd/daemon
34
+ This package contains bandwidthd a bandwith tracking utility.
35
+endef
36
+
37
+CONFIGURE_ARGS += \
38
+	ac_cv_file__sw_lib=no \
39
+	ac_cv_file__sw_include=no \
40
+	ac_cv_file__usr_pkg_lib=no \
41
+	ac_cv_file__usr_pkg_include=no \
42
+	ac_cv_file__usr_local_pgsql_lib=no \
43
+	ac_cv_file__usr_local_pgsql_include=no \
44
+	ac_cv_lib_pq_PQconnectdb=no \
45
+
46
+EXTRA_CFLAGS+= $(TARGET_CPPFLAGS)
47
+EXTRA_LDFLAGS+= $(TARGET_LDFLAGS) -Wl,-rpath-link,$(STAGING_DIR)/usr/lib
48
+
49
+define Package/bandwidthd/install
50
+	$(INSTALL_DIR) $(1)/usr/sbin
51
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/bandwidthd $(1)/usr/sbin/
52
+	$(INSTALL_DIR) $(1)/etc/config
53
+	$(INSTALL_DATA) ./files/bandwidthd.config $(1)/etc/config/bandwidthd
54
+	$(INSTALL_DIR) $(1)/etc/init.d
55
+	$(INSTALL_BIN) ./files/bandwidthd.init $(1)/etc/init.d/bandwidthd
56
+	$(INSTALL_DIR) $(1)/www
57
+	$(INSTALL_DATA) $(PKG_BUILD_DIR)/htdocs/legend.gif $(1)/www/
58
+	$(INSTALL_DATA) $(PKG_BUILD_DIR)/htdocs/logo.gif $(1)/www/
59
+endef
60
+
61
+define Package/bandwidthd/conffiles
62
+/etc/config/bandwidthd
63
+endef
64
+
65
+$(eval $(call BuildPackage,bandwidthd))

+ 11
- 0
utils/bandwidthd/files/bandwidthd.config Voir le fichier

@@ -0,0 +1,11 @@
1
+config bandwidthd
2
+	option dev	br-lan
3
+	option subnets		"192.168.0.0/16 10.0.0.0/8 172.16.0.0/12"
4
+	option skip_intervals	0
5
+	option graph_cutoff	1024
6
+	option promiscuous	true
7
+	option output_cdf	false
8
+	option recover_cdf	false
9
+	option filter		ip
10
+	option graph		true
11
+	option meta_refresh	150

+ 88
- 0
utils/bandwidthd/files/bandwidthd.init Voir le fichier

@@ -0,0 +1,88 @@
1
+#!/bin/sh /etc/rc.common
2
+# Copyright (C) 2008-2011 OpenWrt.org
3
+
4
+START=99
5
+
6
+config_cb() {
7
+	local cfg_type="$1"
8
+	local cfg_name="$2"
9
+
10
+	case "$cfg_type" in
11
+	        bandwidthd)
12
+	                append cfgs "$cfg_name"
13
+	        ;;
14
+	esac
15
+}
16
+
17
+export_bool() {
18
+	local option="$1"
19
+	local section="$2"
20
+	local _loctmp
21
+	config_get_bool _loctmp "$section" "$option"
22
+	if [ -n "$_loctmp" ]; then
23
+		conffile="${conffile}$option "
24
+		if [ 1 -eq "$_loctmp" ]; then
25
+			conffile="${conffile}true"
26
+		else
27
+			conffile="${conffile}false"
28
+		fi
29
+		conffile="${conffile}\n"
30
+	fi
31
+}
32
+
33
+export_number() {
34
+	local option="$1"
35
+	local section="$2"
36
+	local _loctmp
37
+	config_get _loctmp "$section" "$option"
38
+	if [ -n "$_loctmp" ]; then
39
+		conffile="${conffile}$option ${_loctmp}\n"
40
+	fi
41
+}
42
+
43
+export_string() {
44
+	local option="$1"
45
+	local section="$2"
46
+	local _loctmp
47
+	config_get _loctmp "$section" "$option"
48
+	if [ -n "$_loctmp" ]; then
49
+		conffile="${conffile}$option \"${_loctmp}\"\n"
50
+	fi
51
+}
52
+
53
+start() {
54
+	local subnet conffile
55
+
56
+	[ -d /tmp/bandwidthd ] || mkdir -p /tmp/bandwidthd && cp /www/legend.gif /www/logo.gif /tmp/bandwidthd/
57
+	[ -e /htdocs ] || ln -s /tmp/bandwidthd /htdocs
58
+	[ -e /www/bandwidthd ] || ln -s /tmp/bandwidthd /www/bandwidthd
59
+	rm -f /tmp/bandwidthd.conf
60
+	touch /tmp/bandwidthd.conf
61
+	[ -e /etc/bandwidthd.conf ] || ln -s /tmp/bandwidthd.conf /etc/bandwidthd.conf
62
+	
63
+	
64
+	config_load bandwidthd
65
+	for cfg in $cfgs; do
66
+		config_get subnets $cfg subnets
67
+			for subnet in $subnets; do
68
+				conffile="${conffile}subnet ${subnet}\n"
69
+			done
70
+		export_string dev $cfg
71
+		export_number skip_intervals $cfg
72
+		export_number graph_cutoff $cfg
73
+		export_bool promiscuous $cfg
74
+		export_bool output_cdf $cfg
75
+		export_bool recover_cdf $cfg
76
+		export_string filter $cfg
77
+		export_bool graph $cfg
78
+		export_number meta_refresh $cfg
79
+		[ -n "$conffile" ] && echo -e "$conffile" >>/tmp/bandwidthd.conf
80
+		unset conffile
81
+	done
82
+	cd /
83
+	service_start /usr/sbin/bandwidthd
84
+}
85
+
86
+stop() {
87
+	service_stop /usr/sbin/bandwidthd
88
+}

BIN
utils/bandwidthd/files/logo.gif Voir le fichier


+ 36
- 0
utils/bandwidthd/patches/010-dont-add-host-paths.patch Voir le fichier

@@ -0,0 +1,36 @@
1
+diff --git a/configure b/configure
2
+index 4c2546e..e516137 100755
3
+--- a/configure
4
++++ b/configure
5
+@@ -2439,11 +2439,6 @@ if test -n "$x_libraries" && test "x$x_libraries" != xNONE ; then
6
+ 	LDFLAGS="$LDFLAGS -L$x_libraries"
7
+ fi
8
+ 
9
+-# May be equired for BSD
10
+-LDFLAGS="$LDFLAGS -L/usr/local/lib"
11
+-
12
+-CPPFLAGS="$CPPFLAGS -I/usr/local/include"
13
+-
14
+ #Check for Darwin sw directory
15
+ echo "$as_me:2448: checking for /sw/lib" >&5
16
+ echo $ECHO_N "checking for /sw/lib... $ECHO_C" >&6
17
+@@ -2505,9 +2500,6 @@ fi
18
+ fi
19
+ echo "$as_me:2506: result: $ac_cv_file__usr_pkg_lib" >&5
20
+ echo "${ECHO_T}$ac_cv_file__usr_pkg_lib" >&6
21
+-if test $ac_cv_file__usr_pkg_lib = yes; then
22
+-  LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
23
+-fi
24
+ 
25
+ echo "$as_me:2512: checking for /usr/pkg/include" >&5
26
+ echo $ECHO_N "checking for /usr/pkg/include... $ECHO_C" >&6
27
+@@ -3092,9 +3084,6 @@ fi
28
+ fi
29
+ echo "$as_me:3093: result: $ac_cv_file__usr_local_pgsql_lib" >&5
30
+ echo "${ECHO_T}$ac_cv_file__usr_local_pgsql_lib" >&6
31
+-if test $ac_cv_file__usr_local_pgsql_lib = yes; then
32
+-  LDFLAGS="$LDFLAGS -L/usr/local/pgsql/lib"
33
+-fi
34
+ 
35
+ echo "$as_me:3099: checking for /usr/local/pgsql/include" >&5
36
+ echo $ECHO_N "checking for /usr/local/pgsql/include... $ECHO_C" >&6

+ 31
- 0
utils/bandwidthd/patches/100-fix_config_file_location Voir le fichier

@@ -0,0 +1,31 @@
1
+--- bandwidthd-2.0.1/bandwidthd.c.orig	2008-05-09 10:06:37.000000000 -0500
2
++++ bandwidthd-2.0.1/bandwidthd.c	2008-05-09 10:32:54.000000000 -0500
3
+@@ -255,22 +255,22 @@
4
+ 
5
+ 	openlog("bandwidthd", LOG_CONS, LOG_DAEMON);
6
+ 
7
+-	if (stat("./etc/bandwidthd.conf", &StatBuf))
8
++	if (stat("/etc/bandwidthd.conf", &StatBuf))
9
+ 		{
10
+ 		chdir(INSTALL_DIR);
11
+-		if (stat("./etc/bandwidthd.conf", &StatBuf))
12
++		if (stat("/etc/bandwidthd.conf", &StatBuf))
13
+ 			{
14
+-			printf("Cannot find ./etc/bandwidthd.conf or %s/etc/bandwidthd.conf\n", INSTALL_DIR);
15
+-			syslog(LOG_ERR, "Cannot find ./etc/bandwidthd.conf or %s/etc/bandwidthd.conf", INSTALL_DIR);
16
++			printf("Cannot find /etc/bandwidthd.conf or %s/etc/bandwidthd.conf\n", INSTALL_DIR);
17
++			syslog(LOG_ERR, "Cannot find /etc/bandwidthd.conf or %s/etc/bandwidthd.conf", INSTALL_DIR);
18
+ 			exit(1);
19
+ 			}
20
+ 		}
21
+ 
22
+-	bdconfig_in = fopen("./etc/bandwidthd.conf", "rt");
23
++	bdconfig_in = fopen("/etc/bandwidthd.conf", "rt");
24
+ 	if (!bdconfig_in)
25
+ 		{
26
+ 		syslog(LOG_ERR, "Cannot open bandwidthd.conf");
27
+-		printf("Cannot open ./etc/bandwidthd.conf\n");
28
++		printf("Cannot open /etc/bandwidthd.conf\n");
29
+ 		exit(1);
30
+ 		}
31
+ 	bdconfig_parse();