11d91501d0
According to http://bit.ly/2HA4oDO and the official Ubuntu manual http://manpages.ubuntu.com/manpages/xenial/man5/interfaces.5.html source-dir support has been removed from Ubuntu >= 16.04/Xenial Once an image is generated and booted, moving the dhcp interface(s) declaration(s) from /etc/network/interfaces into specific subentries of /etc/network/interfaces.d and calling 'service networking restart' just make your instance unreachable and all interfaces are left unconfigured. This patchset fixes this issue Change-Id: I6b6b99c81490c874c5db5405c2fbf3c180c87464
34 lines
849 B
Bash
Executable file
34 lines
849 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*
|
|
|
|
# Gentoo
|
|
rm -f /etc/conf.d/net*
|
|
|
|
# /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
|
|
if [ "$DISTRO_NAME" == "ubuntu" ] && [ "$DIB_RELEASE" == "trusty" ]; then
|
|
printf "source-directory interfaces.d\n\n" >> /etc/network/interfaces
|
|
else
|
|
printf "source /etc/network/interfaces.d/*\n\n" >> /etc/network/interfaces
|
|
fi
|
|
fi
|
|
fi
|