diff --git a/scripts/h3consumption b/scripts/h3consumption index f3679db48..96a808488 100755 --- a/scripts/h3consumption +++ b/scripts/h3consumption @@ -213,10 +213,17 @@ ChangeSettings() { echo 'ethtool -s eth0 speed 100 duplex full' >>"${RCLocalContents}" ;; on) - sed -i -e 's/^gmac_used\ =\ 0/gmac_used = 1/g' "${FexSettings}" + BOARD=$(awk -F"=" '/^BOARD=/ {print $2}' </etc/armbian-release) + if [ "X${BOARD}" = "X" ]; then + echo "Armbian installation too old, please apt-get upgrade before. Exiting." >&2 + exit 1 + else + OrigSettings=$(bin2fex /boot/bin/${BOARD}.bin 2>/dev/null | awk -F" " '/^gmac_used/ {print $3}') + sed -i -e "s/^gmac_used\ =\ 0/gmac_used = ${OrigSettings}/g" "${FexSettings}" + fi ;; off) - sed -i -e 's/^gmac_used\ =\ 1/gmac_used = 0/g' "${FexSettings}" + sed -i -e 's/^gmac_used\ =\ \(.*\)/gmac_used = 0/g' "${FexSettings}" ;; *) echo "Parameter error: -e requires either on, fast or off. Exiting" >&2