source: packages/net/vnstat/Makefile @ 17614

Last change on this file since 17614 was 17614, checked in by florian, 7 years ago

[package] update vnstat to 1.9 (#5845)

  • Property copyright set to Copyright (C) 2006 OpenWrt.org
  • Property licence set to GPLv2
  • Property svn:eol-style set to native
File size: 3.1 KB
Line 
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
8include $(TOPDIR)/rules.mk
9
10PKG_NAME:=vnstat
11PKG_VERSION:=1.9
12PKG_RELEASE:=1
13
14PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15PKG_SOURCE_URL:=http://humdi.net/vnstat
16PKG_MD5SUM:=ebaf8352fa3674faea2fe2ce1001a38d
17
18include $(INCLUDE_DIR)/package.mk
19
20define Package/vnstat/Default
21  SECTION:=net
22  CATEGORY:=Network
23  URL:=http://humdi.net/vnstat/
24endef
25
26define Package/vnstat
27$(call Package/vnstat/Default)
28  TITLE:=Console-based network traffic monitor
29endef
30
31define Package/vnstat/description
32        vnStat is a network traffic monitor for Linux that keeps a log of daily
33        network traffic for the selected interface(s). vnStat isn't a packet
34        sniffer. The traffic information is analyzed from the /proc -filesystem,
35        so vnStat can be used without root permissions.
36endef
37
38define Package/vnstati
39$(call Package/vnstat/Default)
40  DEPENDS+=vnstat +libgd
41  TITLE:=PNG image output support for vnStat
42endef
43
44define Package/vnstati/description
45        The purpose of vnstati is to provide image output support for statistics
46        collected using vnstat(1). However, the image file format is limited to
47        png. All basic outputs of vnStat are supported excluding live traffic
48        features. The image can be outputted either to a file or to standard
49        output.
50endef
51
52define Package/vnstat/conffiles
53/etc/vnstat.conf
54/etc/config/vnstat
55endef
56
57define Build/Compile/vnstat
58        $(MAKE) -C $(PKG_BUILD_DIR) \
59                $(TARGET_CONFIGURE_OPTS) \
60                CFLAGS="$(TARGET_CFLAGS)"
61endef
62
63define Build/Compile/vnstati
64        $(MAKE) -C $(PKG_BUILD_DIR) \
65                $(TARGET_CONFIGURE_OPTS) \
66                CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include" \
67                LDFLAGS="$(TARGET_LDFLAGS) -Wl,-rpath-link,$(STAGING_DIR)/usr/lib" \
68                all
69endef
70
71define Build/Compile
72$(call Build/Compile/vnstat)
73$(call Build/Compile/vnstati)
74endef
75
76define Package/vnstat/install
77        $(INSTALL_DIR) $(1)/usr/bin
78        $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/vnstat $(1)/usr/bin/
79        $(INSTALL_DIR) $(1)/usr/sbin
80        $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/vnstatd $(1)/usr/sbin/
81        $(INSTALL_DIR) $(1)/etc
82        $(INSTALL_CONF) $(PKG_BUILD_DIR)/cfg/vnstat.conf $(1)/etc/
83        $(INSTALL_DIR) $(1)/etc/config
84        $(INSTALL_CONF) ./files/vnstat-uci.conf $(1)/etc/config/vnstat
85        $(INSTALL_DIR) $(1)/etc/init.d
86        $(INSTALL_BIN) ./files/vnstat.init $(1)/etc/init.d/vnstat
87endef
88
89define Package/vnstati/install
90        $(INSTALL_DIR) $(1)/usr/bin
91        $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/vnstati $(1)/usr/bin/
92endef
93
94define Package/vnstat/postinst
95#!/bin/sh
96BIN_REL=/usr/bin/vnstat
97BIN=$${IPKG_INSTROOT}$${BIN_REL}
98CRONTAB=$${IPKG_INSTROOT}/etc/crontabs/root
99LIB_D_REL=/var/lib/vnstat
100LIB_D=$${IPKG_INSTROOT}$${LIB_D_REL}
101mkdir -p $${IPKG_INSTROOT}/etc/crontabs/
102[ -d $$LIB_D ] || mkdir -p $$LIB_D
103IFACE_WAN=$$(uci get network.wan.ifname)
104if [ -n $$IFACE_WAN ]; then
105        [ -e $$LIB_D/$$IFACE_WAN ] || ( [ -x $$BIN ] && $$BIN -u -i $$IFACE_WAN )
106fi
107grep -q "$$BIN_REL -u" $$CRONTAB 2>/dev/null
108[ $$? -eq 0 ] && sed -i -e "/\/usr\/bin\/vnstat -u/d" $$CRONTAB
109true
110endef
111
112$(eval $(call BuildPackage,vnstat))
113$(eval $(call BuildPackage,vnstati))
Note: See TracBrowser for help on using the repository browser.