You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

109 lines
2.9 KiB

  1. #
  2. # Copyright (C) 2006-2014 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=vnstat
  9. PKG_VERSION:=1.12
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=http://humdi.net/vnstat
  13. PKG_MD5SUM:=a154b2196771e06a8accd1c24374009c
  14. PKG_MAINTAINER:=Jo-Philipp Wich <jow@openwrt.org>
  15. PKG_INSTALL:=1
  16. PKG_BUILD_DEPENDS:=libgd
  17. PKG_BUILD_PARALLEL:=1
  18. include $(INCLUDE_DIR)/package.mk
  19. define Package/vnstat/Default
  20. SECTION:=net
  21. CATEGORY:=Network
  22. URL:=http://humdi.net/vnstat/
  23. endef
  24. define Package/vnstat
  25. $(call Package/vnstat/Default)
  26. TITLE:=Console-based network traffic monitor
  27. endef
  28. define Package/vnstat/description
  29. vnStat is a network traffic monitor for Linux that keeps a log of daily
  30. network traffic for the selected interface(s). vnStat isn't a packet
  31. sniffer. The traffic information is analyzed from the /proc -filesystem,
  32. so vnStat can be used without root permissions.
  33. endef
  34. define Package/vnstati
  35. $(call Package/vnstat/Default)
  36. DEPENDS+=vnstat +libgd
  37. TITLE:=PNG image output support for vnStat
  38. endef
  39. define Package/vnstati/description
  40. The purpose of vnstati is to provide image output support for statistics
  41. collected using vnstat(1). However, the image file format is limited to
  42. png. All basic outputs of vnStat are supported excluding live traffic
  43. features. The image can be outputted either to a file or to standard
  44. output.
  45. endef
  46. define Package/vnstat/conffiles
  47. /etc/vnstat.conf
  48. /etc/config/vnstat
  49. endef
  50. define Build/Compile/vnstat
  51. +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
  52. $(TARGET_CONFIGURE_OPTS) \
  53. CFLAGS="$(TARGET_CFLAGS)"
  54. endef
  55. define Build/Compile/vnstati
  56. +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
  57. $(TARGET_CONFIGURE_OPTS) \
  58. CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include" \
  59. LDFLAGS="$(TARGET_LDFLAGS) -Wl,-rpath-link,$(STAGING_DIR)/usr/lib" \
  60. all
  61. endef
  62. define Build/Compile
  63. $(call Build/Compile/vnstat)
  64. $(call Build/Compile/vnstati)
  65. endef
  66. define Package/vnstat/install
  67. $(INSTALL_DIR) $(1)/usr/bin
  68. $(CP) $(PKG_INSTALL_DIR)/usr/bin/vnstat $(1)/usr/bin/
  69. $(INSTALL_DIR) $(1)/usr/sbin
  70. $(CP) $(PKG_INSTALL_DIR)/usr/sbin/vnstatd $(1)/usr/sbin/
  71. $(INSTALL_DIR) $(1)/etc
  72. $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/vnstat.conf $(1)/etc/
  73. $(INSTALL_DIR) $(1)/etc/config
  74. $(INSTALL_CONF) ./files/vnstat.config $(1)/etc/config/vnstat
  75. $(INSTALL_DIR) $(1)/etc/init.d
  76. $(INSTALL_BIN) ./files/vnstat.init $(1)/etc/init.d/vnstat
  77. $(INSTALL_DIR) $(1)/etc/uci-defaults
  78. $(INSTALL_BIN) ./files/vnstat.defaults $(1)/etc/uci-defaults/vnstat
  79. endef
  80. define Package/vnstati/install
  81. $(INSTALL_DIR) $(1)/usr/bin
  82. $(CP) $(PKG_INSTALL_DIR)/usr/bin/vnstati $(1)/usr/bin/
  83. endef
  84. define Package/vnstat/postinst
  85. #!/bin/sh
  86. [ -n "$${IPKG_INSTROOT}" ] || (. /etc/uci-defaults/vnstat) && rm -f /etc/uci-defaults/vnstat
  87. exit 0
  88. endef
  89. $(eval $(call BuildPackage,vnstat))
  90. $(eval $(call BuildPackage,vnstati))