Commit e49a0c19 authored by Adam Wujek's avatar Adam Wujek 💬

rootfs: try to use IP from old dot-config when no IP available

This commit is to manage with situation that there is no IP address at the
moment of getting new dot-config. At this point IP can be available from
barebox, but not always. New functionality checks for IP configuration in the
old dot-config. IP will be reconfigured after getting new dot-config.
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 7ad5bcc7
......@@ -33,6 +33,12 @@ if [ -n "$CONFIG_DOTCONF_URL" ]; then
# replace IPADDR and MACADDR, to have a device-specific name
macaddr=$(cat /sys/class/net/eth0/address)
ipaddr=$(ifconfig eth0 | grep inet | cut -d: -f 2 | cut '-d ' -f 1)
if [ -z "$ipaddr" ]; then
# if no IP address available from barebox try to get IP from old dot-config
# /etc/init.d/network will run later again
/etc/init.d/network
ipaddr=$(ifconfig eth0 | grep inet | cut -d: -f 2 | cut '-d ' -f 1)
fi
URL=$(echo $CONFIG_DOTCONF_URL | \
sed -e s/MACADDR/$macaddr/ -e s/IPADDR/$ipaddr/)
# split the parts, as we need to handle tftp by hand
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment