meta-digi-dey: Fix ifup script for manual configuration.

The system freezes if we try to set the MAC addresses before the interface
is up, so check the state before doing it.

https://jira.digi.com/browse/DEL-509

Signed-off-by: Alex Gonzalez <alex.gonzalez@digi.com>
This commit is contained in:
Alex Gonzalez 2013-06-18 11:52:01 +02:00
parent e04b4329ab
commit 698df28ed6
1 changed files with 6 additions and 2 deletions

View File

@ -34,14 +34,18 @@ if [ -h /sys/class/net/eth0 ]; then
;;
esac
if [ "${macaddr}" ]; then
/sbin/ifconfig eth0 hw ether ${macaddr}
if /sbin/ifconfig eth0 | grep -qs UP; then
/sbin/ifconfig eth0 hw ether ${macaddr}
fi
fi
fi
if [ -h /sys/class/net/eth1 ]; then
macaddr=`cat /proc/cmdline | sed 's,\s,\n,g' | awk '/ethaddr3/ {print}' | sed 's,ethaddr3=,,g'`
if [ "${macaddr}" ]; then
/sbin/ifconfig eth1 hw ether ${macaddr}
if /sbin/ifconfig eth1 | grep -qs UP; then
/sbin/ifconfig eth1 hw ether ${macaddr}
fi
fi
fi