miniupnpd: suppress grep and uci errors
authorDavid Ehrmann <ehrmann@gmail.com>
Sat, 20 Jun 2020 22:34:39 +0000 (15:34 -0700)
committerRosen Penev <rosenp@gmail.com>
Sun, 28 Jun 2020 21:00:39 +0000 (14:00 -0700)
If miniupnpd is installed but disabled or not running, the hotplug
script will query uci for keys that don't exist and grep a temporary
config file that doesn't exist, resulting in the following errors:

uci: Entry not found
grep: /var/etc/miniupnd.conf: No such file or directory

These would arise when an interface is brought up or down, and are
more confusing than helpful, especially when miniupnpd is disabled.

Suppress these errors.

Signed-off-by: David Ehrmann <ehrmann@gmail.com>
(cherry picked from commit 6ef2b5400bce73b12158b2f8d92dd9675afe8203)

net/miniupnpd/Makefile
net/miniupnpd/files/miniupnpd.hotplug

index ae95b4a2cca8b4433da411fefe78226864658e71..86d4944020434ba651f0fb4f424b7cea2fdfe20a 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=miniupnpd
 PKG_VERSION:=2.1.20191006
-PKG_RELEASE:=5
+PKG_RELEASE:=6
 
 PKG_SOURCE_URL:=https://miniupnp.tuxfamily.org/files
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
index 059b2b6066d5761730d032da9c135351a95fb9a9..15b80c4ef3bb5bbc75f203180ed6e2feeb7d36bf 100644 (file)
@@ -12,9 +12,9 @@
 [ "$ACTION" != "ifup" ] && procd_running "miniupnpd" "*" && exit 0
 
 tmpconf="/var/etc/miniupnpd.conf"
-external_iface=$(uci get upnpd.config.external_iface)
-external_iface6=$(uci get upnpd.config.external_iface6)
-external_zone=$(uci get upnpd.config.external_zone)
+external_iface=$(uci -q get upnpd.config.external_iface)
+external_iface6=$(uci -q get upnpd.config.external_iface6)
+external_zone=$(uci -q get upnpd.config.external_zone)
 
 . /lib/functions/network.sh
 
@@ -41,6 +41,6 @@ fi
 
 [ "$DEVICE" != "$ifname" ] && [ "$DEVICE" != "$ifname6" ] && exit 0
 
-grep -q "^ext_ifname=$ifname" "$tmpconf" && grep -q "^ext_ifname6=$ifname6" "$tmpconf" && exit 0
+grep -qs "^ext_ifname=$ifname" "$tmpconf" && grep -qs "^ext_ifname6=$ifname6" "$tmpconf" && exit 0
 
 /etc/init.d/miniupnpd restart