[packages] net/vnstat: clean up initscript, reduce cron interval to 30 minutes. thank...
authorAndy Boyett <agb@openwrt.org>
Tue, 27 Jan 2009 09:18:18 +0000 (09:18 +0000)
committerAndy Boyett <agb@openwrt.org>
Tue, 27 Jan 2009 09:18:18 +0000 (09:18 +0000)
SVN-Revision: 14218

net/vnstat/Makefile

index 2b940b4121b5a5157f72bc9d8d4106c6ae04fa7f..481d5068698ac4b2cc7d2060099796a103ac3457 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2006 OpenWrt.org
+# Copyright (C) 2006-2009 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=vnstat
 PKG_VERSION:=1.6
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://humdi.net/vnstat
@@ -44,7 +44,7 @@ define Build/Compile
                CFLAGS="$(TARGET_CFLAGS)"
 endef
 
-define Package/vnstat/install  
+define Package/vnstat/install
        $(INSTALL_DIR) $(1)/usr/bin
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/vnstat $(1)/usr/bin/
        $(INSTALL_DIR) $(1)/etc/config
@@ -55,17 +55,19 @@ endef
 
 define Package/vnstat/postinst
 #!/bin/sh
-BIN=$${IPKG_INSTROOT}/usr/bin/vnstat
+BIN_REL=/usr/bin/vnstat
+BIN=$${IPKG_INSTROOT}$${BIN_REL}
 CRONTAB=$${IPKG_INSTROOT}/etc/crontabs/root
-LIB_D=$${IPKG_INSTROOT}/var/lib/vnstat
+LIB_D_REL=/var/lib/vnstat
+LIB_D=$${IPKG_INSTROOT}$${LIB_D_REL}
 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
-grep -q "$$BIN -u" $$CRONTAB 2>/dev/null
-[ $$? -ne 0 ] && echo "0-55/5 *   * * *   root    if [ -x $$BIN ] && [ \`ls $$LIB_D | wc -l\` -ge 1 ]; then $$BIN -u; fi" >> $$CRONTAB
+grep -q "$$BIN_REL -u" $$CRONTAB 2>/dev/null
+[ $$? -ne 0 ] && echo "*/30 * * * *   root    if [ -x $$BIN_REL ] && [ \`ls $$LIB_D_REL | wc -l\` -ge 1 ]; then $$BIN_REL -u; fi" >> $$CRONTAB
 true
 endef