[package] add pcapsipdump and link it against uclibc++ preferably (#4969)
[openwrt/svn-archive/archive.git] / net / vnstat / Makefile
1 #
2 # Copyright (C) 2006-2009 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:=vnstat
11 PKG_VERSION:=1.6
12 PKG_RELEASE:=3
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=http://humdi.net/vnstat
16 PKG_MD5SUM:=ccaffe8e70d47e0cf2f25e52daa25712
17
18 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
19
20 include $(INCLUDE_DIR)/package.mk
21
22 define Package/vnstat
23 SECTION:=net
24 CATEGORY:=Network
25 TITLE:=Console-based network traffic monitor
26 URL:=http://humdi.net/vnstat/
27 endef
28
29 define Package/vnstat/description
30 vnStat is a network traffic monitor for Linux that keeps a log of daily
31 network traffic for the selected interface(s). vnStat isn't a packet
32 sniffer. The traffic information is analyzed from the /proc -filesystem,
33 so vnStat can be used without root permissions.
34 endef
35
36 define Package/vnstat/conffiles
37 /etc/config/vnstat
38 endef
39
40 define Build/Compile
41 $(MAKE) -C $(PKG_BUILD_DIR) \
42 $(TARGET_CONFIGURE_OPTS) \
43 CFLAGS="$(TARGET_CFLAGS)"
44 endef
45
46 define Package/vnstat/install
47 $(INSTALL_DIR) $(1)/usr/bin
48 $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/vnstat $(1)/usr/bin/
49 $(INSTALL_DIR) $(1)/etc/config
50 $(INSTALL_DATA) ./files/vnstat.conf $(1)/etc/config/vnstat
51 $(INSTALL_DIR) $(1)/etc/init.d
52 $(INSTALL_BIN) ./files/vnstat.init $(1)/etc/init.d/vnstat
53 endef
54
55 define Package/vnstat/postinst
56 #!/bin/sh
57 BIN_REL=/usr/bin/vnstat
58 BIN=$${IPKG_INSTROOT}$${BIN_REL}
59 CRONTAB=$${IPKG_INSTROOT}/etc/crontabs/root
60 LIB_D_REL=/var/lib/vnstat
61 LIB_D=$${IPKG_INSTROOT}$${LIB_D_REL}
62 mkdir -p $${IPKG_INSTROOT}/etc/crontabs/
63 [ -d $$LIB_D ] || mkdir -p $$LIB_D
64 IFACE_WAN=$$(uci get network.wan.ifname)
65 if [ -n $$IFACE_WAN ]; then
66 [ -e $$LIB_D/$$IFACE_WAN ] || ( [ -x $$BIN ] && $$BIN -u -i $$IFACE_WAN )
67 fi
68 grep -q "$$BIN_REL -u" $$CRONTAB 2>/dev/null
69 [ $$? -ne 0 ] && echo "*/30 * * * * if [ -x $$BIN_REL ] && [ \`ls $$LIB_D_REL | wc -l\` -ge 1 ]; then $$BIN_REL -u; fi" >> $$CRONTAB
70 true
71 endef
72
73 $(eval $(call BuildPackage,vnstat))