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.

110 lines
3.0 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.17
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=http://humdi.net/vnstat
  13. PKG_HASH:=18e4c53576ca9e1ef2f0e063a6d83b0c44e3b1cf008560d658745df5c9aa7971
  14. PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
  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. LDFLAGS="$(TARGET_LDFLAGS)"
  55. endef
  56. define Build/Compile/vnstati
  57. +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
  58. $(TARGET_CONFIGURE_OPTS) \
  59. CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include" \
  60. LDFLAGS="$(TARGET_LDFLAGS) -Wl,-rpath-link,$(STAGING_DIR)/usr/lib" \
  61. all
  62. endef
  63. define Build/Compile
  64. $(call Build/Compile/vnstat)
  65. $(call Build/Compile/vnstati)
  66. endef
  67. define Package/vnstat/install
  68. $(INSTALL_DIR) $(1)/usr/bin
  69. $(CP) $(PKG_INSTALL_DIR)/usr/bin/vnstat $(1)/usr/bin/
  70. $(INSTALL_DIR) $(1)/usr/sbin
  71. $(CP) $(PKG_INSTALL_DIR)/usr/sbin/vnstatd $(1)/usr/sbin/
  72. $(INSTALL_DIR) $(1)/etc
  73. $(INSTALL_CONF) $(PKG_BUILD_DIR)/cfg/vnstat.conf $(1)/etc/
  74. $(INSTALL_DIR) $(1)/etc/config
  75. $(INSTALL_CONF) ./files/vnstat.config $(1)/etc/config/vnstat
  76. $(INSTALL_DIR) $(1)/etc/init.d
  77. $(INSTALL_BIN) ./files/vnstat.init $(1)/etc/init.d/vnstat
  78. $(INSTALL_DIR) $(1)/etc/uci-defaults
  79. $(INSTALL_BIN) ./files/vnstat.defaults $(1)/etc/uci-defaults/vnstat
  80. endef
  81. define Package/vnstati/install
  82. $(INSTALL_DIR) $(1)/usr/bin
  83. $(CP) $(PKG_INSTALL_DIR)/usr/bin/vnstati $(1)/usr/bin/
  84. endef
  85. define Package/vnstat/postinst
  86. #!/bin/sh
  87. [ -n "$${IPKG_INSTROOT}" ] || (. /etc/uci-defaults/vnstat) && rm -f /etc/uci-defaults/vnstat
  88. exit 0
  89. endef
  90. $(eval $(call BuildPackage,vnstat))
  91. $(eval $(call BuildPackage,vnstati))