diskimage-builder/elements/dhcp-all-interfaces/install.d/60-remove-cloud-image-interfaces
Gregory Haynes 4f4fab979e Really remove all interfaces in dhcp-all-ifaces
As the doc says, we want to remove all interfaces that come by default
in cloud images. Cloud images also come with an eth1 though, so lets
just remove all interfaces.

Change-Id: I49c74a3285e6a610ac723bdf976f3727d2736749
2016-03-23 05:57:56 +00:00

28 lines
619 B
Bash
Executable File

#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
# Cloud images may hard code the eth0 interfaces so they
# boot with DHCP.
# Fedora
rm -f /etc/sysconfig/network-scripts/ifcfg-eth*
# Ubuntu
rm -f /etc/network/interfaces.d/eth*.cfg
# Debian
rm -f /etc/network/interfaces.d/eth*
# /etc/network/interfaces distributions
if [ -f "/etc/network/interfaces" ]; then
printf "auto lo\niface lo inet loopback\n\n" > /etc/network/interfaces
if [ -d "/etc/network/interfaces.d/" ]; then
printf "source-directory interfaces.d\n\n" >> /etc/network/interfaces
fi
fi