From 19314503bc6f184b9c0700553457736386c0f059 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 6 Sep 2011 22:05:27 +0000 Subject: [PATCH] [backfire] merge r28187 SVN-Revision: 28188 --- net/vnstat/Makefile | 12 ++++-------- net/vnstat/files/vnstat.defaults | 12 ++++++++++++ 2 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 net/vnstat/files/vnstat.defaults diff --git a/net/vnstat/Makefile b/net/vnstat/Makefile index e13c64ea38..efabd1708a 100644 --- a/net/vnstat/Makefile +++ b/net/vnstat/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=vnstat PKG_VERSION:=1.11 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://humdi.net/vnstat @@ -89,6 +89,8 @@ define Package/vnstat/install $(INSTALL_CONF) ./files/vnstat-uci.conf $(1)/etc/config/vnstat $(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_BIN) ./files/vnstat.init $(1)/etc/init.d/vnstat + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_BIN) ./files/vnstat.defaults $(1)/etc/uci-defaults/vnstat endef define Package/vnstati/install @@ -98,13 +100,7 @@ endef define Package/vnstat/postinst #!/bin/sh -local wan="$$(uci -P/var/state get network.wan.ifname)" -if [ -n "$$wan" ]; then - uci -q batch <<-EOF >/dev/null - add_list vnstat.@vnstat[-1].interface=$$wan - commit vnstat - EOF -fi +[ -n "$${IPKG_INSTROOT}" ] || (. /etc/uci-defaults/vnstat) && rm -f /etc/uci-defaults/vnstat exit 0 endef diff --git a/net/vnstat/files/vnstat.defaults b/net/vnstat/files/vnstat.defaults new file mode 100644 index 0000000000..a2d353f3f6 --- /dev/null +++ b/net/vnstat/files/vnstat.defaults @@ -0,0 +1,12 @@ +#!/bin/sh + +wan="$(uci -P/var/state get network.wan.ifname)" + +if [ -n "$wan" ]; then + uci -q batch <<-EOF >/dev/null + add_list vnstat.@vnstat[-1].interface=$wan + commit vnstat + EOF +fi + +exit 0 -- 2.30.2