Fix /etc/network/interfaces file contents

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
This commit is contained in:
Olivier Bourdon 2018-04-19 12:00:13 +02:00
parent e210f79500
commit 11d91501d0
2 changed files with 10 additions and 2 deletions

View File

@ -25,6 +25,10 @@ rm -f /etc/conf.d/net*
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

View File

@ -28,6 +28,10 @@ rm -f /etc/conf.d/net*
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