Browse Source

muninlite: correctly parse ifname with - char

Rewrote Jo-Philipp Wich's patch so it applies to source files rather
than generated files.

Closes #701

Signed-off-by: Jonathan McCrohan <jmccrohan@gmail.com>
lilik-openwrt-22.03
Jonathan McCrohan 10 years ago
parent
commit
cb28f6e459
2 changed files with 23 additions and 1 deletions
  1. +1
    -1
      admin/muninlite/Makefile
  2. +22
    -0
      admin/muninlite/patches/220-modify-ifname-parser.patch

+ 1
- 1
admin/muninlite/Makefile View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=muninlite PKG_NAME:=muninlite
PKG_VERSION:=1.0.4 PKG_VERSION:=1.0.4
PKG_RELEASE:=5
PKG_RELEASE:=6
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/$(PKG_NAME) PKG_SOURCE_URL:=@SF/$(PKG_NAME)


+ 22
- 0
admin/muninlite/patches/220-modify-ifname-parser.patch View File

@ -0,0 +1,22 @@
--- a/plugins/if_
+++ b/plugins/if_
@@ -26,7 +26,7 @@ config_if() {
fi
}
fetch_if() {
- IINFO=$(grep "$1:" /proc/net/dev | cut -d: -f2 | sed -e 's/ / /g')
+ IINFO=$(cat /proc/net/dev | sed -e 's/-/_/g' | grep "$1:" | cut -d: -f2 | sed -e 's/ */ /g' -e 's/^[ \t]*//')
echo "down.value" $(echo $IINFO | cut -d\ -f1)
echo "up.value" $(echo $IINFO | cut -d\ -f9)
}
--- a/plugins/if_err_
+++ b/plugins/if_err_
@@ -15,7 +15,7 @@ config_if_err() {
echo "trans.warning 1"
}
fetch_if_err() {
- IINFO=$(grep "$1:" /proc/net/dev | cut -d: -f2 | sed -e 's/ / /g')
+ IINFO=$(cat /proc/net/dev | sed -e 's/-/_/g' | grep "$1:" | cut -d: -f2 | sed -e 's/ */ /g' -e 's/^[ \t]*//')
echo "rcvd.value" $(echo $IINFO | cut -d\ -f3)
echo "trans.value" $(echo $IINFO | cut -d\ -f11)
}

Loading…
Cancel
Save