diskimage-builder/elements/stable-interface-names/install.d/02-stable-interface-names
Dan Prince 99c54323a0 Make stable-interface-names its own element.
Virtual baremetal instances have their NICs show up as ens4
which doesn't play nicely as a default in devtest at
the moment.

Ideally we'd want it to be em1 like real baremetal
(which is why we put this in the baremetal element
to begin with). Turns out the baremetal element is
required in devtest so we can extract the ramdisk and kernel
so lets leave it alone for now and move this elsewhere
until we get a better solution for fake 'baremetal'
testing.

Closes-bug: #1298152
Change-Id: Ia71e1d32b93db0c4c844a6dc1ebcd04ab0c13f05
2014-03-26 22:25:39 -04:00

26 lines
747 B
Bash
Executable File

#!/bin/bash
# remove softlink to /dev/null which disables these rules
NET_NAME_SLOT_FILE="/etc/udev/rules.d/80-net-name-slot.rules"
if [ -h $NET_NAME_SLOT_FILE ]; then
rm $NET_NAME_SLOT_FILE
fi
install-packages biosdevname
# Fedora/RHEL cloud images may hard code the eth0 interface
# so it boots w/ DHCP. We remove this file here so it
# doesn't interfere w/ stable interface naming
IFCFG_NETSCRIPT="/etc/sysconfig/network-scripts/ifcfg-eth0"
if [ -f $IFCFG_NETSCRIPT ]; then
rm $IFCFG_NETSCRIPT
fi
# Ubuntu may hard code the eth0 interface for DHCP
# We remove this file here so it doesn't interfere w/
# stable interface naming
ENI_ETH0_CFG="/etc/network/interfaces.d/eth0.cfg"
if [ -f $ENI_ETH0_CFG ]; then
rm $ENI_ETH0_CFG
fi