h3consumption: fix for disabling and re-enabling Ethernet on Fast Ethernet boards

This commit is contained in:
Thomas Kaiser 2016-08-22 00:32:59 +02:00 committed by GitHub
parent b5ef414332
commit 0bc9faecac

View file

@ -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