Fix error messages on server due to missing ethtool on node

Source: patch "100-fix-no-ethtool" from OpenWrt
Author: cshore
This commit is contained in:
Lars Kruse 2019-07-19 05:49:51 +02:00
parent d9b1b1ad3f
commit 3e0ecfe678

View file

@ -15,11 +15,15 @@ config_if() {
echo "up.min 0"
echo "up.negative down"
echo "up.cdef up,8,*"
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() {
IINFO=$(grep "$1:" /proc/net/dev | cut -d: -f2 | sed -e 's/ / /g')