2006-08-11 16:51:58 +00:00
|
|
|
#
|
2009-01-27 09:18:18 +00:00
|
|
|
# Copyright (C) 2006-2009 OpenWrt.org
|
2006-08-11 16:51:58 +00:00
|
|
|
#
|
|
|
|
# This is free software, licensed under the GNU General Public License v2.
|
|
|
|
# See /LICENSE for more information.
|
|
|
|
#
|
|
|
|
|
|
|
|
include $(TOPDIR)/rules.mk
|
|
|
|
|
|
|
|
PKG_NAME:=vnstat
|
2009-05-18 13:53:59 +00:00
|
|
|
PKG_VERSION:=1.7
|
2009-06-04 09:57:46 +00:00
|
|
|
PKG_RELEASE:=2
|
2006-08-11 16:51:58 +00:00
|
|
|
|
|
|
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
2006-10-28 20:54:33 +00:00
|
|
|
PKG_SOURCE_URL:=http://humdi.net/vnstat
|
2009-05-18 13:53:59 +00:00
|
|
|
PKG_MD5SUM:=e5788e8122e34f2c93561e2a84c19432
|
2006-08-11 16:51:58 +00:00
|
|
|
|
|
|
|
include $(INCLUDE_DIR)/package.mk
|
|
|
|
|
2009-06-04 09:57:46 +00:00
|
|
|
define Package/vnstat/Default
|
2006-08-11 16:51:58 +00:00
|
|
|
SECTION:=net
|
|
|
|
CATEGORY:=Network
|
|
|
|
URL:=http://humdi.net/vnstat/
|
|
|
|
endef
|
|
|
|
|
2009-06-04 09:57:46 +00:00
|
|
|
define Package/vnstat
|
|
|
|
$(call Package/vnstat/Default)
|
|
|
|
TITLE:=Console-based network traffic monitor
|
|
|
|
endef
|
|
|
|
|
2007-10-14 04:32:56 +00:00
|
|
|
define Package/vnstat/description
|
|
|
|
vnStat is a network traffic monitor for Linux that keeps a log of daily
|
|
|
|
network traffic for the selected interface(s). vnStat isn't a packet
|
|
|
|
sniffer. The traffic information is analyzed from the /proc -filesystem,
|
|
|
|
so vnStat can be used without root permissions.
|
|
|
|
endef
|
|
|
|
|
2009-06-04 09:57:46 +00:00
|
|
|
define Package/vnstati
|
|
|
|
$(call Package/vnstat/Default)
|
|
|
|
DEPENDS+=vnstat +libgd
|
|
|
|
TITLE:=PNG image output support for vnStat
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Package/vnstati/description
|
|
|
|
The purpose of vnstati is to provide image output support for statistics
|
|
|
|
collected using vnstat(1). However, the image file format is limited to
|
|
|
|
png. All basic outputs of vnStat are supported excluding live traffic
|
|
|
|
features. The image can be outputted either to a file or to standard
|
|
|
|
output.
|
|
|
|
endef
|
|
|
|
|
2008-07-28 19:34:31 +00:00
|
|
|
define Package/vnstat/conffiles
|
2009-06-04 09:57:46 +00:00
|
|
|
/etc/vnstat.conf
|
2008-07-28 19:34:31 +00:00
|
|
|
/etc/config/vnstat
|
|
|
|
endef
|
|
|
|
|
2009-06-04 09:57:46 +00:00
|
|
|
define Build/Compile/vnstat
|
2006-10-28 20:54:33 +00:00
|
|
|
$(MAKE) -C $(PKG_BUILD_DIR) \
|
|
|
|
$(TARGET_CONFIGURE_OPTS) \
|
|
|
|
CFLAGS="$(TARGET_CFLAGS)"
|
|
|
|
endef
|
|
|
|
|
2009-06-04 09:57:46 +00:00
|
|
|
define Build/Compile/vnstati
|
|
|
|
$(MAKE) -C $(PKG_BUILD_DIR) \
|
|
|
|
$(TARGET_CONFIGURE_OPTS) \
|
|
|
|
CFLAGS="$(TARGET_CPPFLAGS)" \
|
|
|
|
LDFLAGS="$(TARGET_LDFLAGS) -Wl,-rpath-link,$(STAGING_DIR)/usr/lib" \
|
|
|
|
all
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/Compile
|
|
|
|
$(call Build/Compile/vnstat)
|
|
|
|
$(call Build/Compile/vnstati)
|
|
|
|
endef
|
|
|
|
|
2009-01-27 09:18:18 +00:00
|
|
|
define Package/vnstat/install
|
2006-11-23 00:29:07 +00:00
|
|
|
$(INSTALL_DIR) $(1)/usr/bin
|
|
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/vnstat $(1)/usr/bin/
|
2009-06-04 09:57:46 +00:00
|
|
|
$(INSTALL_DIR) $(1)/usr/sbin
|
|
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/vnstatd $(1)/usr/sbin/
|
|
|
|
$(INSTALL_DIR) $(1)/etc
|
|
|
|
$(INSTALL_DATA) ./files/vnstat.conf $(1)/etc
|
2008-07-28 19:34:31 +00:00
|
|
|
$(INSTALL_DIR) $(1)/etc/config
|
2009-06-04 09:57:46 +00:00
|
|
|
$(INSTALL_DATA) ./files/vnstat-uci.conf $(1)/etc/config/vnstat
|
2008-07-28 19:34:31 +00:00
|
|
|
$(INSTALL_DIR) $(1)/etc/init.d
|
|
|
|
$(INSTALL_BIN) ./files/vnstat.init $(1)/etc/init.d/vnstat
|
|
|
|
endef
|
|
|
|
|
2009-06-04 09:57:46 +00:00
|
|
|
define Package/vnstati/install
|
|
|
|
$(INSTALL_DIR) $(1)/usr/bin
|
|
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/vnstati $(1)/usr/bin/
|
|
|
|
endef
|
|
|
|
|
2008-07-28 19:34:31 +00:00
|
|
|
define Package/vnstat/postinst
|
|
|
|
#!/bin/sh
|
2009-01-27 09:18:18 +00:00
|
|
|
BIN_REL=/usr/bin/vnstat
|
|
|
|
BIN=$${IPKG_INSTROOT}$${BIN_REL}
|
2008-07-28 19:34:31 +00:00
|
|
|
CRONTAB=$${IPKG_INSTROOT}/etc/crontabs/root
|
2009-01-27 09:18:18 +00:00
|
|
|
LIB_D_REL=/var/lib/vnstat
|
|
|
|
LIB_D=$${IPKG_INSTROOT}$${LIB_D_REL}
|
2008-07-28 19:34:31 +00:00
|
|
|
mkdir -p $${IPKG_INSTROOT}/etc/crontabs/
|
|
|
|
[ -d $$LIB_D ] || mkdir -p $$LIB_D
|
|
|
|
IFACE_WAN=$$(uci get network.wan.ifname)
|
|
|
|
if [ -n $$IFACE_WAN ]; then
|
|
|
|
[ -e $$LIB_D/$$IFACE_WAN ] || ( [ -x $$BIN ] && $$BIN -u -i $$IFACE_WAN )
|
|
|
|
fi
|
2009-01-27 09:18:18 +00:00
|
|
|
grep -q "$$BIN_REL -u" $$CRONTAB 2>/dev/null
|
2009-06-04 09:57:46 +00:00
|
|
|
[ $$? -eq 0 ] && sed -i -e "/\/usr\/bin\/vnstat -u/d" $$CRONTAB
|
2008-07-28 19:34:31 +00:00
|
|
|
true
|
2006-08-11 16:51:58 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
$(eval $(call BuildPackage,vnstat))
|
2009-06-04 09:57:46 +00:00
|
|
|
$(eval $(call BuildPackage,vnstati))
|