ironic-python-agent-builder/tinyipa/build_files/dhcp.sh
Fedor Tarasenko 9f88a024c7 dhcp.sh predictible ifnames
Adds predictible and biosdevnames to dhcp.sh script filter
Useful for tinyipa image builds

Change-Id: I312dabd95de3823051af04fbc5f4c55c544f8b49
Story: #2008701
Task: #42021
2021-03-16 15:46:26 +00:00

22 lines
711 B
Bash

#!/bin/sh
# The DHCP portion is now separated out, in order to not slow the boot down
# only to wait for slow network cards
. /etc/init.d/tc-functions
# This waits until all devices have registered
/sbin/udevadm settle --timeout=%UDEV_SETTLE_TIMEOUT%
NETDEVICES="$(awk -F: '/^ *e.*:|^ *p.*:/{print $1}' /proc/net/dev 2>/dev/null)"
echo "$0: Discovered network devices: $NETDEVICES"
for DEVICE in $NETDEVICES; do
ifconfig $DEVICE | grep -q "inet addr"
if [ "$?" != 0 ]; then
echo -e "\nNetwork device $DEVICE detected, DHCP broadcasting for IP."
trap 2 3 11
/sbin/udhcpc -b -i $DEVICE -x hostname:$(/bin/hostname) -p /var/run/udhcpc.$DEVICE.pid 2>&1 &
trap "" 2 3 11
sleep 1
fi
done