[naalstones] muninlite: Fixes: Error messages on server due to missing ethtool on...
[openwrt/svn-archive/archive.git] / admin / muninlite / patches / 100-fix-no-ethtool.patch
1 --- a/plugins/if_
2 +++ b/plugins/if_
3 @@ -15,10 +15,14 @@ config_if() {
4 echo "up.min 0"
5 echo "up.negative down"
6 echo "up.cdef up,8,*"
7 - if ethtool $1 | grep -q Speed; then
8 - MAX=$(($(ethtool $1 | grep Speed | sed -e 's/[[:space:]]\{1,\}/ /g' -e 's/^ //' -e 's/M.*//' | cut -d\ -f2) * 1000000))
9 - echo "up.max $MAX"
10 - echo "down.max $MAX"
11 + if [ -n "$(which ethtool)" ]; then
12 + if [ -x "$(which ethtool)" ]; then
13 + if ethtool $1 | grep -q Speed; then
14 + MAX=$(($(ethtool $1 | grep Speed | sed -e 's/[[:space:]]\{1,\}/ /g' -e 's/^ //' -e 's/M.*//' | cut -d\ -f2) * 1000000))
15 + echo "up.max $MAX"
16 + echo "down.max $MAX"
17 + fi
18 + fi
19 fi
20 }
21 fetch_if() {