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