[packages] vnstat: defer postinstall in host installation case

git-svn-id: svn://svn.openwrt.org/openwrt/packages@28187 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
jow 2011-09-06 22:04:38 +00:00
parent c8fd749f76
commit 2745bc1445
2 changed files with 16 additions and 8 deletions

View File

@ -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

View File

@ -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